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

Rebind() Causing Problem

0 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DEBAL
Top achievements
Rank 1
DEBAL asked on 21 Apr 2012, 04:03 PM
Hi Support
I'm facing this below problem very much.  My Radgrid  Rebind() method makes selected radio button unselected   from grid. How can I fix that , see the Code

<telerik:RadGrid ID="RadGrid1" runat="server"   AutoGenerateColumns="False"
     AllowFilteringbyColumn = "true" AutogeneratedColumn="false" OnPageIndexChanged="RadGrid1_PageIndexChanging"
Allowpaging= "true" PageSize="20"
        >        
      .............
</telerik:RadGrid>

//this method is need to show radiobutton selected for user selected specifc items from another control like treeview

Private void Method(int Questionnumber)
{
RadGrid1.Allowpaging = false;
 RadGrid1.ReBind();
 foreach (GridDataItem item in grid1.Items)
 {
  RadioButton btn = (RadioButton)item.FindControl("radiobutton1");
  string value = item.GetDataKeyValue("Questionnumber").ToString(); 
           if( value == Questionnumber)
          {
                    btn.checked = true;
                    RadGrid1.MasterTableView.CurrentPageIndex = 3; // see ,here is also one problem : I write it 3 but it should be //like that  which radiobutton is selected I need to find the current page Index of that page where the selected radiobutton row is exist .
// suppose I know my desired item row is exists in CurrentPageIndex =3 , so I write this , so the paging will be selected in 3

 but I need
// to do it though code ,  like that:

 user selected any item and its number is come through above Questionnumber which I write in method parameter ,

now    if( value == Questionnumber) is true

 then radio button will be selected but How can I know that button is in which row or which page Index ,


 if I make the code like this:

 int currentpageindex = (int)(RadGrid1.MasterTableView.Items.Count /  20 ),

then suppose it comes 15 if  total count is 315 but How to get PageIndex ???????

}
RadGrid1.Allowpaging = true;
RadGrid1.PageSize = 20;
 RadGrid1.MastertableView.ReBind(); // if I write this then My selected Radio Button not selected and if I don't write then paging
is not showing

Pl give any suggestion

No answers yet. Maybe you can help?

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