系统公告页面设计
来占个位置,我最近也要做公告的模块,具体的我正在想.
可以这样设想吗:你在一个页面上放好多个label控件,当你单击添加公告的时候,让你的下个label控件为显示,其余的不显示,然后你在忘label里面添加内容,当你单击确定的时候,把这个label的text插入到后台数据库中,当你显示的时候,页面里的label控件就会显示你的公告内容了.至于数据库吧,你可以设个id为主键,设为自动编号,一个note为你的内容.
我也没有做过这个东西,这只是代表了我自己的想法.能实现与否还得来实践下
朋友,你实现了吗?绑定数据我把弄好了,你看不看?
使用DataList,进行编辑模版.具体前台代码
<asp:DataList id="DataList1" runat="server" Width="414px" Height="141px" HorizontalAlign="Center"><ItemTemplate>
公告标题: <asp:Label ID="Label1" runat="server" Text=<%# DataBinder.Eval
(Container.DataItem, "notetittle")%>></asp:Label><br />
<br />
公告内容: <asp:Label ID="Label2" runat="server" Text=<%# DataBinder.Eval
(Container.DataItem, "notecontent")%>></asp:Label><br />
公告时间: <asp:Label ID="Label3" runat="server" Text=<%# DataBinder.Eval
(Container.DataItem, "notetime")%>></asp:Label><br />
<br />
公告发布人: <asp:Label ID="Label4" runat="server" Text=<%# DataBinder.Eval
(Container.DataItem, "noteissuer")%>></asp:Label>
</ItemTemplate>
</asp:DataList>
后台代码:myconn.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["sqlconn"];
myda = new SqlDataAdapter("select notetittle,notecontent,notetime,noteissuer from TT_Content
", myconn);
myda.Fill(myds, "note");
DataList1.DataSource = myds.Tables["note"];
DataList1.DataBind();
可以这样设想吗:你在一个页面上放好多个label控件,当你单击添加公告的时候,让你的下个label控件为显示,其余的不显示,然后你在忘label里面添加内容,当你单击确定的时候,把这个label的text插入到后台数据库中,当你显示的时候,页面里的label控件就会显示你的公告内容了.至于数据库吧,你可以设个id为主键,设为自动编号,一个note为你的内容.
我也没有做过这个东西,这只是代表了我自己的想法.能实现与否还得来实践下
朋友,你实现了吗?绑定数据我把弄好了,你看不看?
使用DataList,进行编辑模版.具体前台代码
<asp:DataList id="DataList1" runat="server" Width="414px" Height="141px" HorizontalAlign="Center"><ItemTemplate>
公告标题: <asp:Label ID="Label1" runat="server" Text=<%# DataBinder.Eval
(Container.DataItem, "notetittle")%>></asp:Label><br />
<br />
公告内容: <asp:Label ID="Label2" runat="server" Text=<%# DataBinder.Eval
(Container.DataItem, "notecontent")%>></asp:Label><br />
公告时间: <asp:Label ID="Label3" runat="server" Text=<%# DataBinder.Eval
(Container.DataItem, "notetime")%>></asp:Label><br />
<br />
公告发布人: <asp:Label ID="Label4" runat="server" Text=<%# DataBinder.Eval
(Container.DataItem, "noteissuer")%>></asp:Label>
</ItemTemplate>
</asp:DataList>
后台代码:myconn.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["sqlconn"];
myda = new SqlDataAdapter("select notetittle,notecontent,notetime,noteissuer from TT_Content
", myconn);
myda.Fill(myds, "note");
DataList1.DataSource = myds.Tables["note"];
DataList1.DataBind();