![]() |
|
|
|||||||
![]() |
ASP Net - DatagGrid Cascade Style Sheet CSS |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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 <asp Dathan Dathan |
|
|
|
#3 |
|
Posts: n/a
|
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 > <asp > > Dathan- Hide quoted text - > > - Show quoted text - ABHIJIT B |
|