Use __doPostBack from Javascript
Check this article for more http://www.codeproject.com
anv
Main Topics
Browse All TopicsHi experts,
I am dynamically creating a navigation menu with tabs for the different pages/topics of a survey. I'm doing this by concatenating the HTML code at runtime and setting it as the innerhtml property of a DIV tag on the page. I need to make the anchor tags trigger a server-side click event rather than set the HREF property. This is because I'm using the page's viewstate to store the user's answers as they progress through the survey rather than make a trip to the SQL database for each tab.
Can anyone tell me if this is possible, or if I'm overlooking something obvious? If more information/code samples are needed, please let me know. Thanks in advance!
P.S. If this seems overly complicated, I agree. But I have requirements for compatibility with css, etc.
Protected WithEvents header As System.Web.UI.HtmlControls
...
Dim strMenuHtml As New StringBuilder("<ul>")
' Loop through each page in the form and add a menu item
For i As Integer = 1 To objForm.PageCount - 1
strMenuHtml.Append("<li ")
If i = intPage Then
strMenuHtml.Append("id=""c
Else
strMenuHtml.Append("id=""m
End If
strMenuHtml.Append("runat=
Next
strMenuHtml.Append("</ul>"
' Insert the HTML code into the menu DIV tag
header.InnerHtml = strMenuHtml.ToString
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Use __doPostBack from Javascript
Check this article for more http://www.codeproject.com
anv
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim i As Integer
Dim ul As New HtmlGenericControl
ul.TagName = "ul"
Dim li As HtmlGenericControl
Dim a As LinkButton
For i = 0 To 10
li = New HtmlGenericControl
li.TagName = "li"
li.ID = "menuOption" & i
a = New LinkButton
a.Text = "button" & i
AddHandler a.Click, AddressOf someEvent
li.Controls.Add(a)
ul.Controls.Add(li)
Next
header.Controls.Add(ul)
End Sub
Private Sub someEvent(ByVal o As Object, ByVal e As EventArgs)
Dim a As LinkButton = o
Response.Write(a.Text)
End Sub
like sammy1971 said, u're thinking too much old school asp/php/whatever
think OOP, Objects bla bla
Business Accounts
Answer for Membership
by: sammy1971Posted on 2006-11-02 at 21:05:56ID: 17864277
EsdTeamster, la.com/art icles/0814 02-1.aspx
You are thinking asp not asp.net in your code
what you need to do is place a placeholder in your div and add the controls to the place holder as you build them
take a look here
http://aspnet.4guysfromrol
it should be a good place to start
Good Luck