or
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); |
| } |
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridEditableItem && e.Item.IsInEditMode) //fire for both edit and insert |
| { |
| GridEditableItem eeditItem = e.Item as GridEditableItem; |
| GridEditManager editMgr = editItem.EditManager; |
| GridDropDownListColumnEditor agencyEditor = editMgr.GetColumnEditor("AgencyDDL") as GridDropDownListColumnEditor; |
| string s = agencyEditor.SelectedValue; //this will return "" |
| agencyEditor.DataSource = getAgency(); //call data layer function to get the agency list |
| agencyEditor.DataBind(); |
| } |