MSMVPS.COM
The Ultimate Destination for Blogs by Current and Former Microsoft Most Valuable Professionals.

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

Posted Apr 23 2004, 07:18 AM by Montaque

Comments

Montaque wrote re: Adjust the datagrid column with in edit mode
on 05-22-2004 10:52
Good Idea!!!
Montaque wrote re: Adjust the datagrid column with in edit mode
on 11-30-2004 0:13
great
Montaque wrote re: Adjust the datagrid column with in edit mode
on 12-17-2004 23:48
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 :-)
TrackBack wrote re:Adjust the datagrid column with in edit mode
on 04-16-2005 2:36
^_~

Add a Comment

(required)  
(optional)
(required)  
Remember Me?


Copyright © is the original authors. Blog site is an independent site not sponsored by Microsoft. The Yoda blog server and the Brianna SQL server would like to thank www.ownwebnow.com and www.exchangedefender.com. They wouldn't be here and broadcasting without the generosity of Vlad Mazek and his companies.

Powered by Community Server (Commercial Edition), by Telligent Systems