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

how to refresh radgrid?

2 Answers 2874 Views
Grid
This is a migrated thread and some comments may be shown as answers.
khaled jendi
Top achievements
Rank 1
khaled jendi asked on 23 Aug 2011, 07:48 AM
hi,

I have rad grid control and radcompobox, now whenever I change radcombobox index, the page is post back and RadGrid1_NeedDataSource will be fired again with different datasource (because when changing combobox index the sql statment is changed and datatable is changed too) and the grid should be changed, but the problem its remaining same as it is!!

when I click refresh button in radgrid, then content of grid changed!

so the question would be, how to refresh datagrid after assigning datasource to different table?

2 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 23 Aug 2011, 07:54 AM
Hello,

RadComboBox1_IndexChangedEvent()
{
   RadGrid1.Rebind();
}
 
RadGrid1_NeedDataSource()
{
    DataTable dt ;
    if(RadComboBox1.SelectedIndex  == 1)
    {
         dt = new DataTable(); //with different data
    }
   else
    {
       dt = new DataTable();  // with different data
     }
 
    RadGrid1.DataSource = dt;
}
 

<telerik:RadAjaxManager ID="ajaxMgr" runat="server">
          <AjaxSettings>
             <telerik:AjaxSetting AjaxControlID="RadComboBox1">
                  <UpdatedControls>
                      <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                  </UpdatedControls>
             </telerik:AjaxSetting>
         </AjaxSettings>
</telerik:RadAjaxManager>

Let me know if any concern.


Thanks,
Jayesh Goyani
0
Fernando
Top achievements
Rank 1
answered on 05 Feb 2013, 06:05 PM
Thanks a lot Jayesh, the Info is very helpful
Tags
Grid
Asked by
khaled jendi
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Fernando
Top achievements
Rank 1
Share this question
or