ASP.NET: GridView Alter the Style of GridView Row, Column

Requirment:

  1. You have to change the Column into TemplateField
How to alter the style of the Row and Column:
  1. At first make the header row in Multi line as well One simplest example:
  2. Line1
    Line2
  3. Then in order the change the column field width set it inside tag
HTML:
        <asp:TemplateField HeaderText=”AdmissionNumber”
            SortExpression=”AdmissionNumber”>
            Admission
Number
            <EditItemTemplate>
                <asp:Label ID=”Label1″ runat=”server”Text=’<%# Eval(“AdmissionNumber”) %> 
                   ></asp:Label>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID=”Label1″ runat=”server”Text=’<%# Bind(“AdmissionNumber”) %>
                   Width=”30px”Height=”19px”BackColor=”#FFCCFF”></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s