asp.net刷新当前页面有哪些方法 <form name="123.asp"> onclick="javascript:123.submit()" 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 服务器端用Response.Redirect.但是最好用js.<input type="button" value="Reload Page" onClick="window.location.href=window.location.href"> 你就把跳转到本页面的代码封装成一个公共方法 以后用的时候只要调用就可以了 不需要传参数你的是按钮那你就把response.write("<script>location=location</script>");<script>可以写跳转本页面的方法</script> 在vs2008 asp.net中没有一个变量是表示当前页面的么? 有 用 location.href=<%=Reqest.RawUrl%> updatepanel是实现无刷新页面的方法.你VS工具栏有 protected void Page_Load(object sender, EventArgs e) { bind(); } private void bind() { this.Repeater1.DataSource = TestManager.getAll(); this.Repeater1.DataSourceID = ""; this.Repeater1.DataBind(); } protected void LinkButton1_Click(object sender, EventArgs e) { string name = this.TextBox1.Text.Trim(); DB_Test dbt = new DB_Test(); dbt.Uname = name; int i = TestManager.Add(dbt); if (i > 0) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "", "alert('成功')", true); //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('成功');", true); bind(); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "", "alert('失败')", true); //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('失败');", true); } }form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <ul> <li>编号:<%#Eval("id")%></li> <li>姓名:<%#Eval("uname")%></li> <li> <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument='<%#Eval("id")%>' onclick="LinkButton2_Click">删除</asp:LinkButton></li> </ul> </ItemTemplate> </asp:Repeater> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">添加</asp:LinkButton> </ContentTemplate> </asp:UpdatePanel> </div> </form>这是无刷新页面.在按钮里绑定的代码.您看下。很好理解 在后台你也可以用Response.Redirect(URL) Response.Redirect(Request.Url.ToString());Response.AddHeader("Refresh", "0");Response.Write("<script>window.location.reload();</script>"); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>window.location=window.location;</script>"); web项目打包,windows2003 分页问题!!!请大虾帮帮忙! 求具体做法?谢谢 為什么不能直接打開,可以下載,我怎么看到的回答都是 "頂呀",散了有500分了 上传的htm文件怎么保存到数据的ntext字段中? js分条件显示内容,调试始终成功! 位置 基于角色的安全认证系统设计 求个小问题(什么样的人是数据库学的好的人?学数据库要较好的掌握哪些方面呢?) 一个问题,求助 ajax中传参,在一般处理程序中接收问题 vs2003为什么新建网站时不能改路径
你的是按钮那你就把response.write("<script>location=location</script>");
<script>可以写跳转本页面的方法</script>
protected void Page_Load(object sender, EventArgs e)
{
bind(); }
private void bind()
{
this.Repeater1.DataSource = TestManager.getAll();
this.Repeater1.DataSourceID = "";
this.Repeater1.DataBind();
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
string name = this.TextBox1.Text.Trim();
DB_Test dbt = new DB_Test();
dbt.Uname = name;
int i = TestManager.Add(dbt);
if (i > 0)
{
ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "", "alert('成功')", true);
//Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('成功');", true);
bind();
}
else
{
ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "", "alert('失败')", true);
//Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('失败');", true);
}
}form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<ul>
<li>编号:<%#Eval("id")%></li>
<li>姓名:<%#Eval("uname")%></li>
<li>
<asp:LinkButton ID="LinkButton2" runat="server" CommandArgument='<%#Eval("id")%>' onclick="LinkButton2_Click">删除</asp:LinkButton></li>
</ul>
</ItemTemplate>
</asp:Repeater>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">添加</asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>这是无刷新页面.在按钮里绑定的代码.您看下。很好理解