This is a migrated thread and some comments may be shown as answers.

Text area inside Radgrid

1 Answer 215 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JJ
Top achievements
Rank 1
JJ asked on 31 Aug 2010, 08:54 PM
Text area in Radgrid.

I like to put an text area in radrgid as GridBoundColumn.

 

Have multiple rows and a long width.

How I do that?

I found the following code below, but somehow even it nevers shows it in Edit or Insert mode to the code never got triggered. Please help.

 

protected void rgTask_ItemDataBound(object sender, GridItemEventArgs e)

 

{

 

// in insert mode

 

 

 

 

 

 

if ((e.Item is GridEditFormInsertItem) && (e.Item.OwnerTableView.IsItemInserted))

 

{

 

GridEditFormInsertItem insertItem = (GridEditFormInsertItem)e.Item;

 

 

TextBox txtbx = (TextBox)insertItem["Task_Detail"].Controls[0];

 

txtbx.MaxLength = 500;

txtbx.Width = 800;

txtbx.TextMode=

TextBoxMode.MultiLine;

 

 

}

 

//in edit mode

 

 

 

 

 

 

if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode))

 

{

 

GridEditFormItem editItem = (GridEditFormItem)e.Item;

 

 

TextBox txtbx = (TextBox)editItem["Task_Detail"].Controls[0];

 

txtbx.MaxLength = 500;

txtbx.Width = 800;

txtbx.TextMode =

TextBoxMode.MultiLine;

 

 

}

 

 

}

Thanks!

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 01 Sep 2010, 06:00 AM
Hello Jessie,

I guess you are using 'InPlace' Edit mode of MasterTableView. If that the case, try the following code snippet and check whether it works.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
      //  insert mode
       if (e.Item is GridDataInsertItem && e.Item.OwnerTableView.IsItemInserted)
       {
           GridDataInsertItem insertItem = (GridDataInsertItem)e.Item;
           TextBox txtbx = (TextBox)insertItem["Task_Detail"].Controls[0];
           txtbx.MaxLength = 500;
           txtbx.Width = 800;
           txtbx.TextMode =
           TextBoxMode.MultiLine;
       }
     //  edit mode
       if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))
       {
           GridEditableItem editItem = (GridEditableItem)e.Item;
           TextBox txtbx = (TextBox)editItem["Task_Detail"].Controls[0];
           txtbx.MaxLength = 500;
           txtbx.Width = 800;
           txtbx.TextMode =
           TextBoxMode.MultiLine;
       }
   }

Thanks,
Princy.
Tags
Grid
Asked by
JJ
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or