asp.net - Asp Hyperlink's attribute cannot be changed using code behind -
i newbie in asp.net. trying load text , url hyperlink database. after debugging, found out value loaded hyperlink control, doesn't shows @ html code? knows how happened? sorry bad english.
if myreader2.read dim temp_panel panel dim temp_hyperlink hyperlink temp_panel = findcontrolrecursive(me, "panel" & i.tostring()) temp_panel.cssclass = "accordionitem" temp_hyperlink = findcontrolrecursive(me, "hyperlink" & (i).tostring()) temp_hyperlink.text = myreader2("text") temp_hyperlink.navigateurl = myreader2("link") temp_hyperlink.cssclass = "accordionitem" temp_hyperlink.rendercontrol(o) myconn2.close() end if
above code-behind.
<asp:panel id="panel1" runat="server" class="accordioniteminvisible"><asp:hyperlink id="hyperlink1" runat="server" /></asp:panel> <asp:panel id="panel2" runat="server" class="accordioniteminvisible"><asp:hyperlink id="hyperlink2" runat="server" /></asp:panel> <asp:panel id="panel3" runat="server" class="accordioniteminvisible"><asp:hyperlink id="hyperlink3" runat="server" /></asp:panel>
above asp code.
<div id="ctl00_accordionpane1_content_panel1" class="accordioniteminvisible"> </div> <div id="ctl00_accordionpane1_content_panel2" class="accordioniteminvisible"> <a id="ctl00_accordionpane1_content_hyperlink2"></a> </div> <div id="ctl00_accordionpane1_content_panel3" class="accordioniteminvisible"> <a id="ctl00_accordionpane1_content_hyperlink3"></a> </div>
above html code.
edit: original poster answered own question marked 1 answer. op's solution:
the problem page master page. there hyperlinks same name in content page. therefore settings made on content page, not master page. after changing name of hyperlinks on master page works.
====================================================================
have tried debugging code? happens when reach
temp_hyperlink.text = myreader2("text")
what value of i
?
what value of myreader2("text")
?
do find link temp_hyperlink
?
edit: though there nothing in html, links show on page? what's value of url in reader? have tried using asp:linkbutton instead?
Comments
Post a Comment