Hello,
I have UnBound GridView - C# ASP.Net and I am refreshing this by query.
I have below code -
SqlDataAdapter adp = new SqlDataAdapter("Select Entry_Date, Emp_Name, Qunatity, Comments From Activity_Master", SqlCon);
System.Data.DataTable dt = new System.Data.DataTable();
adp.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
I want to set Column width = 50 of "Comments" column and want Warp.
GridView1.Columns[3].ItemStyle.Width = 50;
GridView1.Columns[3].ItemStyle.Wrap = true;
This gives me below error.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
How do resolve this. Please help.