AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 Simple Insert, Select, Edit, Update and Delete in Asp.Net GridView control
Posted by C.Y.Law on  10/18/2007 8:16:36 AM Category: ADO.NET
Add to my favorites
Email to friend
I try to change the width of the column using:
for (int i = 0; i < GridView1.Columns.Count; i++)
{
GridView1.Columns[i].ItemStyle.Width = myWidth;
}

or using properly in design. Both are not work. Do you have any suggestion?

Chris

Post Your Reply Post New Question

 Viewer's Reply
Make MyWidth as Integer
Answered By Moderator1 on 10/22/2007 3:59:27 AM
Hi,

We have tried your problem. It worked for us in the following way.

for (int i = 0; i < GridView1.Columns.Count; i++)
GridView1.Columns[i].ItemStyle.Width = 300;

GridView1.DataSource = cus.FetchAllCustomers();
GridView1.DataBind();

Make sure your 'myWidth' is as Integer.

Thanks
 
For Your Information
Answered By Moderator1 on 10/22/2007 4:02:50 AM
We found out ONE more thing. The code you used did not function, when you set the AutoGenerateColumns To True.

It will work only if you change AutoGenerateColumns as False.
Thanks
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Simply SQL - Free 111 Page Preview!
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Many .NET teams are underperforming, is yours?