当前位置:首页 > 网络编程 > WEB编程 > ASP.net >  利用Ajax技术写一个迷你留言板WEB控件 2

 利用Ajax技术写一个迷你留言板WEB控件 2

点击次数:35 次 发布日期:2008-11-26 11:05:42 作者:源代码网
源代码网推荐      private void listupdate()
源代码网推荐   {
源代码网推荐   OleDbDataAdapter da = new OleDbDataAdapter("select top 5 * from guest order by id desc", conn);
源代码网推荐   DataSet ds = new DataSet();
源代码网推荐   da.Fill(ds);
源代码网推荐   DataList1.DataSource = ds;
源代码网推荐   DataList1.DataBind();
源代码网推荐   }
源代码网推荐   protected void Page_Load(object sender, EventArgs e)
源代码网推荐   {
源代码网推荐   conn.Open();
源代码网推荐   listupdate();
源代码网推荐   }
源代码网推荐  </script>
源代码网推荐  <style>
源代码网推荐  .Gtitle
源代码网推荐  {
源代码网推荐  width:200px;
源代码网推荐  background-color:#464646;
源代码网推荐  color:#FFFFFF;
源代码网推荐  font-size:14px;
源代码网推荐  height:20px;
源代码网推荐  padding: 3px 0 0 10px;
源代码网推荐  font-weight:bold;
源代码网推荐  border-style:solid;
源代码网推荐  border-top-width:1px;
源代码网推荐  border-bottom-width:0px;
源代码网推荐  border-left-width:1px;
源代码网推荐  border-right-width:1px;
源代码网推荐  border-color:#BBBBBB;
源代码网推荐  }
源代码网推荐  .Gbody
源代码网推荐  {
源代码网推荐  width:200px;
源代码网推荐  border-style:solid;
源代码网推荐  border-top-width:0px;
源代码网推荐  border-bottom-width:0px;
源代码网推荐  border-left-width:1px;
源代码网推荐  border-right-width:1px;
源代码网推荐  border-color:#BBBBBB;
源代码网推荐  padding:3px 5px 3px 5px;
源代码网推荐  }
源代码网推荐  .Gend
源代码网推荐  {
源代码网推荐  width:200px;
源代码网推荐  border-style:solid;
源代码网推荐  border-top-width:0px;
源代码网推荐  border-bottom-width:1px;
源代码网推荐  border-left-width:1px;
源代码网推荐  border-right-width:1px;
源代码网推荐  border-color:#BBBBBB;
源代码网推荐  padding:3px 5px 3px 5px;
源代码网推荐  }
源代码网推荐  .Gname
源代码网推荐  {
源代码网推荐  width:190px;
源代码网推荐   font-size:12px;
源代码网推荐   color:blue;
源代码网推荐  }
源代码网推荐  .Gcontent
源代码网推荐  {
源代码网推荐  width:190px;
源代码网推荐  word-break:break-all;
源代码网推荐  color:#444444;
源代码网推荐  font-size:12px;
源代码网推荐  padding: 3px 0 3px 0;
源代码网推荐  border-style:dotted;
源代码网推荐  border-top-width:0px;
源代码网推荐  border-bottom-width:1px;
源代码网推荐  border-left-width:0px;
源代码网推荐  border-right-width:0px;
源代码网推荐  border-color:#BBBBBB;
源代码网推荐  }
源代码网推荐  </style>
源代码网推荐  
源代码网推荐  <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
源代码网推荐  </asp:ScriptManagerProxy>
源代码网推荐  <asp:UpdatePanel ID="UpdatePanel1" runat="server">
源代码网推荐   <ContentTemplate>
源代码网推荐   <div class="Gtitle"><asp:Label ID="Label1" runat="server" Text="留言板"></asp:Label></div>
源代码网推荐   <div class="Gbody"><asp:DataList ID="DataList1" runat="server" >
源代码网推荐   <ItemTemplate>
源代码网推荐   <div class="Gname"><%# DataBinder.Eval(Container.DataItem, "name") %> 说:</div><div class="Gcontent"><%# DataBinder.Eval(Container.DataItem, "content") %></div>
源代码网推荐   </ItemTemplate>
源代码网推荐   </asp:DataList></div>
源代码网推荐   <div class="Gend"><asp:TextBox ID="TextBox1" runat="server" Width="150px" />
源代码网推荐   <asp:Button ID="Button1" runat="server" Text="留言" OnClick="Button1_Click" /></div>
源代码网推荐   </ContentTemplate>
源代码网推荐  </asp:UpdatePanel>
源代码网推荐  
源代码网推荐  
源代码网推荐  这样就可以完成这个控件了,然后就是在页面上调用这个控件了,调用这个控件的页面必须有一个ScriptManager控件才能使用。
源代码网推荐  
源代码网推荐  此控件修改一下可以做为文章评论控件用,加上个:更多。。。,按文章ID显示评论就可以用了。
源代码网推荐  
源代码网推荐  初学Ajax,做一应用,做为学习日志。还望多指教。
源代码网推荐    做人要厚道,请注明转自酷网动力(www.ASPCOOL.COM)。
源代码网推荐


源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华