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

Invisible RadGrid doing DataBind

8 Answers 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
improwise
Top achievements
Rank 1
Iron
Iron
improwise asked on 31 Mar 2011, 09:22 AM
We have a very strange problem, we have a RadGrid that is invisible inside an UpdatePanel, that is set as the receiver of AJAX requests (along with other control). When the sender initiates an AJAX request, the RadGrid will try to DataBind, even though it is still invisible, which seem strange. Is this really expected behaviour or is it a bug? In my world, and invisible RadGrid should never try to DataBind by itself (all data operations for the grid is handled automatically).

8 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 31 Mar 2011, 12:47 PM
Hello Patrik,


From the documentation, I could understand that RadGrid does not fire the NeedDataSource event unless it is visible (Visible=True). So, if you use AdvancedDataBinding (using NeedDataSource event), then databinding happens when needed only (means when the grid is visible on page), and thereby you can avoid unneccessary databinding.

Give a try with advanced data binding technique and see whether that helps yo.


Have a great day.


Thanks,
Princy.
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 31 Mar 2011, 12:52 PM
Thanks for your answer.

The main problem as I see it is not finding a working workaround (funny, eh?) as we already have that, but more the fact that it shouldn't try to do a databind at all, and the fact that it does makes me wonder if this is a bug that needs to be fixed. This only seem to happen as a result of an AJAX update request being sent, we can load the page normally and it won't fire (it's a search form with a buttonSearch that sets the grid to visible and thus triggering the databind). The AJAX update seem to jump past this, and force a DataBind, which we only noticed as it crasched because the necessary search parameters were missing.

0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 31 Mar 2011, 03:32 PM
This is now going from strange to crazy. With the RadGrid still invisible, if we have it wired to a DataSource, it will try to DataBind by itself despite being invisible (DataBind event will fire). However, if we clear the DataSource (no other changes), the NeedDataSource even will not fire (as it should do as far as I know). In short, an invisible RadGrid wired to a DataSource will try to data bind.

Update:
Further test shows that if the RadGrid is already visible (we arranged input values so default values in search form would work), then it won't try to DataBind during AJAX update, only seems to occur if it is invisible...

Is it just me thinking there is something really strange going on here? Is it a bug?
0
Martin
Telerik team
answered on 01 Apr 2011, 09:46 AM
Hello Patrik Johansson,

I have already addressed the support ticket you have opened on the same topic. To make it available for our community, I am pasting my answer here as well:

I have reviewed the forum thread, however the information does not clear the following details from your scenario:

  • How do you set your RadGrid to be invisible - declaratively or programmatically.
  • How do you bind your grid - Advanced data binding, or Declarative data source control (Object data source for example).
Once I have the information above, I will build a sample test project and try to reproduce the issue locally. Then I will be able to confirm whether this behavior is a bug or expected. Certainly, if you find more appropriate, you can send me a sample demo that demonstrates the erroneous behavior.

Greetings,
Martin
the Telerik team
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 01 Apr 2011, 09:57 AM
Thanks for looking into this.

The visible = false is set at design time, and we use a declarative data source control (and automatic data operations if that matters, but I think that only applies to edit, insert and delete).

It should perhaps also be noted that the RadGrid is located in a User Control, which in turn is located along with other user controls in a RadMultiPage, which is controlled by a RadTabStrip. I don't know how important this is, RadGrids that are visible from start does not have this problem, also, as mentioned above, setting the grid to visible design time will prevent this strange behaviour.
0
Martin
Telerik team
answered on 04 Apr 2011, 04:03 PM
Hello Patrik Johansson,

Based on your information I have build a small sample that behaves as expected on my side. I have bound the grid to SqlDataSource as well as to ObjcetDataSource, but in both cases neither DataBinding, nor DataBound grid event is fired. Please review the attached project and let me know whether I miss something.

Kind regards,
Martin
the Telerik team
0
Dave
Top achievements
Rank 1
answered on 21 Apr 2011, 10:17 PM
I just tried to run your example, and the grids didn't even appear.  I'm having a similar issue.  I had a RadGrid inside of a RadToolTip in a User Control.  I set the grid's visible property to false.  When search criteria is entered, I then show the Grid, and it binds using advanced databinding (NeedDataSource).  I check the data returned and it is populated.  The problem is, I don't see the RadGrid.  The NeedDataSource handler fires, but the grid doesn't render.  Attached is a screenshot.  All you see is an empty box that is the dimensions I assigned the grid.  You don't even see the NoRecordsTemplate.  What is going on? Please help!!!
0
Martin
Telerik team
answered on 26 Apr 2011, 09:21 AM
Hello Dave,

As stated in this help topic, you must set the "Visible" property of the MasterTableView to "true" and rebind the grid.

As to "I just tried to run your example, and the grids didn't even appear." - this is expected. If you examine the code you will notice that both grids have their Visible properties set to "False".

I hope this helps.

Kind regards,
Martin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
improwise
Top achievements
Rank 1
Iron
Iron
Answers by
Princy
Top achievements
Rank 2
improwise
Top achievements
Rank 1
Iron
Iron
Martin
Telerik team
Dave
Top achievements
Rank 1
Share this question
or