RadInputManager - Different Decimals for Numeric Text Box.

5 posts, 0 answers
  1. dmccormack
    dmccormack avatar
    11 posts
    Member since:
    Aug 2007

    Posted 16 Mar 2009 Link to this post

    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>

  2. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 20 Mar 2009 Link to this post

    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.
  3. Alex
    Alex avatar
    22 posts
    Member since:
    Jun 2010

    Posted 18 Feb 2011 Link to this post

    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)?
  4. Pavel
    Admin
    Pavel avatar
    904 posts

    Posted 18 Feb 2011 Link to this post

    Hello Alex,

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

    Greetings,
    Pavel
    the Telerik team
  5. Alex
    Alex avatar
    22 posts
    Member since:
    Jun 2010

    Posted 18 Feb 2011 Link to this post

    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!
Back to Top