The grid is loaded with data and while selecting a row from the grid, the data is not displayed in the corresponding controls.Using trace, I found that SelectIndexChange event is not fired. My code is below
<telerik:RadGrid runat="server" ID="rgoptionexercisetype" AllowPaging="True" AllowSorting="True"
AllowFilteringByColumn="True" CellSpacing="2" GridLines="None" CssClass="Grid_Master"
Skin="Office2010Black" OnSelectedIndexChanged="rgoptionexercisetype_SelectedIndexChanged"
ClientSettings-EnablePostBackOnRowClick="True" >
<MasterTableView DataKeyNames="optionexercisetypecode" ClientDataKeyNames="optionexercisetypecode">
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<PagerStyle Mode="NumericPages" AlwaysVisible="True" EnableSEOPaging="True" />
</MasterTableView>
<ClientSettings EnableRowHoverStyle="True" EnablePostBackOnRowClick="True" AllowColumnsReorder="True" Selecting-AllowRowSelect="true"
ReorderColumnsOnClient="True" >
<DataBinding SelectMethod="GetDataAndCount" Location="GridWcfService.svc" SortParameterType="Linq"
FilterParameterType="Linq">
</DataBinding>
<Selecting AllowRowSelect="True" />
</ClientSettings>
<HeaderStyle HorizontalAlign="Center" ForeColor="White" />
<FilterItemStyle HorizontalAlign="Center" />
<PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="True"
EnableSEOPaging="True" />
<FilterMenu EnableImageSprites="False">
</FilterMenu>
</telerik:RadGrid>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
WROptionExerciseType.Service1 cl = new WROptionExerciseType.Service1();
rgoptionexercisetype.DataSource = new string[] { };
rgoptionexercisetype.DataSource = cl.SelectOptionExcerciseType();//loading the record in the grid
rgoptionexercisetype.DataBind();
ViewState["OPT"] = cl.SelectOptionExcerciseType();
GridColumn column = rgoptionexercisetype.MasterTableView.GetColumnSafe("optionexercisetypecode"); //hiding the auto-generated column
if (column != null)
{
column.Visible = !column.Visible;
rgoptionexercisetype.Rebind();
}
}
protected void rgoptionexercisetype_SelectedIndexChanged(object sender, EventArgs e)
{
//while selecting the row in the grid, the data are displayed in the corresponding controls
rgoptionexercisetype.DataSource=ViewState["OPT"];
if (e.ToString() != String.Empty || e.ToString() != "")
{
this.lbloptionexercisetypecode.Text = rgoptionexercisetype.SelectedItems[0].Cells[2].Text;
this.rtxtoptionexerciseType.Text = rgoptionexercisetype.SelectedItems[0].Cells[3].Text;
this.rcboptionexcercisestatus.SelectedValue = rgoptionexercisetype.SelectedItems[0].Cells[4].Text;
this.rtxtdisplayorder.Text = rgoptionexercisetype.SelectedItems[0].Cells[5].Text;
}
}
<telerik:RadGrid runat="server" ID="rgoptionexercisetype" AllowPaging="True" AllowSorting="True"
AllowFilteringByColumn="True" CellSpacing="2" GridLines="None" CssClass="Grid_Master"
Skin="Office2010Black" OnSelectedIndexChanged="rgoptionexercisetype_SelectedIndexChanged"
ClientSettings-EnablePostBackOnRowClick="True" >
<MasterTableView DataKeyNames="optionexercisetypecode" ClientDataKeyNames="optionexercisetypecode">
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<PagerStyle Mode="NumericPages" AlwaysVisible="True" EnableSEOPaging="True" />
</MasterTableView>
<ClientSettings EnableRowHoverStyle="True" EnablePostBackOnRowClick="True" AllowColumnsReorder="True" Selecting-AllowRowSelect="true"
ReorderColumnsOnClient="True" >
<DataBinding SelectMethod="GetDataAndCount" Location="GridWcfService.svc" SortParameterType="Linq"
FilterParameterType="Linq">
</DataBinding>
<Selecting AllowRowSelect="True" />
</ClientSettings>
<HeaderStyle HorizontalAlign="Center" ForeColor="White" />
<FilterItemStyle HorizontalAlign="Center" />
<PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="True"
EnableSEOPaging="True" />
<FilterMenu EnableImageSprites="False">
</FilterMenu>
</telerik:RadGrid>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
WROptionExerciseType.Service1 cl = new WROptionExerciseType.Service1();
rgoptionexercisetype.DataSource = new string[] { };
rgoptionexercisetype.DataSource = cl.SelectOptionExcerciseType();//loading the record in the grid
rgoptionexercisetype.DataBind();
ViewState["OPT"] = cl.SelectOptionExcerciseType();
GridColumn column = rgoptionexercisetype.MasterTableView.GetColumnSafe("optionexercisetypecode"); //hiding the auto-generated column
if (column != null)
{
column.Visible = !column.Visible;
rgoptionexercisetype.Rebind();
}
}
protected void rgoptionexercisetype_SelectedIndexChanged(object sender, EventArgs e)
{
//while selecting the row in the grid, the data are displayed in the corresponding controls
rgoptionexercisetype.DataSource=ViewState["OPT"];
if (e.ToString() != String.Empty || e.ToString() != "")
{
this.lbloptionexercisetypecode.Text = rgoptionexercisetype.SelectedItems[0].Cells[2].Text;
this.rtxtoptionexerciseType.Text = rgoptionexercisetype.SelectedItems[0].Cells[3].Text;
this.rcboptionexcercisestatus.SelectedValue = rgoptionexercisetype.SelectedItems[0].Cells[4].Text;
this.rtxtdisplayorder.Text = rgoptionexercisetype.SelectedItems[0].Cells[5].Text;
}
}