简体   繁体   中英

ASP.NET - Creation of custom page with custom tags, with event handling

I am trying out some code which enables me in creating a page with extension .asp2

The tags included will also be custom, something like:

<asp2:H>
  <asp2:T>
    First Page
  </asp2:T>
</asp2:H>
<asp2:B>
  <asp2:D>
    <asp2:Label>Welcome......</asp2:Label>
  </asp2:D>
</asp2:B>

I have done the necessary changes so that ASP.NET identifies the extension. I have also kept a mapping of custom tags and asp.net/html tags with myself. With this I am able to render the page on browser. But how can we do event handling(usually done by page postbacks and code) in such a scenario???

Please suggest

ASP.NET uses a client-side __doPostBack(id, event) method to trigger the postback to the server. You can inspect the JS code that's loaded when you run an ASP.NET page to see all that it does. On the client, it stores an __EVENTTARGET and __EVENTARGUMENT form values to identify the control that caused the postback, and subsequently create an event.

You would have to do all this plumbing, or figure out a way to wrap existing components so that you don't lose those fundamentals.

HTH.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM