Click here to Skip to main content
12,295,252 members (55,300 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#3.0 C# ASP.NET .NET .NET4
I have created one grid view.following is the code
<asp:GridView ID="GridView1" runat="server" EnableModelValidation="True"
                ForeColor="#333333" GridLines="None" AutoGenerateColumns="False" CssClass="mGrid1"
                  >
                <AlternatingRowStyle BackColor="Silver" ForeColor="#284775" />
                <Columns>
                    <asp:TemplateField HeaderText="Select">
                        <ItemTemplate>
                            <asp:CheckBox ID="Mycheck" runat="server" />
                        </ItemTemplate>
                        <HeaderStyle BorderColor="White" BorderStyle="Solid" BorderWidth="2px" 
                            CssClass="bg" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ContactID" Visible="False">
                        <ItemTemplate>
                            <asp:Label ID="LblContactID" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "ContactID")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Name">
                        <ItemTemplate>
                            <asp:Label ID="LblContactName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "FirstName")%>'>
and took one stlesheet grid.css

.mGrid1
{
   
    font-family: tahoma;
    
    
}
 
.mGrid1 td   /* this applies to the Gridviews Data fileds */
{
    padding: 1px;
    text-align:center;
    width: 3%;
   
    border-collapse: collapse;
}
.mGrid1 th   /* this applies to the Gridviews Headers */
{
     padding: 0px 0px;
     border-width: 1px;
}
.bg
{
    background: #74ABD4;
}

now what i want first column first row header "select" should have less width as compared to other .i am unable to achieve this pls tell......
regards
Posted 10-Jan-13 23:36pm

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

i am getting my outlay correct ...what i was missing that i had a css class in master page which was overlapped by current tags
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160525.2 | Last Updated 14 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100