This is a migrated thread and some comments may be shown as answers.

How to make Grid row initial selection?

1 Answer 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Oleg
Top achievements
Rank 1
Oleg asked on 02 Aug 2010, 08:40 PM
I have FormView as master and couple RadGrids as detail and subdetail on my ASP.NET form. The relation between FormView-Grid-Grid works fine. If user clicks on a row in detail radGrid the subdetail radGrid shows filtered rows. I passing parameters to detail radGrid and subdetail radGrid as ControlParameters in SqlDataSource.

 

<SelectParameters> 
  <asp:ControlParameter ControlID="cFormView" Name="ID" PropertyName="SelectedValue" 
    Type="Int32" /> 
  <asp:ControlParameter ControlID="cFormView$radGridDetails" DefaultValue="0" 
    Name="SubID" PropertyName="SelectedValue" Type="Int32" /> 
</SelectParameters> 

The issue is I cannot set an initial selection. I am using the code below. But when form is loaded still no selected rows in the detail radGrid. The subdetail radGrid shows nothing because SubID has not been passed to radGrid.

 

protected void Page_PreRender(object sender, EventArgs e) 
{
  RadGrid rg = ((Telerik.Web.UI.RadGrid)(cFormView.FindControl("radGridDetails"))); 
  if (rg.SelectedIndexes.Count == 0) 
  {
     rg.SelectedIndexes.Add(0);
  }
}

 


Oleg 

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 05 Aug 2010, 01:19 PM
Hello Oleg,

It is hard to say what is causing the unwanted behavior without having the running application and reproduce the issue. Could you please send us a simple runnable example which demonstrating the unwanted behavior. You could open a formal support ticket from your Telerik account and attach a ZIP file there. Or you could post your grid declaration with the related code behind file. Thus we will be able to gather more details about your scenario and provide you a solution.

Greetings,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Oleg
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or