private void field_DataBinding(Object sender, EventArgs e)
{
Control c = (Control)sender;
GridViewRow row = (GridViewRow)c.NamingContainer;
if (sender.GetType() == typeof(Label))
{
(c as Label).Text = DataBinder.Eval(row.DataItem, columnNameData).ToString();
(c as Label).Font.Size = 7;
(c as Label).Font.Name = "Arial";
}
else if (sender.GetType() == typeof(TextBox))
{
(c as TextBox).Text = DataBinder.Eval(row.DataItem, columnNameData).ToString();
(c as TextBox).Font.Size = 7;
(c as TextBox).Font.Name = "Arial";
}
else if (sender.GetType() == typeof(DropDownList))
{
(c as DropDownList).SelectedValue = DataBinder.Eval(row.DataItem, columnNameData).ToString();
(c as DropDownList).Font.Size = 7;
(c as DropDownList).Font.Name = "Arial";
}
else if (sender.GetType() == typeof(CheckBox))
{
(c as CheckBox).Checked = (bool)DataBinder.Eval(row.DataItem, columnNameData);
}
}