Hi. Is there any way that I can get a LinkButton that's on the same page as a Grid to generate an 'InitInsert' command so that a new grid row can be entered by a user? For UI design reasons, I'm not able to include the LinkButton within a Grid CommandItemTemplate - it needs to be a separate LinkButton that's located in the page sidebar.
Regards.
Regards.
4 Answers, 1 is accepted
0
Hello Ian,
You could put the RadGrid in insert mode using the InitInsert method:
Regards,
Daniel
the Telerik team
You could put the RadGrid in insert mode using the InitInsert method:
protected
void
Button1_Click1(
object
sender, EventArgs e)
{
RadGrid1.MasterTableView.InsertItem();
}
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Ian
Top achievements
Rank 1
answered on 28 Jul 2010, 09:43 AM
Hi Daniel,
That partially worked although using your solution didn't seem to fire the RadGrid1_ItemCommand event so the code to hide the EditColumn wasn't executed. I got around this by including it in the LinkButton click handler:
{
RadGrid1.MasterTableView.InsertItem();
GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");
editColumn.Visible = false;
}
Is that the best solution or is there a way to actually fire the ItemCommand event from an external control?
Regards, Ian
That partially worked although using your solution didn't seem to fire the RadGrid1_ItemCommand event so the code to hide the EditColumn wasn't executed. I got around this by including it in the LinkButton click handler:
protected
void
Button1_Click1(
object
sender, EventArgs e)
RadGrid1.MasterTableView.InsertItem();
GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");
editColumn.Visible = false;
}
Is that the best solution or is there a way to actually fire the ItemCommand event from an external control?
Regards, Ian
0
Hello Ian,
It is also possible to fire the InitInsert command manually:
Regards,
Daniel
the Telerik team
It is also possible to fire the InitInsert command manually:
RadGrid1.MasterTableView.Items[0].FireCommandEvent(
"InitInsert"
,
""
);
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ian
Top achievements
Rank 1
answered on 05 Aug 2010, 06:30 PM
Daniel,
Hi. That works perfectly. Thanks.
A suggestion: It might be worth adding a link in the 'Getting familiar with server-side API' section of the Grid documentation - this discusses all of the properties and events for the Grid but nothing about its methods. I never thought to look in the 'Control lifecycle' section of the documentation where I now realise the FireCommandEvent is described!
Thanks again, Ian
Hi. That works perfectly. Thanks.
A suggestion: It might be worth adding a link in the 'Getting familiar with server-side API' section of the Grid documentation - this discusses all of the properties and events for the Grid but nothing about its methods. I never thought to look in the 'Control lifecycle' section of the documentation where I now realise the FireCommandEvent is described!
Thanks again, Ian