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

RadInputManager - Different Decimals for Numeric Text Box.

4 Answers 138 Views
Input
This is a migrated thread and some comments may be shown as answers.
dmccormack
Top achievements
Rank 1
dmccormack asked on 16 Mar 2009, 09:35 PM

So, I have a scenario that I'm not sure how to handle.  We have some pages that have a huge amount of numeric textboxes on them and having them each as a  RadNumericTextBox just doesn't work very well.   So I looked to RadInputManager.   Problem is it seems that me that there is an issue when dealing with a container of controls, take a GridView for example.   I may have 20 rows each with 5 numeric boxes in them.   1 box may require 0 decimal places for integer, 2 boxes may require 2 decimal places for money and 2 boxes may require 3 decimal places for %.   Ideally I could create a RadInputManager outside of that repeater and specify different decimals for each box, but I'm pretty sure that can't be done, because the only input to the RadInputManager is a single ClientID, not an ability to specify the container and then the name inside that container.  Is that correct? 

So, my next thought is to try to create 3 RadInputManagers inside of the GridView .   That's 3 managers total.  But I don't think there's a way to do that either, at least in the .aspx page. 

So my next thought which I'm pretty sure would work, is inside of each Template Column (or where relevant), or maybe just the first column, create three managers that each define number of decimal places and then set the ids there.   While I imagine this would probably work, my question is would there be a big hit on performance creating 3 managers per row?  Could it be done better in a code behind?  Is there a better solution I haven't thought of?


An Example of this last idea with just 2 managers:

<GridView .....>

<asp:TemplateField>

<ItemTemplate>

<telerik:RadInputManager ID="RadInputManager2" runat="server">

<telerik:NumericTextBoxSetting DecimalDigits="2">

<TargetControls>

<telerik:TargetInput ControlID="SortOrder" />

</TargetControls>

</telerik:NumericTextBoxSetting>

</telerik:RadInputManager>

<asp:TextBox runat="server" ID="SortOrder" Text='<%#Eval("SortOrder") %>'></asp:TextBox>

</ItemTemplate>

</asp:TemplateField>

 

<asp:TemplateField
<ItemTemplate>
<telerik:RadInputManager ID="RadInputManager1" runat="server">
<telerik:NumericTextBoxSetting DecimalDigits="0">
<TargetControls>
<telerik:TargetInput ControlID="ItemAmount" />
<telerik:TargetInput ControlID="ItemAmountAdj" />
</TargetControls>
</telerik:NumericTextBoxSetting>
</telerik:RadInputManager>
<asp:TextBox runat="server" ID="ItemAmount" Text='<%#Eval("ItemAmount") %>'></asp:TextBox>
<asp:TextBox runat="server" ID="ItemAmountAdj" Text='<%#Eval("ItemAmountAdj") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>

</GridView>

4 Answers, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 20 Mar 2009, 09:35 AM
Hi David,

You should not need more than one instance of RadInputManager on a single page. You can simply assign different Behaviors to the input controls. A live sample of RadInputManager used for TextBox controls placed inside RadGrid EditForm you can find here. You might also find this help article useful:
http://www.telerik.com/help/aspnet-ajax/using_radinputmanager.html

I hope this helps.

Kind regards,
Pavel
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Alex
Top achievements
Rank 1
answered on 18 Feb 2011, 06:33 AM
All these examples shows most simple case of usage, and I guess the original question is unanswered (at least I cant see the answer).

I don't understand why obvious requirement to use different TextBoxSettings for different controls inside one Repeater is not explained anywhere (if this is possible).

Let say I have Repeater and 2 textboxes inside each repeater item. Now let say I want to allow users to enter only numbers in one textbox, and then only email address in another textbox.

How it can be accomplished using RadInputManager (if it can)?
0
Pavel
Telerik team
answered on 18 Feb 2011, 08:56 AM
Hello Alex,

I am attaching a simple page illustrating how the scenario with the Repeater can be achieved.

Greetings,
Pavel
the Telerik team
0
Alex
Top achievements
Rank 1
answered on 18 Feb 2011, 09:02 AM
Bingo! Thats what I needed. Did almost the same but used ClientID instead of UniqueID when creating TargetInput.

Would be good to be able to set this somehow via markup though.

Thanks!
Tags
Input
Asked by
dmccormack
Top achievements
Rank 1
Answers by
Pavel
Telerik team
Alex
Top achievements
Rank 1
Share this question
or