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

Programmatically fire up add new from rad grid (InitInsert)

4 Answers 586 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mass Media Developer
Top achievements
Rank 1
Mass Media Developer asked on 06 May 2008, 07:05 AM
I’m using Telerik Controls for ASP.NET AJAX.
Basically I want to programatically (in C#) click on the “Add New” button
from a Rad Grid. So on page load I want the "add new window" to
be visible rather than the user has to click on the button.
I think this would simply be just calling a function but I just can’t
figure it out.
Can someone help please?
The CommandName for this action is InitInsert.

4 Answers, 1 is accepted

Sort by
0
Mass Media Developer
Top achievements
Rank 1
answered on 06 May 2008, 07:23 AM
I figured it out.

    protected override void OnPreRender(EventArgs e)
    {
        myGrid.MasterTableView.InsertItem();
        base.OnPreRender(e);
    }
0
Shinu
Top achievements
Rank 2
answered on 06 May 2008, 07:31 AM
Hi  Nick,

You can also try the following code snippet to achieve the desired scenario.

CS:
protected void Page_Load(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.IsItemInserted = true
    } 


Thanks
Shinu.
0
Wilfred Maynham
Top achievements
Rank 1
answered on 22 Mar 2012, 04:27 PM
How about overiding the AddnewButton functionality.

I need to open a new tab on the browser and cancel any other functionality embedded in the grid.

How can I achieve this ?

Thanks
0
Jayesh Goyani
Top achievements
Rank 2
answered on 22 Mar 2012, 06:30 PM
Hello,

You can cancel embedded command by below code snippet.

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.InitInsertCommandName)
            {
                // you cancel any embedded command by below code
                e.Canceled = true;
            }
        }


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Mass Media Developer
Top achievements
Rank 1
Answers by
Mass Media Developer
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Wilfred Maynham
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Share this question
or