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

Select RadGrid Row with RadioButton

0 Answers 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DEBAL
Top achievements
Rank 1
DEBAL asked on 20 Apr 2012, 11:09 AM
Hi Support
I need a help for my RadGrid . In this Grid data are comming from data base and it has five hundred of records . So definetly we need paging with Page Size 20 . In this grid we also set Radio Button . In my page there is one telerik treeview control , suppose the one treeview node is select by User that corresponding row should be selected in RadGrid . See the below code , one thing We need not to think anything about of Treeview , because I hadrcoded one node number  which is QuestionNumber in the below code :

protected void SomeButton_Click(object sender, EventArgs e)
{
 int Questionnumber = 100// this number is actually pass through method parameter .

 RadGrid1.Allowpaging = false;
 RadGrid1.ReBind();
 foreach (GridDataItem item in grid1.Items)
 {
  RadioButton btn = (RadioButton)item.FindControl("radiobutton1");
  string value = item.GetDataKeyValue("Questionnumber").ToString(); 
    if( Convert.ToInt32(value) == Questionnumber)
          {
                 btn.checked = true; // see this is mandatory , because Question number is coming from a method which is related to a
// treeview selected node , and that node corresponding row should be selected in RadGrid , here in this button click have nothing to do with
//treeview , so we hard coded the QuestionNumber 100

RadGrid1.CuurentPageIndex = Questionnumber;// here I need to set something like that the selected RadioButton Corresponding
Row or Page should be load . suppose my selected Radio Button row relies in 315 Row number , so show datagrid in such a way that
corresponding page number I mean paging suppose it is 9 th page that page should come in grid rather than starting from page 1
and also radio button should selected with it
          }
 
}
RadGrid1.Allowpaging = true ;
 RadGrid1.PageSize = 20; // If I make this Size my selected Radio button is Not Showing in DataGrid
//and if I make it 100 or above then it is Showing .

RadGrid.ReBind(); //If I make it ReBind then it is my radio button is not showing  selected row in RadGrid .
 
}

This is very important , other wise my telerik control becomes unused. See in aspx page I don't set any
AllowPaging = true .
Pl give me any suggestion pl

One Solution may be , though the grid  may have thousands of records getting from database , so see the paging where the selected row is existing , suppose radiobutton.selected row is in page 5 so start paging and load grid data from 5th page and there is option previous and next paging...something like that , how can I do

No answers yet. Maybe you can help?

Tags
Grid
Asked by
DEBAL
Top achievements
Rank 1
Share this question
or