asp.net 用了gridview 控件想点击数字分页自动刷新(不想点按钮刷新!)删除操作的代码与提醒 解决重谢!
protectedvoidButton1_Click(objectsender,EventArgse){stringsql=null;sql="select*fromde...
protected void Button1_Click(object sender, EventArgs e)
{
string sql = null;
sql = "select * from denglu ";
DataTable DT = DBM.GetDT(sql);
this.GridView1.DataSource = DT;
this.GridView1.DataBind();
} 展开
{
string sql = null;
sql = "select * from denglu ";
DataTable DT = DBM.GetDT(sql);
this.GridView1.DataSource = DT;
this.GridView1.DataBind();
} 展开
2个回答
展开全部
如果你一定要用GridView,你可以配合AspAjaxControl(安装ASPAJAXExtSetup.msi);拖入到aspx页面ScriptManager和UpdatePanel,主要实现UpdatePanel内的内容局部刷新。参见代码:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Always" RenderMode="Block">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True">
<Columns>
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</form>
Ajax控件用法参见网上,推荐一个:http://www.cnblogs.com/shangxia/articles/2281782.html
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Always" RenderMode="Block">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True">
<Columns>
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</form>
Ajax控件用法参见网上,推荐一个:http://www.cnblogs.com/shangxia/articles/2281782.html
追问
其实我想说,能不能具体点,就是那个删除操作的代码,加一个删除前的提醒。如果可以的话,谢谢了,财富值我会给的!
追答
删除前添加一个提醒相对于局部刷新的难易程度相差有很多倍,我以为你的遇到难点是局部刷新,你能先把这些基础知识搞清楚了再来问问题好吗?
顺便回答你的删除前提醒:
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询