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

[Solved] Numeric editor readonly

3 Answers 183 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 06 Jan 2010, 05:04 PM
This should be easy to do but I can't find any documentation on it.  I have a radnumerictextbox editor in the grid.  The user can change the value of the editor without clicking on the edit first.  Of course, no update shows until it is in edit mode.  I want to make the editor readonly until the row is placed in edit mode.  Here is a snippet of the grid template column for the editor.  Thanks.

 

<telerik:GridTemplateColumn HeaderText="StockingTime" UniqueName="StockingTime">

 

 

    <HeaderStyle HorizontalAlign="Right" />

 

 

    <ItemStyle HorizontalAlign="Right" />

 

 

    <ItemTemplate>

 

 

        <telerik:RadNumericTextBox ID="grdSupplyChain_StockingTime_NumericEditor" runat="server" MaxValue="999" MinValue="0"

 

 

                NumberFormat-DecimalDigits="2" NumberFormat-GroupSeparator="" NumberFormat-DecimalSeparator="." Width="75px"

 

 

                Type="Number" ShowSpinButtons="true" Text='<%# Eval("StockingTime") %>'>

 

 

                <IncrementSettings Step="0.01" InterceptMouseWheel="true" />

 

 

        </telerik:RadNumericTextBox>

 

 

    </ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 06 Jan 2010, 05:12 PM
Hi Bill,

You can use separate ItemTemplate and EditItemTemplate for the given column. In the ItemTemplate the RadNumericTextBox will be readonly (ReadOnly="true").

If you prefer using only one template, you will have to use the ItemCreated server event to obtain a reference to the RadNumericTextBox control and set its ReadOnly property dynamically, depending on whether e.Item.IsInEditMode is true.

http://www.telerik.com/help/aspnet-ajax/telerik.web.ui-telerik.web.ui.radgrid-itemcreated_ev.html

http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/accessingcellsandrows/defaultcs.aspx

Sincerely yours,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Bill
Top achievements
Rank 1
answered on 06 Jan 2010, 05:43 PM
Thanks for the quick reply. 

Could you provide a snippet of code on getting a reference to the RadNumericTextBox control in the ItemCeated event?


0
Bill
Top achievements
Rank 1
answered on 06 Jan 2010, 07:13 PM
Never mind - it's straight forward.
Tags
Grid
Asked by
Bill
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Bill
Top achievements
Rank 1
Share this question
or