formview中编辑回发的问题,很奇怪!!!
protected void Page_Load(object sender, EventArgs e){
if (PreviousPage != null && PreviousPage.IsCrossPagePostBack)
{
string mode = Request.QueryString["mode"];
string kind = Request.QueryString["kind"];
string pageIndex = Request.QueryString["pageIndex"];
hidfldPageIndex.Value = pageIndex;
hidfldKind.Value = kind;
switch (mode)
{
case "ReadOnly":
frmviewNews.DefaultMode = FormViewMode.ReadOnly;
break;
case "Edit":
frmviewNews.DefaultMode = FormViewMode.Edit;
string id = Request.QueryString["id"];
break;
case "Insert":
frmviewNews.DefaultMode = FormViewMode.Insert;
break;
}
}
Button btnBack = (Button)frmviewNews.FindControl("btnBack");
btnBack.PostBackUrl = "~/Admin_Folder/News_Manage.aspx?pageindex=" + hidfldPageIndex.Value + "&kind=" + hidfldKind.Value;
Label1.Text = btnBack.PostBackUrl;
}
当我对点击formview的edittemplate里的commandname为update的button以后回发,当按btnBack返回时,不会回到news_manage.aspx,但label1里可以看到地址是正确的,有高手指教吗? --------------------编程问答-------------------- 绕弯了吧?
直接点:
Response.Redirect("~/Admin_Folder/News_Manage.aspx?pageindex= " + hidfldPageIndex.Value + "&kind= " + hidfldKind.Value);--------------------编程问答-------------------- 帮你顶一下 --------------------编程问答-------------------- btnBack.PostBackUrl = "~/Admin_Folder/News_Manage.aspx?pageindex= " + hidfldPageIndex.Value + "&kind= " + hidfldKind.Value;
如果只是为了取hidfldPageIndex.Value和hidfldKind.Value,为什么一定要用postbackurl的方式呢.
补充:.NET技术 , ASP.NET