I am querying my database and returning a dataset of ClientIdentifier objects to bind to a RadGrid. Each ClientIdentifier object has a boolean property IsDefault.
I am binding the dataset to the RadGrid using the NeedDataSource event. I am not including displaying the IsDefault property in the RadGrid. I am displaying a GridClientSelectColumn instead.
What I would like to do is select the row in the RadGrid that corresponds to the ClientIdentifier object with IsDefault = true programmatically when the grid is first loaded. After the RadGrid is loaded, the user can then select whatever item they want in the RadGrid.
Here is my RadGrid declaration:
How can I go about doing this? I've been playing around with the RadGrid's DataBound event with little luck. I'm not sure that's even the right event to use.
I am binding the dataset to the RadGrid using the NeedDataSource event. I am not including displaying the IsDefault property in the RadGrid. I am displaying a GridClientSelectColumn instead.
What I would like to do is select the row in the RadGrid that corresponds to the ClientIdentifier object with IsDefault = true programmatically when the grid is first loaded. After the RadGrid is loaded, the user can then select whatever item they want in the RadGrid.
Here is my RadGrid declaration:
<telerik:RadGrid ID="radGridClientIdentifiers2" runat="server" AutoGenerateColumns="false" OnUpdateCommand="radGridClientIdentifiers2_UpdateCommand" OnDeleteCommand="radGridClientIdentifiers2_DeleteCommand" OnInsertCommand="radGridClientIdentifiers2_InsertCommand" OnItemCreated="radGridClientIdentifiers2_ItemCreated" OnDataBound="radGridClientIdentifiers2_DataBound" OnNeedDataSource="radGridClientIdentifiers2_NeedDataSource"> <MasterTableView DataKeyNames="ID" CommandItemDisplay="Top"> <Columns> <telerik:GridEditCommandColumn ButtonType="PushButton" UniqueName="EditCommandColumn" /> <telerik:GridBoundColumn HeaderText="Number" DataField="Identifier" /> <telerik:GridDropDownColumn HeaderText="Type" EnableEmptyListItem="true" DataField="IdentifierTypeID" ListTextField="Description" ListValueField="ID" DataSourceID="objectDataSourceClientIdentifierTypes" /> <telerik:GridButtonColumn UniqueName="DeleteColumn" ButtonType="ImageButton" CommandName="Delete" /> <telerik:GridClientSelectColumn UniqueName="SelectColumn" HeaderText="Default" /> </Columns> <EditFormSettings EditFormType="Template"> <FormTemplate> <telerik:RadTextBox ID="radTextBox" Label="Number:" Text='<%# Bind("Identifier") %>' runat="server"> </telerik:RadTextBox> <telerik:RadComboBox ID="radComboBox" runat="server" Label="Type:" SelectedValue='<%# Bind("IdentifierTypeID") %>' DataSourceID="objectDataSourceClientIdentifierTypes" DataTextField="Description" DataValueField="ID" /> <telerik:RadButton ID="radButtonInsert" runat="server" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' /> <telerik:RadButton ID="radButtonCancel" runat="server" Text="Cancel" CausesValidation="false" CommandName="Cancel" /> </FormTemplate> </EditFormSettings> </MasterTableView> <ClientSettings> <Selecting AllowRowSelect="true" /> </ClientSettings></telerik:RadGrid>How can I go about doing this? I've been playing around with the RadGrid's DataBound event with little luck. I'm not sure that's even the right event to use.