Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - DatagGrid Cascade Style Sheet CSS

 
Thread Tools Search this Thread
Old 02-06-2008, 03:57 PM   #1
Default DatagGrid Cascade Style Sheet CSS


Hi,

I want to use CSS StyleSheet for datagrid in my web page.
The code is given below,

ASPX code:

<asp:datagrid id="grdReport" runat="server" Width="720px"
BackColor="White"
AutoGenerateColumns="False"
CellPadding="4" Height="22px" BorderWidth="1px" BorderStyle="None"
BorderColor="#CC9966" PageSize="5">
<SelectedItemStyle
BackColor="InactiveCaptionText" ForeColor="Black" />
<Columns>
<asp:TemplateColumn
HeaderText="Select">
<ItemTemplate>
<asp:RadioButton
id="rdbSelect" runat="server" AutoPostBack="True"
OnCheckedChanged="SelectOnlyOne"></asp:RadioButton>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn
DataField="LoginName" SortExpression="LoginName"
HeaderText="LoginName"></asp:BoundColumn>
<asp:BoundColumn
DataField="FirstName" SortExpression="FirstName"
HeaderText="FirstName"></asp:BoundColumn>
<asp:BoundColumn
DataField="LastName" SortExpression="LastName" HeaderText="LastName"></
asp:BoundColumn>
</Columns>
<ItemStyle BorderColor="Black"
ForeColor="Black" />
<HeaderStyle BorderColor="Black"
ForeColor="Black" />
</asp:datagrid>
-----------------------------------------------------
I used CSS for GridView as given below,

<asp:GridView ID="gvSearchUsersList" runat="server" TabIndex="5"
PageSize="5" AllowPaging="True" AutoGenerateColumns="False"
OnPageIndexChanging="gvSearchUsersList_PageIndexCh anging"
AllowSorting="True" GridLines="None" Width="717px"
ForeColor="#333333">
<Columns>
<asp:TemplateField
HeaderText="Select">

<ItemTemplate>
<asp:CheckBox ID="chkSelect"
AutoPostBack="true" runat="server"
OnCheckedChanged="chkSelect_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="LoginID"
HeaderText="Login Name" />
<asp:BoundField DataField="FirstName"
HeaderText="First Name" />
<asp:BoundField DataField="LastName"
HeaderText="Last Name" />
</Columns>
<PagerSettings
Mode="NextPreviousFirstLast" />
<RowStyle CssClass="row-1"
HorizontalAlign="Center" />
<SelectedRowStyle
BackColor="InactiveCaptionText" ForeColor="Black" BorderStyle="Solid"
BorderWidth="1px" HorizontalAlign="Center" VerticalAlign="Middle" />
<PagerStyle BackColor="#2461BF"
ForeColor="White" HorizontalAlign="Center" VerticalAlign="Middle"/>
<HeaderStyle BackColor="#507CD1" Font-
Bold="True" ForeColor="Black" />
<AlternatingRowStyle CssClass="row-2"
BackColor="LightGray" />
</asp:GridView>

I am not able to use same way for datagrid.

Kindly help me out.

Regards,
Abhijit B



ABHIJIT B
  Reply With Quote
Old 02-06-2008, 05:49 PM   #2
Dathan
 
Posts: n/a
Default Re: DatagGrid Cascade Style Sheet CSS
On Feb 6, 7:57*am, ABHIJIT B <abhijitbavdhan...@gmail.com> wrote:
> Hi,
>
> I want to use CSS StyleSheet for datagrid in my web page.
> The code is given below,
>
> ASPX code:
>
> <asp:datagrid id="grdReport" runat="server" Width="720px"
> BackColor="White"
> * * * * * * * * * * * * * * * * AutoGenerateColumns="False"
> CellPadding="4" Height="22px" BorderWidth="1px" BorderStyle="None"
> BorderColor="#CC9966" PageSize="5">
> * * * * * * * * * * * * * * * * <SelectedItemStyle
> BackColor="InactiveCaptionText" ForeColor="Black" />
> * * * * * * * * * * * * * * * * <Columns>
> * * * * * * * * * * * * * * * * * * <asp:TemplateColumn
> HeaderText="Select">
> * * * * * * * * * * * * * * * * * * <ItemTemplate>
> * * * * * * * * * * * * * * * * * * * * <asp:RadioButton
> id="rdbSelect" runat="server" AutoPostBack="True"
> OnCheckedChanged="SelectOnlyOne"></asp:RadioButton>
> * * * * * * * * * * * * * * * * * * </ItemTemplate>
> * * * * * * * * * * * * * * * * * * </asp:TemplateColumn>
> * * * * * * * * * * * * * * * * * * <asp:BoundColumn
> DataField="LoginName" SortExpression="LoginName"
> HeaderText="LoginName"></asp:BoundColumn>
> * * * * * * * * * * * * * * * * * * <asp:BoundColumn
> DataField="FirstName" SortExpression="FirstName"
> HeaderText="FirstName"></asp:BoundColumn>
> * * * * * * * * * * * * * * * * * * <asp:BoundColumn
> DataField="LastName" SortExpression="LastName" HeaderText="LastName"></
> asp:BoundColumn>
> * * * * * * * * * * * * * * * * </Columns>
> * * * * * * * * * * * * * * * * <ItemStyle BorderColor="Black"
> ForeColor="Black" />
> * * * * * * * * * * * * * * * * <HeaderStyle BorderColor="Black"
> ForeColor="Black" />
> * * * * * * * * * * </asp:datagrid>
> -----------------------------------------------------
> I used CSS for GridView as given below,
>
> *<asp:GridView ID="gvSearchUsersList" runat="server" TabIndex="5"
> PageSize="5" AllowPaging="True" AutoGenerateColumns="False"
> OnPageIndexChanging="gvSearchUsersList_PageIndexCh anging"
> AllowSorting="True" GridLines="None" Width="717px"
> ForeColor="#333333">
> * * * * * * * * * * * * * * <Columns>
> * * * * * * * * * * * * * * * * <asp:TemplateField
> HeaderText="Select">
>
> <ItemTemplate>
> * * * * * * * * * * * * * * * * * * * * <asp:CheckBox ID="chkSelect"
> AutoPostBack="true" runat="server"
> OnCheckedChanged="chkSelect_CheckedChanged" />
> * * * * * * * * * * * * * * * * * * </ItemTemplate>
> * * * * * * * * * * * * * * * * </asp:TemplateField>
> * * * * * * * * * * * * * * * * <asp:BoundField DataField="LoginID"
> HeaderText="Login Name" />
> * * * * * * * * * * * * * * * * <asp:BoundField DataField="FirstName"
> HeaderText="First Name" />
> * * * * * * * * * * * * * * * * <asp:BoundField DataField="LastName"
> HeaderText="Last Name" />
> * * * * * * * * * * * * * * </Columns>
> * * * * * * * * * * * * * * * * <PagerSettings
> Mode="NextPreviousFirstLast" />
> * * * * * * * * * * * * * * * * <RowStyle CssClass="row-1"
> HorizontalAlign="Center" />
> * * * * * * * * * * * * * * * * <SelectedRowStyle
> BackColor="InactiveCaptionText" ForeColor="Black" BorderStyle="Solid"
> BorderWidth="1px" HorizontalAlign="Center" VerticalAlign="Middle" />
> * * * * * * * * * * * * * * * * <PagerStyle BackColor="#2461BF"
> ForeColor="White" HorizontalAlign="Center" VerticalAlign="Middle"/>
> * * * * * * * * * * * * * * * * <HeaderStyle BackColor="#507CD1" Font-
> Bold="True" ForeColor="Black" />
> * * * * * * * * * * * * * * * * <AlternatingRowStyle CssClass="row-2"
> BackColor="LightGray" />
> * * * * * * * * * * * * </asp:GridView>
>
> I am not able to use same way for datagrid.
>
> Kindly help me out.
>
> Regards,
> Abhijit B


Hi,

Have you though about using the CssClass attribute? For example
<aspataGrid blah=whatever CssClass="eventsGrid"/>...

Dathan


Dathan
  Reply With Quote
Old 02-06-2008, 08:00 PM   #3
ABHIJIT B
 
Posts: n/a
Default Re: DatagGrid Cascade Style Sheet CSS
Hi Datahn,

Thanks for reply.I use CSSClass attribute to solve issue.


On Feb 6, 12:49*pm, Dathan <Datha...@gmail.com> wrote:
> On Feb 6, 7:57*am, ABHIJIT B <abhijitbavdhan...@gmail.com> wrote:
>
>
>
>
>
> > Hi,

>
> > I want to use CSS StyleSheet for datagrid in my web page.
> > The code is given below,

>
> > ASPX code:

>
> > <asp:datagrid id="grdReport" runat="server" Width="720px"
> > BackColor="White"
> > * * * * * * * * * * * * * * * * AutoGenerateColumns="False"
> > CellPadding="4" Height="22px" BorderWidth="1px" BorderStyle="None"
> > BorderColor="#CC9966" PageSize="5">
> > * * * * * * * * * * * * * * * * <SelectedItemStyle
> > BackColor="InactiveCaptionText" ForeColor="Black" />
> > * * * * * * * * * * * * * * * * <Columns>
> > * * * * * * * * * * * * * * * * * * <asp:TemplateColumn
> > HeaderText="Select">
> > * * * * * * * * * * * * * * * * * * <ItemTemplate>
> > * * * * * * * * * * * * * * * * * * * * <asp:RadioButton
> > id="rdbSelect" runat="server" AutoPostBack="True"
> > OnCheckedChanged="SelectOnlyOne"></asp:RadioButton>
> > * * * * * * * * * * * * * * * * * * </ItemTemplate>
> > * * * * * * * * * * * * * * * * * * </asp:TemplateColumn>
> > * * * * * * * * * * * * * * * * * * <asp:BoundColumn
> > DataField="LoginName" SortExpression="LoginName"
> > HeaderText="LoginName"></asp:BoundColumn>
> > * * * * * * * * * * * * * * * * * * <asp:BoundColumn
> > DataField="FirstName" SortExpression="FirstName"
> > HeaderText="FirstName"></asp:BoundColumn>
> > * * * * * * * * * * * * * * * * * * <asp:BoundColumn
> > DataField="LastName" SortExpression="LastName" HeaderText="LastName"></
> > asp:BoundColumn>
> > * * * * * * * * * * * * * * * * </Columns>
> > * * * * * * * * * * * * * * * * <ItemStyle BorderColor="Black"
> > ForeColor="Black" />
> > * * * * * * * * * * * * * * * * <HeaderStyle BorderColor="Black"
> > ForeColor="Black" />
> > * * * * * * * * * * </asp:datagrid>
> > -----------------------------------------------------
> > I used CSS for GridView as given below,

>
> > *<asp:GridView ID="gvSearchUsersList" runat="server" TabIndex="5"
> > PageSize="5" AllowPaging="True" AutoGenerateColumns="False"
> > OnPageIndexChanging="gvSearchUsersList_PageIndexCh anging"
> > AllowSorting="True" GridLines="None" Width="717px"
> > ForeColor="#333333">
> > * * * * * * * * * * * * * * <Columns>
> > * * * * * * * * * * * * * * * * <asp:TemplateField
> > HeaderText="Select">

>
> > <ItemTemplate>
> > * * * * * * * * * * * * * * * * * * * * <asp:CheckBox ID="chkSelect"
> > AutoPostBack="true" runat="server"
> > OnCheckedChanged="chkSelect_CheckedChanged" />
> > * * * * * * * * * * * * * * * * * * </ItemTemplate>
> > * * * * * * * * * * * * * * * * </asp:TemplateField>
> > * * * * * * * * * * * * * * * * <asp:BoundField DataField="LoginID"
> > HeaderText="Login Name" />
> > * * * * * * * * * * * * * * * * <asp:BoundField DataField="FirstName"
> > HeaderText="First Name" />
> > * * * * * * * * * * * * * * * * <asp:BoundField DataField="LastName"
> > HeaderText="Last Name" />
> > * * * * * * * * * * * * * * </Columns>
> > * * * * * * * * * * * * * * * * <PagerSettings
> > Mode="NextPreviousFirstLast" />
> > * * * * * * * * * * * * * * * * <RowStyle CssClass="row-1"
> > HorizontalAlign="Center" />
> > * * * * * * * * * * * * * * * * <SelectedRowStyle
> > BackColor="InactiveCaptionText" ForeColor="Black" BorderStyle="Solid"
> > BorderWidth="1px" HorizontalAlign="Center" VerticalAlign="Middle" />
> > * * * * * * * * * * * * * * * * <PagerStyle BackColor="#2461BF"
> > ForeColor="White" HorizontalAlign="Center" VerticalAlign="Middle"/>
> > * * * * * * * * * * * * * * * * <HeaderStyle BackColor="#507CD1" Font-
> > Bold="True" ForeColor="Black" />
> > * * * * * * * * * * * * * * * * <AlternatingRowStyle CssClass="row-2"
> > BackColor="LightGray" />
> > * * * * * * * * * * * * </asp:GridView>

>
> > I am not able to use same way for datagrid.

>
> > Kindly help me out.

>
> > Regards,
> > Abhijit B

>
> Hi,
>
> Have you though about using the CssClass attribute? For example
> <aspataGrid blah=whatever CssClass="eventsGrid"/>...
>
> Dathan- Hide quoted text -
>
> - Show quoted text -




ABHIJIT B
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46