Reputation: 215
why i cannot adding css Content Page in Master Page Asp.Net. i cannot change..
<asp:TextBox ID="name" runat="server"></asp:TextBox>
then i use css
#name {
width:300px;
height: 300px;
}
but he did not change. anyone can help me resolve this?
Upvotes: 1
Views: 75
Reputation: 3219
You have to use this CSS using Class because When Server control render in page then Their ID is Unique that generate by IIS foloowd by contant page Holder Name
means
<asp:TextBox ID="name" runat="server"></asp:TextBox>
this will genrate
<input id="ContantPlaceholderName_name" name="ContantPlaceholderName_name"/>
so use class name is better option
Upvotes: 1
Reputation: 9224
By default server object ID's aren't rendered exactly the same. You should either use a class instead or set clientidmode
to static
for the textbox.
If you view the source on the rendered page and look for that textbox, you'll find the ID is probably a few names separated by an underscore.
Here is the same markup with a static client id.
<asp:TextBox ID="name" runat="server" ClientIDMode="static"></asp:TextBox>
Please note that you shouldn't do this for any control that you plan to repeat on a page.
In that case you should use a class.
Upvotes: 2