|
-
Aug 7th, 2009, 09:21 AM
#1
Thread Starter
New Member
add control through html string, addhandler?
I have a dynamic asp.net web page in which I build html strings in vb.net and return them to the asp.net page.
I'm trying to add a control (specifically a button).
I am able to do this quite easily, but where i'm stuck is I do not know how to add a handler for the click event of this button.
here is the line of vb code that returns the html string.
Me.html = Me.html & "<button name=""b_ViewSearchOptions"" runat=""server"">View Search Options</button>"
the asp.net code would look like this..
<%=html%>
any help is greatly appreciated!
-
Aug 7th, 2009, 01:29 PM
#2
Re: add control through html string, addhandler?
You can't do that. When you generate code to write to the page, that's final. You can, however, use javascript to force a postback. Have a look at this example and modify it to fit your HTML generation.
http://www.dotnetspider.com/resource...avascript.aspx
-
Aug 7th, 2009, 10:35 PM
#3
Lively Member
Re: add control through html string, addhandler?
Are you trying to call a function here. i dont understand what your asking for. If your just trying to call an event handler of a buton
I do not know how to add a handler for the click event of this button.
then why not use <asp:button etc /> and follow it up on the vb with an button.onclick method?
-
Aug 8th, 2009, 04:33 AM
#4
Re: add control through html string, addhandler?
He's generating HTML and writing it straight out to the page. Imagine an extremely large Literal control.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|