Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Styling DIVs in an UpdatePanel (http://www.velocityreviews.com/forums/t622012-styling-divs-in-an-updatepanel.html)

Wannabe 06-24-2008 03:25 PM

Styling DIVs in an UpdatePanel
 
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;
}

Teemu Keiski 06-24-2008 06:48 PM

Re: Styling DIVs in an UpdatePanel
 
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" <Wannabe@discussions.microsoft.com> wrote in message
news:E51897F0-B438-4ABB-A7FE-1BC50C5069E7@microsoft.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;
> }




Wannabe 06-24-2008 06:57 PM

Re: Styling DIVs in an UpdatePanel
 
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" <Wannabe@discussions.microsoft.com> wrote in message
> news:E51897F0-B438-4ABB-A7FE-1BC50C5069E7@microsoft.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;
> > }

>
>
>


Teemu Keiski 06-24-2008 07:26 PM

Re: Styling DIVs in an UpdatePanel
 
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" <Wannabe@discussions.microsoft.com> wrote in message
news:F4E9775B-33AF-4697-9D21-BFF3D796DE6B@microsoft.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" <Wannabe@discussions.microsoft.com> wrote in message
>> news:E51897F0-B438-4ABB-A7FE-1BC50C5069E7@microsoft.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;
>> > }

>>
>>
>>




Wannabe 06-24-2008 07:36 PM

Re: Styling DIVs in an UpdatePanel
 
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" <Wannabe@discussions.microsoft.com> wrote in message
> news:F4E9775B-33AF-4697-9D21-BFF3D796DE6B@microsoft.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" <Wannabe@discussions.microsoft.com> wrote in message
> >> news:E51897F0-B438-4ABB-A7FE-1BC50C5069E7@microsoft.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;
> >> > }
> >>
> >>
> >>

>
>
>



All times are GMT. The time now is 08:45 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.