no matter what I did, I cant select first row. What I'm missing ?
I want to first row to be selected on page load.
items.count is always 0. to find out problem I created a new page with only grid and sqldatasource. still could not found d anything.
I want to first row to be selected on page load.
items.count is always 0. to find out problem I created a new page with only grid and sqldatasource. still could not found d anything.
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
CellSpacing
=
"0"
DataSourceID
=
"SqlDataSource1"
GridLines
=
"None"
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
MasterTableView
AutoGenerateColumns
=
"False"
DataKeyNames
=
"ID"
DataSourceID
=
"SqlDataSource1"
>
<
RowIndicatorColumn
Visible
=
"False"
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
Created
=
"True"
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ID"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter ID column"
HeaderText
=
"ID"
ReadOnly
=
"True"
SortExpression
=
"ID"
UniqueName
=
"ID"
>
<
ColumnValidationSettings
>
<
ModelErrorMessage
Text
=
""
/>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"urun"
FilterControlAltText
=
"Filter urun column"
HeaderText
=
"urun"
SortExpression
=
"urun"
UniqueName
=
"urun"
>
<
ColumnValidationSettings
>
<
ModelErrorMessage
Text
=
""
/>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim c As Integer
c = RadGrid1.MasterTableView.Items.Count
End Sub
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
If (RadGrid1.MasterTableView.Items.Count > 0) Then
If (RadGrid1.SelectedItems.Count = 0) Then
RadGrid1.MasterTableView.Items(0).Selected = True
End If
End If
End Sub