First, using a column name:
myDataRow["City"]= "London";
Or, using an index:
myDataRow[2] = "London";
Don't use ItemArray property to set values, it won't work.
Set Text Box Width in a GridView Bound Field:
Use ControlStyle properties:<asp:BoundField... ControlStyle-Width="60px"/>
Change GridViewRow Appearance:
There are different ways to change GridViewRow appearance. The approach I like involves using the GridViewRow Style property. On RowDataBound event use this:
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Style.Add("color", "#999999");
e.Row.Style.Add("font-weight", "bold");
...
}
Did you know that you could pass data format string as a parameter to the ToString() method?
For example:
e.Row.Cells[1].Text = iTotal.ToString("F2")
No comments:
Post a Comment