locked
how wire up events in webform page RRS feed

  • Question

  • I tried to experiment with AutoEventWireup =false  in asp.net webform page directive. I looked around to where to write EventHandler  delegate  but there is no class as in windows form to do that. Another question where is the other  partial class  of "partial class _Default"? 
    • Edited by kobosh3 Wednesday, September 11, 2019 2:19 PM
    • Moved by CoolDadTx Thursday, September 12, 2019 1:53 PM ASP.NET related
    Wednesday, September 11, 2019 2:18 PM

Answers

  • Hi kobosh3,

    Thank you for posting here.

    When AutoEvent Wireup is false, you must explicitly bind the method of the event. There is no need to rebind the event of the server-side control. For the following methods of the Page class, such as load, init, etc, you need to manually create methods to trigger. Specifically how to create EventHandler, you can override the OnInit method and call the method you need to trigger inside. For more details, you can refer to the following links:

    PagesSection.AutoEventWireup Property

    Best Regrads,

    Xingyu Zhao



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, September 12, 2019 8:14 AM

All replies

  • https://forums.asp.net

    You can discuss the events on the DOM, and HTML controls using JavaScript and C# in the Web form fourm.

    Wednesday, September 11, 2019 3:05 PM
  • Hi kobosh3,

    Thank you for posting here.

    When AutoEvent Wireup is false, you must explicitly bind the method of the event. There is no need to rebind the event of the server-side control. For the following methods of the Page class, such as load, init, etc, you need to manually create methods to trigger. Specifically how to create EventHandler, you can override the OnInit method and call the method you need to trigger inside. For more details, you can refer to the following links:

    PagesSection.AutoEventWireup Property

    Best Regrads,

    Xingyu Zhao



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, September 12, 2019 8:14 AM
  • Please post questions related to ASP.NET in the ASP.NET forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, September 12, 2019 1:53 PM
  • thanks Xingyu

    can you also explain this: "As an alternative to binding events to handlers, you can override the Oneventname methods of the page or of controls."   I found in the link you provided

    Friday, September 13, 2019 2:18 PM