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

Fire Grid Command Event Externally

1 Answer 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 06 Jul 2009, 03:23 PM

Hello,

I have a RadGrid where I want to initiate an "InitInsert" command to open a Web User Control for a grid insert.
The command event needs to fire from a button outsite the grid.
I have been able to do this with the following code associated with the button's "Click" event.
But, this only works when there are dataitems assoicated with the grid.
How do I use the "FireCommandEvent" when there are no Grid Data Items? Or, is there another work around?

Thanks,
Jon

protected void btnAddNew_Click(object sender, EventArgs e)   
{  
GridDataItem gridItem = rgStoreManagement.Items[0];   
gridItem.FireCommandEvent(RadGrid.InitInsertCommandName, String.Empty);  
}  
 
 

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 07 Jul 2009, 04:32 AM
Hi Jon,

Try the following code snippet.

C#:
 
protected void Button2_Click(object sender, EventArgs e) 
    rgStoreManagement.MasterTableView.IsItemInserted = true
    rgStoreManagement.Rebind();  

-Shinu.
Tags
Grid
Asked by
Jon
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or