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

CommandItem "Add new record" redirect to another page?

4 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tom Scheffer
Top achievements
Rank 1
Tom Scheffer asked on 05 Sep 2008, 08:45 PM
I know there has to be an easy way to do this - I just can't seem to find it.

On my RadGrid I am using the CommandItemDisplay at the bottom to enable access to the "Add new record" functionality.

How can I intercept this event in order to redirect it to another page where the data entry will be done? I do not want to do it "in form"

Thanks.

4 Answers, 1 is accepted

Sort by
0
Vladimir
Top achievements
Rank 1
answered on 07 Sep 2008, 09:15 AM
You can use ItemCommand with "InitInsert" and/or "PerformInsert" command names.
0
Accepted
Shinu
Top achievements
Rank 1
answered on 08 Sep 2008, 04:55 AM
Hi Tom,

Try the following code snippet to achieve the desired scenario.

CS:
protected void RadGrid2_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName =="InitInsert") 
        { 
            Response.Redirect("~/Default2.aspx"); 
        } 
    } 


Regards
Shinu.
0
Tom Scheffer
Top achievements
Rank 1
answered on 08 Sep 2008, 02:03 PM
Thank for your reply -- Unfortunately, I tried that, but it does not seem to work - it displays the "in form" edit. Is there anything I have to set in the Grid Properties besides  

<MasterTableView CommandItemDisplay="Top"

 The code --

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)

{

if (e.CommandName == "InitInsert"){Response.Redirect("~/BaselineDetail.aspx");}}

Never gets run.

Thanks again.

0
Tom Scheffer
Top achievements
Rank 1
answered on 08 Sep 2008, 02:18 PM
Ahhh, nevermind. I needed to set the OnItemCommand
Tags
Grid
Asked by
Tom Scheffer
Top achievements
Rank 1
Answers by
Vladimir
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Tom Scheffer
Top achievements
Rank 1
Share this question
or