日期:2014-05-16  浏览次数:20686 次

jQuery 如何异步无刷新,求代码

这是aspx代码

<div id="divTe" runat="server">
  <asp:GridView ID="GridViewList" runat="server" DataKeyNames="FID" 
  AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" 
  BorderStyle="None" BorderWidth="1px" CellPadding="3" 
  onrowediting="GridViewList_RowEditing" 
  onrowdatabound="GridViewList_RowDataBound">
  <FooterStyle BackColor="White" ForeColor="#000066" />
  <RowStyle ForeColor="#000066" />
  <Columns>
  <asp:BoundField HeaderText="ID" />
  <asp:BoundField DataField="FUser" HeaderText="姓名"/>
  <asp:BoundField DataField="FPwd" HeaderText="密码"/>
  <asp:CommandField EditText="查看" HeaderText="查看" ShowEditButton="True" />
  </Columns>
  <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
  <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
  <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
  </asp:GridView>
  用户名:<asp:TextBox ID="txt_User" runat="server"></asp:TextBox>
  密码:<asp:TextBox ID="txt_Pwd" runat="server"></asp:TextBox>
  <asp:Button ID="btnSave" runat="server" Text="保存"onclick="btnSave_Click" />  
  </div>

  这就是所以代码,现在我想用jquery中ajax技术现实无刷新,点击GridView中查看的时候把数据库的 信息显示到用户名和密码的文本框中,要无刷新,实现是整个页面都刷新了,求完整的代码!!!
 

------解决方案--------------------
个人建议如果用jquery做的刷上面的绑定gridview也最好用jquery去自己拼table显示出来
------解决方案--------------------
写错了,

C# code

protected void Page_Load(object sender, EventArgs e)
        {
 //这里是你要接收的值
page();
}



public void page()
        {
          DataGrid dg = new DataGrid();
            //定义控件属性
            dg.AllowPaging = false;
            dg.ShowFooter = false;
            dg.AutoGenerateColumns = false;
            dg.HeaderStyle.CssClass = "gr";
          //定义列
            BoundColumn bc;
            bc = new BoundColumn();
            bc.HeaderText = "档案编号";
            bc.ItemStyle.Width = Unit.Pixel(140);
            bc.DataField = "档案编号";

            dg.Columns.Add(bc);

            BoundColumn Name;
            Name = new BoundColumn();
            Name.HeaderText = "姓名";
            Name.ItemStyle.Width = Unit.Pixel(80);
            Name.DataField = "姓名";
            dg.Columns.Add(Name);
//先绑定数据到dg,绑定就不写了

Response.Write(this.GetStringByControl(dg)};
Response.end();
}



  public string GetStringByControl(System.Web.UI.Control c)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            System.IO.StringWriter writer = new System.IO.StringWriter(sb);
            System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(writer);
            c.RenderControl(htw);
            ret