|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Help please Creating web page of links and contenti'm looking to create an aspx page that is basically a FAQ page i'm not sure if this can be done, but would love some help with suggestions of how to do it another way if this is not possible on the aspx page i have a table with 1 row and 2 columns in it, in the column on the left i have an asp:label, lblLinks and in the column on the right i have another asp:label, lblBody i'm reading the content of the links and body from the database i'd like to be able to dynamically create the links, so i was creating them like this is a dataSet loop: "<a href="FAQ.aspx?section=" + drRow.Item("Section") + ">" + drRow.Item("Section") + "</a>" this isn't working because i'm not using frames, what i'd like to dois have an onClick of this link that calls a codebehind function that then fills the lblBody with the content read from the database. my main question is how i can dynamically create link and have them once clicked call the codebehind to fill another label with something else read from the database. thank you for any help one other thing i thought i of, but don't believe it will work, is to
create asp:LinkButton's instead of regular hyperlinks. but since these would be created on the fly in the codebehind, i wouldn't think that would be allowed because i assume the asp.net elements need to be already coded on the page so they can be registered when the page compiles? maybe i'm making a mountain out of a molehill :) thanks for any help Show quoteHide quote > >i'm reading the content of the links and body from the database >i'd like to be able to dynamically create the links, so i was creating >them like this is a dataSet loop: > "<a href="FAQ.aspx?section=" + drRow.Item("Section") + ">" + >drRow.Item("Section") + "</a>" > >this isn't working because i'm not using frames, what i'd like to do >is have an onClick of this link that calls a codebehind function that >then fills the lblBody with the content read from the database. I should probably have all my thought and attempts done before
replying, but i tried this and wanted to post what happened. code below does display the info i want (link names), but the links are not active, it is only text displayed Dim i As Integer i = 1 For Each drRow In copyDataSet.Tables(0).Rows lblLinks.Text = lblLinks.Text + _ "<asp:LinkButton id=LinkButton" + i.ToString() + " runat=server>" + drRow.Item("Section") + "</asp:LinkButton> <br>" i += 1Next when i look at the source (right-click, view source) the linkbuttons are created (or at least the correct text that would define a linkbutton), but it is just text, nothing active. so i'm assuming my theory of creating objects on the fly this way can't be done (at least the way i'm trying)? thanks, i'll wait to reply before filling up this thread myself :) appreciate any advice.... Show quoteHide quote >one other thing i thought i of, but don't believe it will work, is to >create asp:LinkButton's instead of regular hyperlinks. but since >these would be created on the fly in the codebehind, i wouldn't think >that would be allowed because i assume the asp.net elements need to be >already coded on the page so they can be registered when the page >compiles? >maybe i'm making a mountain out of a molehill :) thanks for any help > >> >>i'm reading the content of the links and body from the database >>i'd like to be able to dynamically create the links, so i was creating >>them like this is a dataSet loop: >> "<a href="FAQ.aspx?section=" + drRow.Item("Section") + ">" + >>drRow.Item("Section") + "</a>" >> >>this isn't working because i'm not using frames, what i'd like to do >>is have an onClick of this link that calls a codebehind function that >>then fills the lblBody with the content read from the database. Use the Repeater control.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnet-whenusedatawebcontrols.asp On postback, on the click event for an item, you'll be able to tell which item was clicked. SmartNavigation (if it's enabled) will allow you do what you want (show expanded information) without having it look like the user has reloaded the page. Show quoteHide quote "simon" <m*@here.com> wrote in message news:j7250252chqanl5c7atj6ai4dot8vsmpvq@4ax.com... >I should probably have all my thought and attempts done before > replying, but i tried this and wanted to post what happened. code > below does display the info i want (link names), but the links are not > active, it is only text displayed > > Dim i As Integer > i = 1 > For Each drRow In copyDataSet.Tables(0).Rows > lblLinks.Text = lblLinks.Text + _ > "<asp:LinkButton id=LinkButton" + i.ToString() + " > runat=server>" + drRow.Item("Section") + "</asp:LinkButton> <br>" > i += 1 > Next > > when i look at the source (right-click, view source) the linkbuttons > are created (or at least the correct text that would define a > linkbutton), but it is just text, nothing active. so i'm assuming my > theory of creating objects on the fly this way can't be done (at least > the way i'm trying)? > thanks, i'll wait to reply before filling up this thread myself :) > appreciate any advice.... > > >>one other thing i thought i of, but don't believe it will work, is to >>create asp:LinkButton's instead of regular hyperlinks. but since >>these would be created on the fly in the codebehind, i wouldn't think >>that would be allowed because i assume the asp.net elements need to be >>already coded on the page so they can be registered when the page >>compiles? >>maybe i'm making a mountain out of a molehill :) thanks for any help >> >>> >>>i'm reading the content of the links and body from the database >>>i'd like to be able to dynamically create the links, so i was creating >>>them like this is a dataSet loop: >>> "<a href="FAQ.aspx?section=" + drRow.Item("Section") + ">" + >>>drRow.Item("Section") + "</a>" >>> >>>this isn't working because i'm not using frames, what i'd like to do >>>is have an onClick of this link that calls a codebehind function that >>>then fills the lblBody with the content read from the database. >
Did we lose the RadioCheck property on menuitems
Webapplications quits without matter in ASP.NET 2.0 List.Add method overwriting collectionbase? The variable 'GroupBox1' is either undeclared or was never assigned. List all public properties of a Class ? Listbox controls i love reflection:) Ado.net to excel ? Perfomance test multi threading error |
|||||||||||||||||||||||