0

I have a webform with a "clear all fields" button, but it's not working properly. When I click the button on the rendered page, it directs me to another page on the local server, but not the one I have listed here.

protected void btn_Clear_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/ContentRequest/PR_Event.aspx", true);
    }

I'm not sure what I can do...

4

1 回答 1

3

您可以简单地使用Request.RawUrl重定向回当前页面。

Response.Redirect(Request.RawUrl, true)

但是,如果您只想清除字段,则可能需要在客户端使用 jQuery 或 javascript 以避免往返服务器。

于 2013-05-09T23:20:55.517 回答