Simple: Edit Mode control too small

4 posts, 2 answers
  1. DoomerDGR8
    DoomerDGR8 avatar
    133 posts
    Member since:
    Aug 2010

    Posted 15 Dec 2010 Link to this post

    I have this simple case where I'm using a simple automatic editing functionality of the RadGrid but the only filed that is allowed in edit mode is more like a memo and I need it's height and width expanded. I'm not using any templates here. Kindly see attached screen.

    <asp:Panel runat="server" ID="PanelGrid" Width="630px">
      <fieldset id="fieldGrid" style="width: 608px;">
        <legend>Notes History</legend>
        <telerik:RadGrid ID="RadGridJobs2" runat="server" AutoGenerateColumns="False" AllowPaging="True" GridLines="None"
          Width="608px" Skin="Office2007" SkinID="RadGrid_Paging_Page20_NoExport_Add" AllowAutomaticDeletes="false"
          AllowAutomaticInserts="True" DataSourceID="LinqDataSourceNotes" OnUpdateCommand="RadGridJobs2_UpdateCommand">
          <MasterTableView DataKeyNames="OID" DataSourceID="LinqDataSourceNotes" GridLines="None" CommandItemDisplay="Top">
              <telerik:GridBoundColumn DataField="NoteDetails" HeaderText="Note" SortExpression="NoteDetails" UniqueName="columnNoteDetails"
                Visible="false" />
              <telerik:GridTemplateColumn UniqueName="columnNewNote" HeaderText="Note History">
                  <table cellspacing="0" cellpadding="0" width="100%" border="0" class="TableNoBorders">
                        <%# "<div><span style='font-weight: bold; '>By </span><span style='font-style: italic; '>" + Eval("User.FirstName") + " " + Eval("User.LastName") + "</span><span style='font-weight: bold; '> on </span><span style='font-style: italic; '>" + Eval("NoteDate", "{0:dd-MMM-yyyy hh:mm tt}") + "</span></div>"%>
                        <%# "<div style='font-weight: bold; '>Note: </div>" + Eval("NoteDetails")%>
              <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderStyle-Width="10px" ItemStyle-Width="10px" />
              <telerik:GridClientDeleteColumn ButtonType="ImageButton" HeaderStyle-Width="10px" ItemStyle-Width="10px"
                Visible="false" />
            <CommandItemSettings AddNewRecordText="New Note" />
              <EditColumn ButtonType="ImageButton" />

    protected void RadGridJobs2_UpdateCommand(object source, GridCommandEventArgs e) {
      var editableItem = ((GridEditableItem)e.Item);
      var editNoteID = (long)editableItem.GetDataKeyValue("OID");
      //retrieve entity form the Db
      var editNote = DbContext.Notes.Where(nut => nut.OID == editNoteID).FirstOrDefault();
      if (editNote != null) {
        try {
          //update entity's state
          //submit changes to Db
        } catch (Exception ex) {
  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Dec 2010 Link to this post

    Hello Hassan,

    You can set the Multiline property to the TextBox as shown below.

    protected void RadGridJobs2_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
           if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
               GridEditFormItem editItem = (GridEditFormItem)e.Item;
               TextBox textBox = (TextBox)editItem["columnNoteDetails"].Controls[0];
               textBox.TextMode = TextBoxMode.MultiLine;

  3. DoomerDGR8
    DoomerDGR8 avatar
    133 posts
    Member since:
    Aug 2010

    Posted 20 Dec 2010 Link to this post

    Excellent. One more thing: If I wanted a RTF or a WYSIWYG editor instead? What will be the required changes then? Do I need to update the SQL Server Datatype for the mapped column too + the HTML and Code behind changes?
  4. Answer
    Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 23 Dec 2010 Link to this post

    Hi Hassan,

    You can try using GridHTMLEditorColumn instead of GridBoundColumn.
    However if you want to use another editor, try placing it in the EditItemTemplate of a GridTemplateColumn.

    All the best,
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top