We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid in Update Panel

Hello
I have a project with two web pages form: page1, page2. On both pages I have a grid inside an update panel.
Suppose I opened page1 and then page2 on another browser tab. When I return to page1 and click on a button to update the update panel, the grid records of page2 are displayed in the grid.
How to solve this?

Thank you.

7 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team August 11, 2017 12:50 PM UTC

Hi Fernando, 

Thanks for contacting Syncfusion support. 

We checked in our sample with two web pages and in both pages we placed a Grid inside an updated Panel. Once we opened the two web pages in two browser tabs and you have mentioned that when you return to Page 1 and click on a button to update the update panel, the grid records of Page 2 are displayed in the grid. Here we need a detail description regarding updating the update panel.  
 
We checked with by updating the records in the Grid and we unable to reproduce the mentioned issue at our end. So, we need the following details.  
 
1. Share the code example.  
  
2. Share the video demonstration of an issue.  
 
3. Essential Studio Version details.  

4. If possible, replicate the issue in the attached sample.  


Regards, 
Prasanna Kumar N.S.V 
 



LF Luis Fernando August 11, 2017 07:50 PM UTC

Follow the example.


1 - Open Page1 and then Page2 on another browser tab.

2 - Return to Page1 and click in the Update button. The grid records of Page2  are displayed in the grid.


Attachment: WebSite4_94016f7b.zip


VN Vignesh Natarajan Syncfusion Team August 14, 2017 01:13 PM UTC

Hi Fernando, 

Thanks for contacting Syncfusion support. 

We have analyzed your sample and we are able to reproduce the issue at our end. The reported issue is occurred due to both the Grid has same ID and dataSource is updated based on the Grid ID.  

Page1.aspx  
private void BindDataSource() 
    { 
        int orderId = 10643; 
        int empId = 0; 
                . 
                . 
                . 
        this.OrdersGrid.DataSource = order; 
        this.OrdersGrid.DataBind(); 
    } 


Page2.aspx 
private void BindDataSource() 
    { 
        int orderId = 10643; 
        int empId = 0; 
                . 
                . 
                . 
        this.OrdersGrid.DataSource = order; 
        this.OrdersGrid.DataBind(); 
    } 


Both the Grid have same ID and whenever the page is refreshed the dataSource will be changed(if it doesn’t match with current dataSource).  
To overcome/neglect this issue, use different ID for different Grid. 
We have modified your sample page2.aspx and page2.aspx.cs file so that issue can be resolved. the modification we made ere explained in code snippet and the sample can be downloaded for the following link 
Page2.aspx 
<ej:Button ID="Button1" runat="server" Type="Button" OnClick="Button1_Click" Text="Update"></ej:Button> 
          <ej:Grid ID="OrdersGrid1" runat="server" DataSourceCachingMode="Session" AllowPaging="True"> 
      
Page2.aspx.cs 
 
        this.OrdersGrid1.DataSource = order; 
        this.OrdersGrid1.DataBind(); 
    } 



Regards, 
Vignesh Natarajan 



LF Luis Fernando August 17, 2017 07:33 PM UTC

Thank you, Vignesh.


Are there any other alternatives besides this? Because as pages are standardized I would keep the grid on the master page and on the child pages I would load it.



SA Saravanan Arunachalam Syncfusion Team August 18, 2017 10:37 AM UTC

Hi Luis, 
We have analyzed your query, the cause of the issue is that the page2 tab became active when open the page2 in new browser tab and updated the update panel with details in active tab. 
So, we suggest you to set the different id either for the Grid or UpdatePanel to overcome your issue and hence could you please provide the following details? 
1.       Do you want to render the reusable Grid? 
2.       Do you expect bind the different data to the Grid dynamically? 
3.       Why you placed grid in master page? 
4.       Provide clear details about your requirement. 
Regards, 
Saravanan A. 



LF Luis Fernando August 21, 2017 11:34 AM UTC

Yes, I want to render the reusable Grid and I expect bind different data to the Grid dynamically.

I placed grid in master page because all the pages will follow the same pattern, I will have a registration form and as I add new records, edit or delete existing records, I reload the grid.



SA Saravanan Arunachalam Syncfusion Team August 22, 2017 01:31 PM UTC

Hi Luis, 
Based on your requirement, we have created Asp.Net user control to render the reusable grid control on the page and we have modifed the previously provided sample with user control that can be download from the below link. 
Note: If we render the user control within the update panel, we need to manually update User control with updated data because the UpdatePanel.Update() method will reset the user control with initial data. 
Regards, 
Saravanan A. 


Loader.
Live Chat Icon For mobile
Up arrow icon