Text area inside Radgrid

2 posts, 0 answers
  1. JJ
    JJ avatar
    147 posts
    Member since:
    May 2010

    Posted 31 Aug 2010 Link to this post

    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!

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Sep 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top