Hey,
I'm trying to use a RadGrid with inline editing via a custom template. The scenario is complicated by the use of a special selection control we've built which pops up in a modal popup and allows the user to select the value for one of the fields that the RadGrid displays. When the user selects a value, the control fires its ItemSelected event with event args that pass the data we need to display and save to the database. The code-behind handles this event by updating the text of the LinkButton that serves as both the displayed text and as the modal popup trigger, as well as updating the text of a css-hidden textbox that holds the actual value to save to the database.
This worked great when we were using a regular ASP.NET GridView, but we needed to show hierarchical data in nested DetailsTable rows below it, so we invested in the RadGrid for this purpose. Now, however, I can't seem to access the controls that need to be updated inside the Edit FormTemplate, and it seems like every single example anywhere on the net is only accessing it through the event args of events raised by the RadGrid itself.
Let me post some trimmed-down code so you can follow what I'm doing.
Here's the markup in question inside the RadGrid MasterTableView EditFormSettings:
The SelectGLAccountLinkButton_Command event handler triggers a modal popup with the selection control inside it.
When the user selects the item they desire, the modal popup closes and fires this event handler to update the display and underlying data, which was working with a standard ASP.NET GridView as written below:
The problem being that, from the above event handler (which is in the code-behind of the same page as the RadGrid) I can't find a way to access the controls in question like I would need to do above.
I've set a breakpoint inside that method and wandered all through the intellisense on RadGrid1., but I suspect I'm just not looking in the "right" place.
Can anyone give me a hand? Or is accessing the edit FormTemplate only possible inside a telerik event handler, in which case we'll have to abandon RadGrid and go some other route?
Thanks!
I'm trying to use a RadGrid with inline editing via a custom template. The scenario is complicated by the use of a special selection control we've built which pops up in a modal popup and allows the user to select the value for one of the fields that the RadGrid displays. When the user selects a value, the control fires its ItemSelected event with event args that pass the data we need to display and save to the database. The code-behind handles this event by updating the text of the LinkButton that serves as both the displayed text and as the modal popup trigger, as well as updating the text of a css-hidden textbox that holds the actual value to save to the database.
This worked great when we were using a regular ASP.NET GridView, but we needed to show hierarchical data in nested DetailsTable rows below it, so we invested in the RadGrid for this purpose. Now, however, I can't seem to access the controls that need to be updated inside the Edit FormTemplate, and it seems like every single example anywhere on the net is only accessing it through the event args of events raised by the RadGrid itself.
Let me post some trimmed-down code so you can follow what I'm doing.
Here's the markup in question inside the RadGrid MasterTableView EditFormSettings:
<FormTemplate> |
<asp:LinkButton ID="selectGLAccountLinkButton" runat="server" |
CommandArgument='<%# Eval("GLAccountID") %>' |
OnCommand="SelectGLAccountLinkButton_Command"> |
<%# Eval("GLAccount.GLAccountNumber")%> |
</asp:LinkButton> |
<asp:TextBox ID="selectedGLAccountTextBox" runat="server" CssClass="hideButton" Text='<%# Eval("GLAccountID") %>'></asp:TextBox> |
</FormTemplate> |
The SelectGLAccountLinkButton_Command event handler triggers a modal popup with the selection control inside it.
When the user selects the item they desire, the modal popup closes and fires this event handler to update the display and underlying data, which was working with a standard ASP.NET GridView as written below:
protected void GLAccount_ItemSelected(object sender, ItemSelectionPage.ItemSelectedEventArgs e) |
{ |
GridViewRow row = projectGridView.Rows[projectGridView.EditIndex]; |
((LinkButton)row.FindControl("selectGLAccountLinkButton")).Text = e.DisplayText; |
((LinkButton)row.FindControl("selectGLAccountLinkButton")).CommandArgument = e.ItemID.ToString(); |
((TextBox)row.FindControl("selectedGLAccountTextBox")).Text = e.ItemID.ToString(); |
} |
The problem being that, from the above event handler (which is in the code-behind of the same page as the RadGrid) I can't find a way to access the controls in question like I would need to do above.
I've set a breakpoint inside that method and wandered all through the intellisense on RadGrid1., but I suspect I'm just not looking in the "right" place.
Can anyone give me a hand? Or is accessing the edit FormTemplate only possible inside a telerik event handler, in which case we'll have to abandon RadGrid and go some other route?
Thanks!