Asp.Net : Redirect to another page from usercontrol in update panel

prowler9

New Member
i have an update panel with a menu in it.
i wanna to redirect to another page when the user click on the print button in grid view in user control (in my update panel)
i used these codes,but they didn't work for me: \[code\]1 : Response.Redirect("PrintTicket.aspx");2 : Response.Write("<script>window.open('PrintTicket.aspx','_parent');</script>");3 : Page.Response.Redirect("PrintTicket.aspx", true);4 : Page.ClientScript.RegisterStartupScript(typeof(Page), "ClientScript", "<script language='javascript' type='text/javascript'>window.location.replace('http://vinaticket.ir /PrintTicket.aspx');</script> ", false);5 : ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect","window.location='" + Request.ApplicationPath + "PrintTicket.aspx';", true);6 : Page.ClientScript.RegisterStartupScript(typeof(Page), "ClientScript", "<script language='javascript' type='text/javascript'> postRefId('" + Session["TicketID"].ToString() + "');</script> ", false);7 : ScriptManager.RegisterStartupScript(this, this.GetType(), "redir", "document.location = 'PrintTicket.aspx'", true);\[/code\]this is my code : \[code\]<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional"><ContentTemplate>----menu .... with exit button <asp:PlaceHolder ID="PlaceHolder1" runat="server" ViewStateMode="Enabled"> </asp:PlaceHolder></ContentTemplate><Triggers> <asp:PostBackTrigger ControlID="exit" /></Triggers></asp:UpdatePanel>//code behind to loade user controlprivate string LastLoadedControl{ get { return ViewState["LastLoaded"] as string; } set { ViewState["LastLoaded"] = value; }}private void LoadUserControl(){ try { string controlPath = LastLoadedControl; if (!string.IsNullOrEmpty(controlPath)) { PlaceHolder1.Controls.Clear(); UserControl uc = (UserControl)LoadControl(controlPath); PlaceHolder1.Controls.Add(uc); } } catch (Exception ex) { }}\[/code\]my menu button :
protected void your_ticket_Click(object sender, EventArgs e) { try { Session["pg"] = "Z_ViewTicket.ascx"; setPath(); } catch (Exception ex) { } }\[code\] and set path method():protected void setPath(){ try { string controlPath = string.Empty; controlPath = BASE_PATH + Session["pg"].ToString(); LastLoadedControl = controlPath; LoadUserControl(); } catch (Exception ex) { }}\[/code\]what should i do now?
 
Back
Top