OK, I am not sure if the title it completely accurate, open to suggestions!
I am in the process of creating an ASP.NET custom control, this is something that is still relatively new to me, so please bear with me.
I am thinking about the event model. Since we are not using Web Controls there are no events being fired from buttons, rather I am manually calling __doPostBack with the appropriate arguments. However this can obviously mean that there are a lot of postbacks occuring when say, selecting options (which render differently when selected).
In time, I will need to make this more Ajax-y and responsive, so I will need to change the event binding to call local Javascript.
So, I was thinking I should be able to toggle the "mode" of the control, it can either use postback and handlle itself, or you can specify the Javascript function names to call instead of the doPostBack.
- What are your thoughts on this?
- Am I approaching the raising of the events from the control in the wrong way? (totally open to suggestions here!)
- How would you approach a similar problem?
Edit - To Clarify
- I am creating a custom rendered control (i.e. inherits from WebControl).
- We are not using existnig Web Controls since we want complete control over the rendered output.
- AFAIK the only way to get a server side event to occur from a custom rendered control is to call doPostBack from the rendered elements (please correct if wrong!).
- ASP.NET MVC is not an option.