Last post Dec 02, 2008 12:15 PM by rafayali
Dec 02, 2008 12:37 AM|rafayali|LINK
I was wondering how to get access to a particular page class from Generic Handler (.ashx). My purpose is to access Default.aspx from the generic handler, create server controls dynamically and then add them to the controls collection. I have thus far been
unable to do this. Can someone point me in the right direction? Basically, I have two requirements
i) How to access a certain page class from generic http handler? For example, how can i reference default.aspx and default.aspx.vb from my ashx?
ii) How to add controls to any form from within the ashx file? I am not looking for the html32textwriter and response.write combinations? I wanted to output controls dynamically like we can in code behind pages like:
Now, in the above, how to get access to this FORM1?
To put things into perspective, here is what I am trying to do:
I have an ashx file that would create controls dynamically based on the querystring parameter in Default.aspx. So, for example, the requested url is default.aspx?op=create. The ashx handler would read the op querystring and create controls for the create
Thanks for all your help and advice in advance.
Dec 02, 2008 06:17 AM|imran_khan|LINK
I have an ashx file that would create controls dynamically based on the querystring parameter in Default.aspx. So, for example, the requested url is default.aspx?op=create. The ashx handler would read the op querystring and create controls for the create operation.
As per my knowledge you can not create controls using handler. To display controls on the web page,you need to add those dynamically created controls in parent control.But you can achieve your goal using frame.Use frame instead of handler. you can easily
access other .aspx pages in .aspx page.
Dec 02, 2008 11:50 AM|rafayali|LINK
Thanks for the info. What do you mean by frames? Are you referring to placing a placeholder in my forms?
Dec 02, 2008 12:15 PM|rafayali|LINK
Ok I have figured out how to achieve this. For future reference and to help others in the same situation, here is what needs to be done which I have to admit is pretty straight forward but the thought of working with httphandlers sort of makes the whole
thing sound more complicated than it really is.
That's it. Pretty much the standard way of doing this from any other ASPX page.
Thanks for everybodys help.