views:

36

answers:

1

Hi,
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

+1  A: 

Hey,

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.

Brian
Hi, Thats correct. But I thinking how to accomodate the scenario of aspx and its code file as in actual case. eg: In asp.net I have the <asp:LinkButton> and I would hand the Onclick of the same in its codebehind.....But I am thinking how to plumb this in the work Im doin...Do reply me if you can suggest. Thanks.
Justin
The .NET framework does this by looking for the __EVENTTARGET and __EVENTARGUMENT, which calls IPostBackEventHandler.RaisePostBackEvent with the supplied argument, which the LinkButton fires the click event. That's how it works by default.
Brian