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

[Solved] NeedDataSource fires on every postback

3 Answers 331 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Attila Gál
Top achievements
Rank 1
Attila Gál asked on 17 Feb 2010, 09:20 AM
Hi,

We're using Advanced binding, and I have a lot of anomalies with the NeedDataSource event.


The strange things I experience:  (EnableViewState="True")

-the event fires even if the Grid.Visible = false
-the event fires on every postback, with RebindReason = InitialLoad

I have EditMode = EditForms, but the event sequence is the following on every postback, for example the clickhandler of a button in the edit usercontrol
1. Page load
2. NeedDataSource
3. EditControl's PageLoad
4. Close_Click

As far as I know it should be
1. Page load
2. EditControl's PageLoad
3. Close_Click
4. NeedDataSource


I call Grid.MasterTableView.Rebind only in the click eventhandler of my Search button, but it doesn't fire the NeedDataSource event, because it's called a bit earlier, because of the postback...

I've read all the articles and forum threads regarding NeedDataSource, I have no idea what's wrong, it seems that the Grid can't use the Viewstate, but that's enabled at every possible location. Moreover I call TrackViewState on InitComplete, but this behaviour doesn't change.

What should I try?

thanks,


     Attila

3 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 23 Feb 2010, 09:19 AM
Hello Attila,

This behavior is not expected as evidenced by our online example featuring a user control for the grid's edit form:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx

Also It is hard to say what is causing the described issue without seeing some code. Could you please send us a simple runnable application demonstrating the problem. In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution. I'd suggest that you open a formal support ticket and attach your project for inspection and debugging.

Additionally you do not have to use NeedDataSource advanced data-binding if you do not want - you could use simple data binding.

I hope this helps.

Kind regards,
Radoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Attila Gál
Top achievements
Rank 1
answered on 01 Mar 2010, 02:54 PM
Hi Radoslav,

Thanks for answering my problem.
In the meanwhile I've opened a support ticket, and posted a solution which produces the issue.
The solution was strange: during the PreInit event, I accessed the form's Controls collection, and this caused this wrong behaviour.
(I should know which control caused the postback.)

Anyway don't understand why it is a problem to _read_ from a collection, but I changed my code now and it's working well.

Thanks again,


Attila
0
Radoslav
Telerik team
answered on 04 Mar 2010, 11:18 AM
Hi Attila,

I noticed that you have opened a duplicate post on the same matter. Please, refer to the other support ticket post for additional information. To avoid duplicate posts, I suggest you continue the communication there.

Regards,
Radoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Attila Gál
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Attila Gál
Top achievements
Rank 1
Share this question
or