By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,865 Members | 1,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,865 IT Pros & Developers. It's quick & easy.

Styling DIVs in an UpdatePanel

P: n/a
when I try to style a div using the id tag, from an external style sheet, it
is not recognized. If I change the style sheet id to a class, it is
recognized. Is this how styling a div within an update panel supposed to work?

Example:

HTML
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="myDiv" class="myDiv">whatever
</div>
</ContentTemplate>
</UpdatePanel>

This is not recognized in an update panel
#myDiv
{
border: solid 1px blue;
}

This is recognized in an update panel

..myDiv
{
border: solid 1px green;
}
Jun 27 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

see:

UpdatePanel and CSS
http://weblogs.asp.net/rajbk/archive...l-and-css.aspx

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:E5**********************************@microsof t.com...
when I try to style a div using the id tag, from an external style sheet,
it
is not recognized. If I change the style sheet id to a class, it is
recognized. Is this how styling a div within an update panel supposed to
work?

Example:

HTML
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="myDiv" class="myDiv">whatever
</div>
</ContentTemplate>
</UpdatePanel>

This is not recognized in an update panel
#myDiv
{
border: solid 1px blue;
}

This is recognized in an update panel

.myDiv
{
border: solid 1px green;
}

Jun 27 '08 #2

P: n/a
Thanks, but unless I missed something, that talks about styling an
updatepanel and I want to style the DIVs that are in my updatepanel.

"Teemu Keiski" wrote:
Hi,

see:

UpdatePanel and CSS
http://weblogs.asp.net/rajbk/archive...l-and-css.aspx

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:E5**********************************@microsof t.com...
when I try to style a div using the id tag, from an external style sheet,
it
is not recognized. If I change the style sheet id to a class, it is
recognized. Is this how styling a div within an update panel supposed to
work?

Example:

HTML
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="myDiv" class="myDiv">whatever
</div>
</ContentTemplate>
</UpdatePanel>

This is not recognized in an update panel
#myDiv
{
border: solid 1px blue;
}

This is recognized in an update panel

.myDiv
{
border: solid 1px green;
}


Jun 27 '08 #3

P: n/a
The ideas presented in the post apply pretty well here. For example if your
DIV would be a server-side control, getting the ClientID would work (in case
you use master pages etc which impact on the IDs rendered in the end), or
enclosing the content in another element which you can style at will.

I suppose using classes instead of IDs would be preferred anyways for that
reason (ASP.NET autogenerating IDs).

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:F4**********************************@microsof t.com...
Thanks, but unless I missed something, that talks about styling an
updatepanel and I want to style the DIVs that are in my updatepanel.

"Teemu Keiski" wrote:
>Hi,

see:

UpdatePanel and CSS
http://weblogs.asp.net/rajbk/archive...l-and-css.aspx

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:E5**********************************@microso ft.com...
when I try to style a div using the id tag, from an external style
sheet,
it
is not recognized. If I change the style sheet id to a class, it is
recognized. Is this how styling a div within an update panel supposed
to
work?

Example:

HTML
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="myDiv" class="myDiv">whatever
</div>
</ContentTemplate>
</UpdatePanel>

This is not recognized in an update panel
#myDiv
{
border: solid 1px blue;
}

This is recognized in an update panel

.myDiv
{
border: solid 1px green;
}



Jun 27 '08 #4

P: n/a
You're right...thanks!

"Teemu Keiski" wrote:
The ideas presented in the post apply pretty well here. For example if your
DIV would be a server-side control, getting the ClientID would work (in case
you use master pages etc which impact on the IDs rendered in the end), or
enclosing the content in another element which you can style at will.

I suppose using classes instead of IDs would be preferred anyways for that
reason (ASP.NET autogenerating IDs).

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:F4**********************************@microsof t.com...
Thanks, but unless I missed something, that talks about styling an
updatepanel and I want to style the DIVs that are in my updatepanel.

"Teemu Keiski" wrote:
Hi,

see:

UpdatePanel and CSS
http://weblogs.asp.net/rajbk/archive...l-and-css.aspx

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net
"Wannabe" <Wa*****@discussions.microsoft.comwrote in message
news:E5**********************************@microsof t.com...
when I try to style a div using the id tag, from an external style
sheet,
it
is not recognized. If I change the style sheet id to a class, it is
recognized. Is this how styling a div within an update panel supposed
to
work?

Example:

HTML
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="myDiv" class="myDiv">whatever
</div>
</ContentTemplate>
</UpdatePanel>

This is not recognized in an update panel
#myDiv
{
border: solid 1px blue;
}

This is recognized in an update panel

.myDiv
{
border: solid 1px green;
}


Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.