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

Edit mode column width

4 Answers 157 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Minh
Top achievements
Rank 1
Minh asked on 08 Aug 2011, 01:25 PM
Hi,

I'm looking for the edit mode width setting for numeric columns.......the my edit mode numeric columns are much wider than needed. The following is my code.

 

 

<telerik:GridNumericColumn DecimalDigits="2"

FilterControlAltText="Filter SalesLinePressure column"

HeaderText="Sales Line Pressure (psig)" UniqueName="SalesLinePressure" DataField="Sales_Line_Pressure" FilterControlWidth="20px" >

<HeaderStyle Width="50px" />

<ItemStyle Width="50px" />

<FooterStyle Width="50px" />

</telerik:GridNumericColumn>

thanks,
Minh Bui

 

4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 08 Aug 2011, 01:30 PM
Hello Minh,

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
   {
   if ((e.Item.OwnerTableView.IsItemInserted && e.Item is GridEditFormInsertItem))
   {
     ((TextBox)((GridEditFormInsertItem)e.Item)["SalesLinePressure"].Controls[0]).Width = Unit.Pixel(85);
   }
              
   }

Thanks,
Jayesh Goyani
0
Accepted
Princy
Top achievements
Rank 2
answered on 08 Aug 2011, 01:38 PM
Hello Minh,

You can try the following code snippet to change the width of NUmericColumn in edit mode.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
     if (e.Item is GridEditableItem && e.Item.IsInEditMode)
     {
            GridEditableItem item = (GridEditableItem)e.Item;
            RadNumericTextBox nmc = (RadNumericTextBox)item["SalesLinePressure"].Controls[0];
            nmc.Width = Unit.Pixel(280);
     }
}

Thanks,
Princy.
0
n/a
Top achievements
Rank 1
answered on 15 May 2015, 08:01 PM
This doesn't seem to work for batch editing.  I am on the latest version of the UI.
0
Eyup
Telerik team
answered on 20 May 2015, 08:13 AM
Hello Ari,

Essentially, Batch editing is a bit different from the other modes. It is mainly a client-side functionality and in this sense, it is a better idea to implement javascript approaches in this case. For example, there are not 10 different numeric textboxes generated to edit each of the records as with EditForms or PopUp edit modes, but there is only 1 numbox loaded on the server which works for ideal performance and rendering optimization when opening the edit cells on the client. In addition, creating custom edit templates with Batch editing mode may require further handling:
(Section Handling Advanced Templates)
http://www.telerik.com/help/aspnet-ajax/grid-batch-editing.html

With that being said,
you can check the aforementioned article to see how to access the editors programmatically and apply the settings to the numeric textbox in the code-behind. Alternatively, you can access the numbox on the client and set its text upon some conditions met:
http://www.telerik.com/help/aspnet-ajax/grid-onbatcheditopened.html

Hope this helps.


Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Minh
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Princy
Top achievements
Rank 2
n/a
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or