Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
i have one grid in this multiple column i.e.country,city,song name and download...
but this grid is left side of page nd i want to display error message in right side of gridview but my grid width is too much big bcz of song name (column )is big so that msg display in below of grid so how i can manage width of that column???or how to reduce that column width???
please help me....
thanks in advance
Posted 8-Dec-12 0:24am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
Try this
 
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
GridView1.Columns[2].ItemStyle.Width =300;
GridView1.Columns[2].ItemStyle.Wrap = false;
}
}
 
(or)
 
for button click
 
for (int i = 0; i < GridView1.Columns.Count; i++)
{
GridView1.Columns[i].ItemStyle.Width = 300;
GridView1.Columns[i].ItemStyle.Wrap = false;
}
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

In the Source on the page you can go in BoundField column and change its size right there.
example:
<asp:BoundField HeaderText="City"; DataField="VARCHARCITY"; ItemStyle-HorizontalAlign="Center" ItemStyle-Width="250px"/>
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 330
1 Sergey Alexandrovich Kryukov 295
2 ClimerChinna 207
3 Magic Wonder 205
4 Gihan Liyanage 192
0 Sergey Alexandrovich Kryukov 8,188
1 OriginalGriff 6,991
2 CPallini 2,598
3 Richard MacCutchan 1,925
4 Abhinav S 1,736


Advertise | Privacy | Mobile
Web04 | 2.8.140826.1 | Last Updated 12 Dec 2012
Copyright © CodeProject, 1999-2014
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