7 Answers, 1 is accepted
0
Hi Azad,
Here is an example for ItemCreated/UpdateCommand:
if(e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
Control yourControl = e.Item.FindControl("YourControlID");
}
Regards,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Here is an example for ItemCreated/UpdateCommand:
if(e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
Control yourControl = e.Item.FindControl("YourControlID");
}
Regards,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
areen
Top achievements
Rank 1
answered on 25 Feb 2011, 07:03 PM
how do i find the control if i get passed a griddataitem instead from the itemcommand? when i call it from insert, it passes a grideditform item. when i call it from update, it passes a griddataitem.
0
Princy
Top achievements
Rank 2
answered on 28 Feb 2011, 10:30 AM
Hello Areen,
You can set different CommandName for the button in insert/edit form and in ItemCommand event check for the CommandName and access corresponding grid item.
ASPX:
C#:
Thanks,
Princy.
You can set different CommandName for the button in insert/edit form and in ItemCommand event check for the CommandName and access corresponding grid item.
ASPX:
<asp:Button runat="server" ID="btnLoadBalancer" Text="Get Geographic Data"CommandName='<%# (Container is GridEditFormInsertItem) ? "GeoLookupInsert" : "GeoLookupUpdate" %>' />C#:
protected void RadGrid4_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "GeoLookupInsert") { // button in insert form } if (e.CommandName == "GeoLookupUpdate") { // button in edit form } }Thanks,
Princy.
0
areen
Top achievements
Rank 1
answered on 28 Feb 2011, 08:04 PM
Princy,
While you're feedback is much appreciated, it doesn't answer my question. I did as you suggested and the "Update" path is still returning a GridDataItem to me. how do I get to my form controls from the GridDataItem?
Thanks,
Areen
While you're feedback is much appreciated, it doesn't answer my question. I did as you suggested and the "Update" path is still returning a GridDataItem to me. how do I get to my form controls from the GridDataItem?
Thanks,
Areen
0
Scott Marx
Top achievements
Rank 1
answered on 30 Nov 2011, 09:00 PM
bump
1
Shinu
Top achievements
Rank 2
answered on 01 Dec 2011, 05:23 AM
Hello Scott,
Try the following code.
C#:
-Shinu.
Try the following code.
C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e){ if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditableItem item=(GridEditableItem)e.Item; TextBox txt = (TextBox)item.FindControl("TextBox1"); }}-Shinu.
0
Priya
Top achievements
Rank 1
answered on 18 Apr 2013, 05:31 AM
Hi Azad,
thank u....very helpful....
thank u....very helpful....
