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

Prompt After Insert

1 Answer 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 04 Dec 2013, 06:16 PM
Is there a way to add a pop-up after clicking the Insert link-button in the edit mode of a RadGrid that asks a User if they would like to navigate to a different URL and then takes them there if they say yes?  Would that be pure javascript?

Would it be easier to include a separate link button (IE: Insert, Link, Cancel), and have the Link open in a new window/tab?  If so, how would that be accomplished?

Thanks,
Mark

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Dec 2013, 07:13 AM
Hi Mark,

Please try the following code snippet to add the Link along with Insert and Cancel in Insert-mode.

ASPX:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>

C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted)
    {
        GridEditFormInsertItem insert = (GridEditFormInsertItem)e.Item;
        LinkButton linkButton = new LinkButton();
        linkButton.Text = "Link";
        linkButton.CommandName = "Link";
        LinkButton cancel = e.Item.FindControl("CancelButton") as LinkButton; //Accessing the CancelButton
        cancel.Parent.Controls.Add(new LiteralControl(" "));
        cancel.Parent.Controls.Add(linkButton);
    }
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == "Link")
    {
        RadWindow win = new RadWindow();
        win.ID = "window1";
        win.VisibleOnPageLoad = true;
        win.NavigateUrl = "~/RadGrid/Insert.aspx"; // Give url to your required page
        RadWindowManager1.Controls.Add(win);
    }
}

Thanks,
Shinu
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or