Cannot dynamically assign a BackColor to a datalist

Cannot dynamically assign a BackColor to a datalist

am 16.04.2008 22:32:24 von ballz2wall

I need to dynamically assign a datalist attribute upon a helper
function receiving data from a querystring. If a user picks a certain
region, i need the datalist to display its back color, or any of its
other objects , as a certain color or css style





....doesnot work as a Parser error renders: Content (' BackColor=') does not match any properties within a
'System.Web.UI.WebControls.DataList', make sure it is well-formed

Re: Cannot dynamically assign a BackColor to a datalist

am 17.04.2008 02:39:57 von Mark Fitzpatrick

Do it programatically. You can access the property directly from code as
follows:
assume the name of the datalist is dl

dl.HeaderStyle.BackColor = Color.Red;

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

".Net Sports" wrote in message
news:1e75f9e9-a7b7-474d-9f12-21c4ba993277@i36g2000prf.google groups.com...
>I need to dynamically assign a datalist attribute upon a helper
> function receiving data from a querystring. If a user picks a certain
> region, i need the datalist to display its back color, or any of its
> other objects , as a certain color or css style
>
>
>
>
>
> ...doesnot work as a Parser error renders: Content (' > BackColor=') does not match any properties within a
> 'System.Web.UI.WebControls.DataList', make sure it is well-formed
>
>
>

Re: Cannot dynamically assign a BackColor to a datalist

am 17.04.2008 19:06:56 von ballz2wall

Thanks for your response. There is no code behind in these scripts/
programs I am using. Inside the Datalist form block, I have:

width="350px" ItemStyle-BackColor="#ccffcc" cellspacing="3">


Providers for
<%= sregionZ %>: <%= Zonecustom() %>
HeaderTemplate>
href="re.aspx?zone=<%#Server.UrlEncode(Request.QueryString("zone")) &
"&cregion=" & Server.UrlEncode(Request.QueryString("cregion")) &
"&category=" & (Eval("Category").ToString())%>">
<%# Eval("Category")%>



as you see, I can provide dynamic variables from helper functions in
the headers of my page to stuff inside the Header Template & the
ItemTemplate, but I need to dynamically also change the HeaderStyle
BackColor property here


TIA
..netsports

On Apr 16, 5:39 pm, "Mark Fitzpatrick" wrote:
> Do it programatically. You can access the property directly from code as
> follows:
> assume the name of the datalist is dl
>
> dl.HeaderStyle.BackColor = Color.Red;
>
> Hope this helps,
> Mark Fitzpatrick
> Microsoft MVP - Expression
>
> ".Net Sports" wrote in message
>
> news:1e75f9e9-a7b7-474d-9f12-21c4ba993277@i36g2000prf.google groups.com...
>
> >I need to dynamically assign a datalist attribute upon a helper
> > function receiving data from a querystring. If a user picks a certain
> > region, i need the datalist to display its back color, or any of its
> > other objects , as a certain color or css style
>
> >
>
> > ...doesnot work as a Parser error renders: Content (' > > BackColor=') does not match any properties within a
> > 'System.Web.UI.WebControls.DataList', make sure it is well-formed

Re: Cannot dynamically assign a BackColor to a datalist

am 18.04.2008 13:07:07 von wisccal

Hi,

I suggest you wrap your HeaderTemplate content in a div and
dynamically assign a style to that element. Something like:



Providers for <%= sregionZ %>: <%=
Zonecustom() %>




============
Regards,
Steve
www.stkomp.com

..Net Sports wrote:
> Thanks for your response. There is no code behind in these scripts/
> programs I am using. Inside the Datalist form block, I have:
>
> > width="350px" ItemStyle-BackColor="#ccffcc" cellspacing="3">
>
>
> Providers for
> <%= sregionZ %>: <%= Zonecustom() %>
> HeaderTemplate>
> > href="re.aspx?zone=<%#Server.UrlEncode(Request.QueryString("zone")) &
> "&cregion=" & Server.UrlEncode(Request.QueryString("cregion")) &
> "&category=" & (Eval("Category").ToString())%>">
> <%# Eval("Category")%>
>

>

>
> as you see, I can provide dynamic variables from helper functions in
> the headers of my page to stuff inside the Header Template & the
> ItemTemplate, but I need to dynamically also change the HeaderStyle
> BackColor property here
>
>
> TIA
> .netsports
>
> On Apr 16, 5:39 pm, "Mark Fitzpatrick" wrote:
> > Do it programatically. You can access the property directly from code as
> > follows:
> > assume the name of the datalist is dl
> >
> > dl.HeaderStyle.BackColor = Color.Red;
> >
> > Hope this helps,
> > Mark Fitzpatrick
> > Microsoft MVP - Expression
> >
> > ".Net Sports" wrote in message
> >
> > news:1e75f9e9-a7b7-474d-9f12-21c4ba993277@i36g2000prf.google groups.com...
> >
> > >I need to dynamically assign a datalist attribute upon a helper
> > > function receiving data from a querystring. If a user picks a certain
> > > region, i need the datalist to display its back color, or any of its
> > > other objects , as a certain color or css style
> >
> > >
> >
> > > ...doesnot work as a Parser error renders: Content (' > > > BackColor=') does not match any properties within a
> > > 'System.Web.UI.WebControls.DataList', make sure it is well-formed

Re: Cannot dynamically assign a BackColor to a datalist

am 18.04.2008 13:07:59 von wisccal

Hi,

I suggest you wrap your HeaderTemplate content in a div and
dynamically assign a style to that element. Something like:



Providers for <%= sregionZ %>: <%=
Zonecustom() %>




============
Regards,
Steve
www.stkomp.com

..Net Sports wrote:
> Thanks for your response. There is no code behind in these scripts/
> programs I am using. Inside the Datalist form block, I have:
>
> > width="350px" ItemStyle-BackColor="#ccffcc" cellspacing="3">
>
>
> Providers for
> <%= sregionZ %>: <%= Zonecustom() %>
> HeaderTemplate>
> > href="re.aspx?zone=<%#Server.UrlEncode(Request.QueryString("zone")) &
> "&cregion=" & Server.UrlEncode(Request.QueryString("cregion")) &
> "&category=" & (Eval("Category").ToString())%>">
> <%# Eval("Category")%>
>

>

>
> as you see, I can provide dynamic variables from helper functions in
> the headers of my page to stuff inside the Header Template & the
> ItemTemplate, but I need to dynamically also change the HeaderStyle
> BackColor property here
>
>
> TIA
> .netsports
>
> On Apr 16, 5:39 pm, "Mark Fitzpatrick" wrote:
> > Do it programatically. You can access the property directly from code as
> > follows:
> > assume the name of the datalist is dl
> >
> > dl.HeaderStyle.BackColor = Color.Red;
> >
> > Hope this helps,
> > Mark Fitzpatrick
> > Microsoft MVP - Expression
> >
> > ".Net Sports" wrote in message
> >
> > news:1e75f9e9-a7b7-474d-9f12-21c4ba993277@i36g2000prf.google groups.com...
> >
> > >I need to dynamically assign a datalist attribute upon a helper
> > > function receiving data from a querystring. If a user picks a certain
> > > region, i need the datalist to display its back color, or any of its
> > > other objects , as a certain color or css style
> >
> > >
> >
> > > ...doesnot work as a Parser error renders: Content (' > > > BackColor=') does not match any properties within a
> > > 'System.Web.UI.WebControls.DataList', make sure it is well-formed