Hopefully this is an easy one.
I have two related grids on a form and I am using a Master/Detail setup as described in one of the demos and this works great.
Here is my ASPX Code
And here is my VB code
Rather than have the user select a row from the master grid, what I would like to accomplish is to not require the user to select anything in the master grid. I would prefer that when the master grid has data in it, the details grid automatically displays the related data.
Example Data
User Job Role - OfficeAssistant has the related TaskRolls - BasicUsage, StudentView, and ViewAllTables
User Job Role - AttendanceClerk has the related TaskRolls - AbsenceLetters, CurrentClasses, Contacts, Disipline
When a user selects a UserName from a Dropdown list, the master grid would populate with the user's Job Roles and the related grid would automatically populate with the Task Roles for both Job Roles.
Job Roles Task Rolls
------------------ ------------------
OfficeAssistant BasicUsage,
AttendanceClerk StudentView
ViewAllTables
AbsenceLetters
CurrentClasses
Contacts
Disipline
I hope this makes sence.
I have two related grids on a form and I am using a Master/Detail setup as described in one of the demos and this works great.
Here is my ASPX Code
<
telerik:RadGrid
ID
=
"rgd_UserJobRoles"
runat
=
"server"
DataSourceID
=
"sds_UserJobRoles"
GridLines
=
"None"
Width
=
"245px"
>
<
clientsettings
allowkeyboardnavigation
=
"true"
enablepostbackonrowclick
=
"true"
>
<
Selecting
AllowRowSelect
=
"true"
/>
</
clientsettings
>
<
MasterTableView
DataKeyNames
=
"DbRole"
AutoGenerateColumns
=
"False"
DataSourceID
=
"sds_UserJobRoles"
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"DbRole"
HeaderText
=
"Job Roles"
SortExpression
=
"DbRole"
UniqueName
=
"DbRole"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
telerik:RadGrid
ID
=
"rgd_UserTaskRoles"
runat
=
"server"
DataSourceID
=
"sds_UserTaskRoles"
GridLines
=
"None"
Width
=
"245px"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
DataSourceID
=
"sds_UserTaskRoles"
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"UserName"
HeaderText
=
"UserName"
SortExpression
=
"UserName"
UniqueName
=
"UserName"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"RoleName"
HeaderText
=
"Task Roles"
SortExpression
=
"RoleName"
UniqueName
=
"RoleName"
HeaderStyle-HorizontalAlign
=
"Center"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"sds_UserJobRoles"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:AeriesAdmin_ConnectionString %>"
SelectCommand="SELECT [MemberName], [DbName], [DbRole] FROM [Aeries_RoleMembers] WHERE (([DbName] = @DbName) AND ([MemberName] = @UserName)) AND [DbRole] LIKE '%jr_%'">
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"rcb_Database"
Name
=
"DbName"
PropertyName
=
"SelectedValue"
Type
=
"String"
/>
<
asp:ControlParameter
ControlID
=
"rcb_Users"
Name
=
"UserName"
PropertyName
=
"SelectedValue"
Type
=
"String"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"sds_UserTaskRoles"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:AeriesAdmin_ConnectionString %>"
SelectCommand="SELECT DISTINCT [UserName], [RoleName] FROM [vw_AA_Users] WHERE ([UserName] = @DbRole)">
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"rgd_UserJobRoles"
Name
=
"DbRole"
PropertyName
=
"SelectedValue"
Type
=
"String"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
ajaxsettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"rgd_UserJobRoles"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"rgd_UserJobRoles"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"rgd_UserTaskRoles"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"rgd_UserTaskRoles"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"rgd_UserTaskRoles"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
ajaxsettings
>
</
telerik:RadAjaxManager
>
And here is my VB code
Protected
Sub
Page_PreRender(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.PreRender
If
rgd_UserJobRoles.SelectedIndexes.Count = 0
AndAlso
rgd_UserTaskRoles.SelectedIndexes.Count = 0
Then
rgd_UserJobRoles.SelectedIndexes.Add(0)
rgd_UserTaskRoles.SelectedIndexes.Add(0)
End
If
End
Sub
Rather than have the user select a row from the master grid, what I would like to accomplish is to not require the user to select anything in the master grid. I would prefer that when the master grid has data in it, the details grid automatically displays the related data.
Example Data
User Job Role - OfficeAssistant has the related TaskRolls - BasicUsage, StudentView, and ViewAllTables
User Job Role - AttendanceClerk has the related TaskRolls - AbsenceLetters, CurrentClasses, Contacts, Disipline
When a user selects a UserName from a Dropdown list, the master grid would populate with the user's Job Roles and the related grid would automatically populate with the Task Roles for both Job Roles.
Job Roles Task Rolls
------------------ ------------------
OfficeAssistant BasicUsage,
AttendanceClerk StudentView
ViewAllTables
AbsenceLetters
CurrentClasses
Contacts
Disipline
I hope this makes sence.