|
 |
aspx thread: Applying Stylesheet characteristics to a datagrid
Message #1 by "Hugh McLaughlin" <hugh@k...> on Tue, 12 Mar 2002 18:28:15
|
|
Hello everyone and thanks for your help in advance. I have an application
that has a stylesheet called "MyStyleSheet.css". Witht eh stylesheet is
an element called "NavBar" that has certain font characteristics. I have
developed a control called NavBar.ascx that queries a database and builds
the navigation bar in the form of a datagrid based on the returned
dataset. I want to be able to format the datagrid based on the NavBar
element of the stylesheet, but can't seem to get it to work. I tried:
TableItemStyle="NavBar"
But that didn't work. Any help would be greatly appreciated. Thanks.
Message #2 by Andrew Steiger <andrewsteiger@y...> on Tue, 12 Mar 2002 10:26:57 -0800 (PST)
|
|
--0-1850511138-1015957617=:1959
Content-Type: text/plain; charset=us-ascii
If you create a TD.Navbar that should work.
Hugh McLaughlin <hugh@k...> wrote: Hello everyone and thanks for your help in advance. I have an application
that has a stylesheet called "MyStyleSheet.css". Witht eh stylesheet is
an element called "NavBar" that has certain font characteristics. I have
developed a control called NavBar.ascx that queries a database and builds
the navigation bar in the form of a datagrid based on the returned
dataset. I want to be able to format the datagrid based on the NavBar
element of the stylesheet, but can't seem to get it to work. I tried:
TableItemStyle="NavBar"
But that didn't work. Any help would be greatly appreciated. Thanks.
---------------------------------
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
Message #3 by Shannon Stewart <sstewart_59102@y...> on Tue, 12 Mar 2002 11:32:47 -0800 (PST)
|
|
What I have done to accomplish this was define a style
like this inside my control.
<style type="Text/css">
.customMsg { color: Yellow; font-weight: bold}
</style>
This could be defined in a seperate stylesheet if
needed. Then, inside my control I set the class to
the style I want.
<asp:label id="CustomMsg"
class="customMsg" />
This should work for what you want to do.
sstewart
--- Hugh McLaughlin <hugh@k...> wrote:
> Hello everyone and thanks for your help in advance.
> I have an application
> that has a stylesheet called "MyStyleSheet.css".
> Witht eh stylesheet is
> an element called "NavBar" that has certain font
> characteristics. I have
> developed a control called NavBar.ascx that queries
> a database and builds
> the navigation bar in the form of a datagrid based
> on the returned
> dataset. I want to be able to format the datagrid
> based on the NavBar
> element of the stylesheet, but can't seem to get it
> to work. I tried:
>
> TableItemStyle="NavBar"
>
> But that didn't work. Any help would be greatly
> appreciated. Thanks.
$subst('Email.Unsub').
__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
Message #4 by Imar Spaanjaars <Imar@S...> on Tue, 12 Mar 2002 21:14:09 +0100
|
|
For simple elements this may work. But what to do when you need finer
control over individuals cells / elements.
For example, up until now I have used MS behaviors to assign certain
behavior to for instance a table. By adding a
style="behavior:url('sort.htc');" to a table tag, I got some custom client
side sorting for free.
As Hugh pointed out, it seems impossible to assign classes or styles to
HTML output of the datagrid.
Any suggestions?
Imar
At 11:32 AM 3/12/2002 -0800, you wrote:
>What I have done to accomplish this was define a style
>like this inside my control.
>
><style type="Text/css">
>.customMsg { color: Yellow; font-weight: bold}
></style>
>
>This could be defined in a seperate stylesheet if
>needed. Then, inside my control I set the class to
>the style I want.
>
><asp:label id="CustomMsg"
> class="customMsg" />
>
>This should work for what you want to do.
>
>sstewart
>
>--- Hugh McLaughlin <hugh@k...> wrote:
> > Hello everyone and thanks for your help in advance.
> > I have an application
> > that has a stylesheet called "MyStyleSheet.css".
> > Witht eh stylesheet is
> > an element called "NavBar" that has certain font
> > characteristics. I have
> > developed a control called NavBar.ascx that queries
> > a database and builds
> > the navigation bar in the form of a datagrid based
> > on the returned
> > dataset. I want to be able to format the datagrid
> > based on the NavBar
> > element of the stylesheet, but can't seem to get it
> > to work. I tried:
> >
> > TableItemStyle="NavBar"
> >
> > But that didn't work. Any help would be greatly
> > appreciated. Thanks.
Message #5 by "Goh Mingkun" <mangokun@h...> on Wed, 13 Mar 2002 06:29:22
|
|
If it is really impossible to customize the styles of a DataGrid, y not u
use a DataList instead.
You just have to define the ItemTemplate for the DataList, which should be
able to make use of your stylesheet.
ItemTemplate can have something like this:
<ItemTemplate>
<TR>
<TD class="col1style"><%# DataBinder.Eval(Container.DataItem, "Name") %
></TD>
<TD class="col2style"><%# DataBinder.Eval(Container.DataItem, "Type") %
></TD>
<TD class="col3style"><%# DataBinder.Eval(Container.DataItem, "Location") %
></TD>
</TR>
</ItemTemplate>
|
|
 |