Montaque

Nothing is impossible for MS .NET

Adjust the datagrid column with in edit mode

 void MyGrid_Edit(object sender, DataGridCommandEventArgs e) {
      MyGrid.EditItemIndex = e.Item.ItemIndex;
      BindMyGrid();

      DataGridItem line = MyGrid.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;
    }

refer: http://www.atmarkit.co.jp/fdotnet/dotnettips/082wideedit/wideedit.html

Comments

Montaque said:

Good Idea!!!
# May 22, 2004 10:52 AM

Montaque said:

great
# November 30, 2004 12:13 AM

Montaque said:

Very good! Smart way to the purpose. I've seen a lot other solution, much complicated than this one.

Since I can read Japanese, I viewed the source code and noticed that we don't have to use itemtemplate, instead just use regular boundcolumn, that's it. Btw you also be able to apply your own css class for that editable textbox :-)
# December 17, 2004 11:48 PM

TrackBack said:

^_~
# April 16, 2005 2:36 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)