Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

DatagGrid  Cascade Style Sheet CSS

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ABHIJIT B - 06 Feb 2008 15:57 GMT
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_PageIndexChanging"
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
Dathan - 06 Feb 2008 17:49 GMT
> Hi,
>
[quoted text clipped - 80 lines]
> Regards,
> Abhijit B

Hi,

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

Dathan
ABHIJIT B - 06 Feb 2008 20:00 GMT
Hi Datahn,

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

> > Hi,
>
[quoted text clipped - 89 lines]
>
> - Show quoted text -

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.