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

[Solved] Grid display does not change after rebind

1 Answer 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erwin
Top achievements
Rank 1
Erwin asked on 10 Aug 2009, 04:15 PM
I have a grid inside a user control.

i made an GridTemplateColumn with a customized edit button.
When I click the customized edit button, a pop up will show and and user can now edit the items selected.

my problem is when i click on the ok of the pop up the grid does not rebind....

i placed a rebind code in the onclientclose event of the popup.
i also have and ajax panel on may grid

when i press F5 or refresh the page, the grid shows then changes made from editing the grid.
 
I also noticed that when i click sort on my grid, the edited item shows.

correct me if im wrong but i think my data source is updated as well as my grid but i think that the grids display does not change.

please help.  I have many usercontrols that have the same problem.

Grid that does not change its display even after rebind.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 11 Aug 2009, 05:24 AM
Hello Erwin,

On clicking the OK button in the pop up window, you can register a client script as shown below:
c#:
protected void OkButton_Click(object sender, EventArgs e) 
   {            
      ClientScript.RegisterStartupScript(Page.GetType(), "mykey""CloseAndRebind();"true);  
           
   }  

You can then invoke a refreshGrid function, so as to pass window parameters , as shown below:
js:
function CloseAndRebind(args)  
        {  
            GetRadWindow().Close();  
            GetRadWindow().BrowserWindow.refreshGrid(args);  
        }  

In the refreshGrid function defined in the parent page, you should in turn fire an ajax request:
js:
function refreshGrid(arg) 
           { 
             if(!arg) 
             { 
             $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");             
             } 
           }

Finally, rebind the grid in the AjaxRequest server side event:
c#:
 protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) 
        { 
            if (e.Argument == "Rebind"
            { 
                RadGrid1.Rebind(); 
            }            
        } 

Hope this helps you out..
Princy.
Tags
Grid
Asked by
Erwin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or