7 Answers, 1 is accepted
0
Hello Daron,
As on NeedDataSource you generally pass a value to the DataSource property of the grid, you can detect the initial load and simply pass an empty object (new object[] {}) instead so the grid will not be bound on first page load.
Greetings,
Manuel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
As on NeedDataSource you generally pass a value to the DataSource property of the grid, you can detect the initial load and simply pass an empty object (new object[] {}) instead so the grid will not be bound on first page load.
Greetings,
Manuel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Daron
Top achievements
Rank 1
answered on 13 Feb 2008, 01:39 PM
Thanks Manuel,
However to my mind the implementation of NeedDataSource is flawed in as much that it should not fire automatically.
It should wait for the developer to explicitly call .Rebind() - ie, should follow a similar implementation to standard gridview.
That way, we wouldn't have to have conditions in the method to see if it's the initial pageload event and anyone who does need it to fire on first load simply calls .Rebind() in the Page_Load event.
Just my 2 cents.
Cheers
DT
However to my mind the implementation of NeedDataSource is flawed in as much that it should not fire automatically.
It should wait for the developer to explicitly call .Rebind() - ie, should follow a similar implementation to standard gridview.
That way, we wouldn't have to have conditions in the method to see if it's the initial pageload event and anyone who does need it to fire on first load simply calls .Rebind() in the Page_Load event.
Just my 2 cents.
Cheers
DT
0
Hi Daron,
There is a quick solution for our case - simply set the Visible property of grid to false initially. Thus the NeedDataSource event will not fire. Later, when you want to display the grid table switch the Visible property to true and rebind the control. More info on the matter can be found here.
Best,
Stephen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
There is a quick solution for our case - simply set the Visible property of grid to false initially. Thus the NeedDataSource event will not fire. Later, when you want to display the grid table switch the Visible property to true and rebind the control. More info on the matter can be found here.
Best,
Stephen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Daron
Top achievements
Rank 1
answered on 13 Feb 2008, 03:08 PM
Thanks Stephen,
I am using this method now and it seems to work ok. However, I still stand by my position that it's flawed logic to have an event firing before you instruct it to, and to have to show and hide a control to work-around that.
I shouldn't have to make an effort to "prevent" the event, I do expect to write code to "fire" the event.
Telerik seems to generally try and mimic practices of "standard" asp.net controls except in this case? (ie, gridview doesn't "self-populate" like radgrid)
Cheers
I am using this method now and it seems to work ok. However, I still stand by my position that it's flawed logic to have an event firing before you instruct it to, and to have to show and hide a control to work-around that.
I shouldn't have to make an effort to "prevent" the event, I do expect to write code to "fire" the event.
Telerik seems to generally try and mimic practices of "standard" asp.net controls except in this case? (ie, gridview doesn't "self-populate" like radgrid)
Cheers
0
Accepted
Hi Daron,
You are right about this, however the MS GridView does not support advanced data-binding with NeedDataSource handling as RadGrid. If you use simple binding with our web grid (having in mind that it does not support grouping, filtering and other advanced operations) you should be able to get the same result as with the GridView control.
Feel free to use this binding technique if applicable or consider the solution with the Visible property settings as an alternative.
Best,
Stephen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You are right about this, however the MS GridView does not support advanced data-binding with NeedDataSource handling as RadGrid. If you use simple binding with our web grid (having in mind that it does not support grouping, filtering and other advanced operations) you should be able to get the same result as with the GridView control.
Feel free to use this binding technique if applicable or consider the solution with the Visible property settings as an alternative.
Best,
Stephen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

reubix
Top achievements
Rank 1
answered on 08 Nov 2008, 09:25 AM
I fully concur with the author of this post. You should not have to set a control visibility to false just so that it doesnt autobind when ever it pleases. I have the grid in a pageview that loads on demand but this NeedSource is really getting on my nerves when the PageView that holds the grid is not selected but the control wants to load data. I want to specifically tell the control to render when I want.
0

Mahesh
Top achievements
Rank 1
answered on 28 Nov 2011, 09:07 AM
set the visible property to false on page load.
RadGrid.Visible =
false;
Thanks
Mahi