How do you manage the order of firing events in asp.net?

前端 未结 3 1851
不思量自难忘°
不思量自难忘° 2021-01-16 12:28

The question seems to be trivial, but i didn\'t found an answer with google.

If I have multiple independent controls in a web-form, e.g. DropDownLists and grid, and

3条回答
  •  旧时难觅i
    2021-01-16 12:48

    Unfortunately, you should not be constructing event handlers that rely on a firing order. This is not a recommended practice. From ASP.NET Web Server Control Event Model:

    You should not create application logic that relies on the change events being raised in a specific order unless you have detailed knowledge of page event processing. For details, see ASP.NET Page Life Cycle Overview.

    There is probably a flaw in your design if you are relying on this. If you post some more details, we can see if we can help you get around it.

    EDIT:: Rudnev, I've used RadGrid before but I can't remember the exact purpose of the NeedDataSource event. Wouldn't it be sufficient to set your dropdownlist to automatically post back once it's been changed, and then in the event handler, set the DataSource of your Grid to the appropriate source, and call DataBind() on it?

提交回复
热议问题