1、網頁設計中的公告欄綁定
來占個位置,我最近也要做公告的模塊,具體的我正在想.
可以這樣設想嗎:你在一個頁面上放好多個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();
2、網頁製作 公告欄
<marquee behavior="scroll" onmouseover=this.stop() onmouseout=this.start() width=220 height=120 direction="up">這里是公告內容</marquee>
現在是向上滾動,高度和寬度可以自己調
如果你要加背景在滾動的地方加background=""就可以
3、請問製作網頁的通知公告欄,如何讓標題和通知內容在水平一行顯示。
你把他們都放一個div裡面就可以了不是,中間打個空格。你現在代碼是不是有換行符或者他們不在同一個標簽裡面,中間有嵌套代碼啥的。
4、再網頁設計中如何做滾動的公告欄?
<marquee behavior="scroll" onmouseover=this.stop() onmouseout=this.start() width=220 height=120 direction="up">這里是公告內容</marquee>
高度和寬度可以自己調