点击columns属性后,在模版中定义吧。

解决方案 »

  1.   

    TextBox不是也可以定义宽度的吗?
    如:
    <asp:TextBox id="TextBox1"  runat="server" Width="200px" />
      

  2.   

    设置其With值:
    e.Item.Cells[0].Width=100;
    DataGrid1.Width=200;
      

  3.   

    我的例子
    private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebC
    {
    TextBox a = (TextBox)e.Item.Cells[4].Controls[0];
    TextBox b = (TextBox)e.Item.Cells[5].Controls[0];
    TextBox c = (TextBox)e.Item.Cells[6].Controls[0];
    a.Width=10;
    b.Width=10;
    c.MaxLength = 50;
    a.MaxLength = 8;
    if (a.Text.Trim() != "")
    {
    if (CovertMoney(a.Text.Trim()) == false) 
    {
    ShowErrMsg("输入的收费金额错误,请检查!");
    return;
    }
    }
    if (c.Text.Trim() != "")
    {
    if (CovertDate(c.Text.Trim()) == false) 
    {
    ShowErrMsg("开票日期错误格式如2008-08-18 !");
    return;
    }
    }
      

  4.   

    '设置从第6列到结束列的宽度Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dtaObject.ItemDataBound
            If e.Item.ItemType = ListItemType.EditItem Then
                Dim i As Integer
                For i = 5 To e.Item.Cells.Count - 2
                        Dim t As TextBox = CType(e.Item.Cells(i).Controls(0), TextBox)
                        t.Width = Unit.Pixel(60)
                Next
            End If
    End Sub
      

  5.   

    把需要编辑的列转化为模板列显示,这样处于编辑状态下的宽度就是你在IDE中定义的宽度。.NET的这一点做的不太好,需要程序控制编辑列的宽度。
      

  6.   

    我是楼主,谢谢大家。除了上面大家说的是不是还要设置一个属性:style="TABLE-LAYOUT: fixed"还有怎么结贴啊?我好给分大家啊:)