943,948 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 2181
  • ASP.NET RSS
Apr 17th, 2009
0

Manipulate asp:label through ul/li

Expand Post »
I am using Visual Studio 2008 developing a web app front-end for a T-SQL DB using asp.net and vb.net.

I have a label inside a list like so:

ASP.NET Syntax (Toggle Plain Text)
  1. <ul id="ul" class="class">
  2. <li id="li">
  3. <asp:Label runat="server" ID="label"></asp:Label>
  4. </li>
  5. </ul>

I cannot access the label directly in my code-behind file like I normally would. (Ex. label.text = "Something")

I'm assuming I need to use FindControl in some way, but I'm obviously having no success.

I guess that means my question is: How can I expose the label control so I can manipulate it with vb?

Thank you,
J'Tok
Last edited by J'Tok; Apr 17th, 2009 at 1:49 pm. Reason: Forgot code tags, and had minor spelling error.
Reputation Points: 22
Solved Threads: 0
Light Poster
J'Tok is offline Offline
39 posts
since Jan 2008
Apr 17th, 2009
1

Re: Manipulate asp:label through ul/li

in code, say the page_load event you could do:

ASP.NET Syntax (Toggle Plain Text)
  1. me.label.text = "Test Text"
Reputation Points: 22
Solved Threads: 9
Junior Poster
ninjaimp is offline Offline
129 posts
since Apr 2008
Apr 17th, 2009
1

Re: Manipulate asp:label through ul/li

Thanks ninjaimp! Worked perfectly.

- J'Tok
Reputation Points: 22
Solved Threads: 0
Light Poster
J'Tok is offline Offline
39 posts
since Jan 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: session
Next Thread in ASP.NET Forum Timeline: Web Server Path for Access DB





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC