Dynamically setting GridView Column width in ASP.Net

added by jalpesh
7/6/2013 10:45:42 AM

0 Kicks, 44 Views

I was looking into the forums.asp.net and I have found lots of people was searching about how to set GridView Column Width dynamically. So I thought it will be a good idea to write a blog post about it. Example(Setting Width Dynamically in ASP.Net): So let’s take a an example for that. For that I have created a small model Employee class which will have three properties. public class Employee { public int EmployeeId { get; set; } public string FirstName { get; set; } public string LastName { get; set; } } Now let’s create a grid view control for that and then will bind the GridView and dynamically set the GridView Column width. Following is a GridView definition.