ruslan opiu
Top achievements
Rank 1
ruslan opiu
asked on 26 Jan 2010, 06:53 PM
I have a RadTextBox in GridTemplateColumn, which should initiate updateItem() on AutoPostBack or TextChanged.
What is a right way to find containing GriDataItem and initiate updateItem()?
What is a right way to find containing GriDataItem and initiate updateItem()?
6 Answers, 1 is accepted
0
Accepted
Hello Ruslan,
You can access the desired item via the NamingContainer property:
Best regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
You can access the desired item via the NamingContainer property:
protected void RadTextBox1_TextChanged(object sender, EventArgs e){ ((sender as RadTextBox).NamingContainer as GridItem).FireCommandEvent("Update", "");}Best regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
ruslan opiu
Top achievements
Rank 1
answered on 26 Jan 2010, 08:24 PM
thanks, that works. is there a client-side to do the same?
0
Princy
Top achievements
Rank 2
answered on 27 Jan 2010, 12:05 PM
Hi Ruslan,
Check out the following document which explains on the fireCommand() client method:
fireCommand
Thanks
Princy.
Check out the following document which explains on the fireCommand() client method:
fireCommand
Thanks
Princy.
0
ruslan opiu
Top achievements
Rank 1
answered on 27 Jan 2010, 06:20 PM
i see:). i did not found in documentation how to find NamingContainer on client side.
0
Hello Ruslan,
It is not that easy to do the same on the client - the problem is to get the item index of the edited item. Try this workaround:
EditItemTemplate
ValueChanged handler + global variable to hold the current index
Initialize the variable on the server
Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
It is not that easy to do the same on the client - the problem is to get the item index of the edited item. Try this workaround:
EditItemTemplate
<EditItemTemplate> <telerik:RadTextBox ID="RadTextBox1" runat="server"> <ClientEvents OnValueChanged="valueChanged" /> </telerik:RadTextBox></EditItemTemplate>ValueChanged handler + global variable to hold the current index
<script type="text/javascript"> var currentItem; function valueChanged(sender, args) { sender.get_parent().fireCommand("Update", currentItem); }</script>Initialize the variable on the server
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e){ if (e.Item.IsInEditMode) { RadTextBox rtb = (e.Item as GridEditableItem).FindControl("RadTextBox1") as RadTextBox; rtb.Attributes["onblur"] = String.Format("currentItem = {0};", e.Item.ItemIndex); }}Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
ruslan opiu
Top achievements
Rank 1
answered on 29 Jan 2010, 07:11 AM
thanks, great:)