Maintaining "id" attribute value in server controls

M

markarichman

Because of my CSS selectors, I need to maintain the "id" attribute's
value for a server control. The control is as follows:

<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="NavControl.ascx.cs" Inherits="NavControl" %>
<ul id="nav" runat="server">
<li>...</li>
<li>...</li>
<li>...</li>
</ul>

Upon rendering, the value of <ul id="nav"> becomes <ul
id="ctl00_NavControl1_nav">. Setting nav.ID in code-behind has no
effect. How do I maintain the value of the "id" attribute in the
browser so my CSS works?
 
S

Shane

I don't have the specific answer for you, but I have had to use the
"ClientID" property recently to write some javascript at the server and
access a server based control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top