I have a RadGrid that has within it a RadTabStrip (which is within the FormTemplate of the EditFormSettings). For each tab, I have a user control that contains the fields I want the user to interact with. These user controls have (Microsoft) ListBox and DropDownList controls and bind themselves to their own data to populate each of these controls with the possible values and this all works fine. The RadGrid properly populates the textbox values of the tab when the user clicks Edit (GridEditColumn) using values from the database. However, I need to update the RadTab's user control DropDownList/ListBox with the selections from the database, but how do I access the User Control (or these child controls) within the RadTab? I can't seem to catch any of the RadTabStrip events to do this (I'm guessing that these aren't being bubbled up to the grid's level?) and I haven't been able to use FindControl to locate the friendly control names (I know I could use ugly names like ctl00_ctl14_ctl00, but this is way too brittle :) ).
The user control within each RadTab does all it's databinding events first, so all the controls are loaded with data. I'm thinking the DataBound event for the Grid is the right place to start, since this is the last visible event I've found after clicking Edit (before the RadTab is rendered -- other than perhaps PreRender, but then I have to walk the UI control tree).
Am I nesting things too deep here? Is there any easier/better way to approach this? Basically, I'm trying to have a RadTabStrip for editing a grid row's (detailed) data (not just the fields I show in the row). I don't think the updating will be an issue (updating already works for propagating textbox/checkbox values to the database), since I have access to the control tree through the ItemCommand event handler for the Update event.
Here's the markup snippet:
Any and all help appreciated!
Jon
The user control within each RadTab does all it's databinding events first, so all the controls are loaded with data. I'm thinking the DataBound event for the Grid is the right place to start, since this is the last visible event I've found after clicking Edit (before the RadTab is rendered -- other than perhaps PreRender, but then I have to walk the UI control tree).
Am I nesting things too deep here? Is there any easier/better way to approach this? Basically, I'm trying to have a RadTabStrip for editing a grid row's (detailed) data (not just the fields I show in the row). I don't think the updating will be an issue (updating already works for propagating textbox/checkbox values to the database), since I have access to the control tree through the ItemCommand event handler for the Update event.
Here's the markup snippet:
<%@ Register Src="~/Views/UserControls/AccountInfo.ascx" TagName="AccountInfo"
TagPrefix="dd" %>
<%@ Register Src="~/Views/UserControls/AddressInfo.ascx" TagName="AddressInfo" TagPrefix="dd" %>
<%@ Register Src="~/Views/UserControls/RoleInfo.ascx" TagName="RoleInfo" TagPrefix="dd" %>
<
telerik:RadGrid
ID
=
"GridUser"
AllowSorting
=
"True"
PageSize
=
"10"
AutoGenerateColumns
=
"false"
ItemStyle-Font-Size
=
"11px"
AlternatingItemStyle-Font-Size
=
"11px"
AllowPaging
=
"True"
AllowFilteringByColumn
=
"true"
PagerStyle-AlwaysVisible
=
"true"
AllowMultiRowSelection
=
"False"
runat
=
"server"
Width
=
"700px"
Skin
=
"Office2007"
HeaderStyle-CssClass
=
"RadGridHeader"
DataSourceID
=
"MasterDataSource"
ShowGroupPanel
=
"true"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
>
<
MasterTableView
Name
=
"GridUserView"
DataSourceID
=
"MasterDataSource"
DataKeyNames
=
"ID"
Width
=
"100%"
Summary
=
"RadGrid table"
CommandItemDisplay
=
"Top"
>
<
Columns
>
<
telerik:GridEditCommandColumn
UniqueName
=
"GridEditAccountInfo"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridBoundColumn
DataField
=
"FirstName"
AllowSorting
=
"true"
Visible
=
"true"
HeaderText
=
"First Name"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"LastName"
AllowSorting
=
"true"
Visible
=
"true"
HeaderText
=
"Last Name"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"UserName"
AllowSorting
=
"true"
Visible
=
"true"
HeaderText
=
"User Name"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
EditFormType
=
"Template"
>
<
FormTemplate
>
<
telerik:RadTabStrip
ID
=
"userTabStrip"
runat
=
"server"
SelectedIndex
=
"0"
MultiPageID
=
"UserMultiPage1"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Account Info"
PageViewID
=
"AccountInfoPageView"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Address Info"
PageViewID
=
"AddressInfoPageView"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Roles"
PageViewID
=
"RolesPageView"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
runat
=
"server"
ID
=
"UserMultiPage1"
SelectedIndex
=
"0"
RenderSelectedPageOnly
=
"false"
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"AccountInfoPageView"
>
<
asp:Label
ID
=
"lblUserName"
Font-Bold
=
"true"
Font-Italic
=
"true"
Text='<%# Eval("Username") %>'
Visible="false" runat="server" />
<
dd:AccountInfo
runat
=
"server"
ID
=
"EditAccountInfo"
/>
</
telerik:RadPageView
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"AddressInfoPageView"
>
<
dd:AddressInfo
runat
=
"server"
ID
=
"EditAddressInfo"
/>
</
telerik:RadPageView
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"RolesPageView"
>
<
dd:RoleInfo
runat
=
"server"
ID
=
"EditRoleInfo"
/>
</
telerik:RadPageView
>
</
telerik:RadMultiPage
>
<
br
/>
<
asp:Button
ID
=
"btnUpdate"
runat
=
"server"
Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update")%>' TabIndex="40" CausesValidation="False" />
<
asp:Button
ID
=
"btnCancel"
runat
=
"server"
Text
=
"Cancel"
TabIndex
=
"41"
/>
</
FormTemplate
>
</
EditFormSettings
>
</
MasterTableView
>
<
HeaderStyle
CssClass
=
"RadGridHeader"
></
HeaderStyle
>
<
ClientSettings
EnableRowHoverStyle
=
"true"
>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
SelectedItemStyle
BorderColor
=
"Yellow"
BorderWidth
=
"2px"
BackColor
=
"Yellow"
Font-Bold
=
"true"
/>
<
AlternatingItemStyle
Font-Size
=
"11px"
></
AlternatingItemStyle
>
<
ItemStyle
Font-Size
=
"11px"
></
ItemStyle
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
></
PagerStyle
>
</
telerik:RadGrid
>
Any and all help appreciated!
Jon