DataGrid列宽度设置
浏览状态下的列宽度可以这样设置:
Column.ItemStyle.Width = 100;
编辑状态下的列宽度可以这样设置:
private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
DataGridItem line = dbgCustomers.Items[e.Item.ItemIndex];
TextBox tb1 = (TextBox)line.Cells[0].Controls[0];
TextBox tb2 = (TextBox)line.Cells[1].Controls[0];
tb1.Width = Unit.Percentage(100);
tb2.Width = Unit.Percentage(100);
tb2.TextMode = TextBoxMode.MultiLine;
}
参见:
http://msmvps.com/montaque/posts/5353.aspx
Column.ItemStyle.Width = 100;
编辑状态下的列宽度可以这样设置:
private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
DataGridItem line = dbgCustomers.Items[e.Item.ItemIndex];
TextBox tb1 = (TextBox)line.Cells[0].Controls[0];
TextBox tb2 = (TextBox)line.Cells[1].Controls[0];
tb1.Width = Unit.Percentage(100);
tb2.Width = Unit.Percentage(100);
tb2.TextMode = TextBoxMode.MultiLine;
}
参见:
http://msmvps.com/montaque/posts/5353.aspx