This is a migrated thread and some comments may be shown as answers.

Radbutton CommandArgument Open New Tab

1 Answer 520 Views
Button
This is a migrated thread and some comments may be shown as answers.
Mohammed
Top achievements
Rank 1
Mohammed asked on 25 May 2016, 09:37 AM

Hi,

I have a radbutton which when pressed updates some profile variables and then redirects to another page. What I am trying to achieve is to have a new tab open when the button is pressed instead of the same tab redirecting to another page.

The radbutton is located within a GridTemplateColumns in a Ragrid if that makes a difference:

<telerik:RadButton ID="SelectC" runat="server" Text="Select" CommandName="Select"                                  CommandArgument='<%#Eval("Rulcode_Child")+","+ Eval("UIO_ID")+","+ Eval("PERSON_CODE")%>' >
</telerik:RadButton>

protected void gridEnrolmentsCourse_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.CommandName == "Select")
    {
        string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' });
        Profile.Rulcode = Convert.ToInt32(commandArgs[0]);
        Profile.UIOID = Convert.ToInt32(commandArgs[1]);
        Profile.Percode = Convert.ToInt32(commandArgs[2]);
 
        if (ViewState["PreviousPage"] != null)
        {
            //Open new tab here somehow
            Response.Redirect(ViewState["PreviousPage"].ToString());
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Mohammed
Top achievements
Rank 1
answered on 26 May 2016, 12:33 PM

Solved.

     string url = ViewState["PreviousPage"].ToString();
     string script = string.Format("window.open('{0}');", url);
     ScriptManager.RegisterStartupScript(Page, Page.GetType(), "newPage" + UniqueID, script, true); 

Tags
Button
Asked by
Mohammed
Top achievements
Rank 1
Answers by
Mohammed
Top achievements
Rank 1
Share this question
or