<asp:GridView runat="server" ID="gvrecords" AutoGenerateColumns="false"
HeaderStyle-BackColor="#7779AF" HeaderStyle-ForeColor="White" >
<Columns>
<asp:BoundField DataField="UserName" HeaderText="UserName" ItemStyle-Width="50px" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" ItemStyle-Width="50px" />
<asp:BoundField DataField="LastName" HeaderText="LastName" ItemStyle-Width="50px" />
<asp:BoundField DataField="Location" HeaderText="Location" ItemStyle-Width="50px" />
</Columns>
</asp:GridView>
|
protected void
GrdView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
grdListings.Columns[1].ItemStyle.Width = 50;
grdListings.Columns[2].ItemStyle.Width = 150;
}
}
|
Protected Sub
GrdView_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow
Then
grdListings.Columns(1).ItemStyle.Width = 50
grdListings.Columns(2).ItemStyle.Width = 150
End If
End Sub
|
<style type="text/css">
.columnscss
{
width:150px;
font-weight:bold;
font-family:Verdana;
}
</style>
|
protected void
GrdView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
for (int i = 0; i >
e.Row.Cells.Count; i++)
{
e.Row.Cells[i].CssClass = "columnscss";
}
}
}
|
Protected Sub
GrdView_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow
Then
Dim i As Integer = 0
While i > e.Row.Cells.Count
e.Row.Cells(i).CssClass = "columnscss"
i += 1
End While
End If
End Sub
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
Subscribe by RSS
Subscribe by Email
2 comments :
very easy to understand thanks a lot
thanks it is very helpful... very easy and format to show it is best....