locked
ajaxToolkit: NumericUpDownExtender providing dynamic values RRS feed

  • Question

  • User-656903519 posted

    So I have the ajaxToolkit: NumericUpDownExtender on my web form. Something like this

    1 visit     To ===>   4 visit

    5 visit     To===>    9 visit

    10 visit    To===>   ~More

    So based on what they choose for the "4 visit" ajaxToolkit NumericUpDownExtender I'd like to dynamically control the second line and the "5 visit"...so instead if they choose "3 visit" on the first line, the first column on the second line would then be "4 visit"...etc...I don't need the literal "visit"...So if it means setting a minimum value and incrementing based on the previous <tr> Row, that's fine.

    Can someone please help me with this?

    Thanks in advance for your review and am hopeful for a reply.

    PSULionRP

    Wednesday, May 14, 2014 2:19 PM

Answers

  • User-417640953 posted

    Hi PSULionRP,

    Thank you post the issue to asp.net forum.

    Based on your description, I see you want to set the NumericUpDownExtender as different period as

    1-4 and 5-9 and 10-more..., for this issue, I suggest you set the Minimum and Maximum of NumericUpDownExtender dynamically like below.

    <div>
            <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
            <asp:TextBox ID="TextBox1" runat="server" Text="" MaxLength="2" Width="15" ></asp:TextBox>
            <asp:NumericUpDownExtender ID="NumericUpDownExtender1" Width="100" runat="server" TargetControlID="TextBox1" Step="1" ></asp:NumericUpDownExtender>
            <asp:Button ID="Button1" runat="server" Text="1-4" OnClick="Button1_Click" />
            <asp:Button ID="Button2" runat="server" Text="5-9" OnClick="Button2_Click" />
            <asp:Button ID="Button3" runat="server" Text="10-15" OnClick="Button3_Click" />
    </div>

    code behind:

      protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack) {
                    this.NumericUpDownExtender1.Minimum = 1;
                    this.NumericUpDownExtender1.Maximum = 4;
                    this.TextBox1.Text = "1";
                }
            }
    
            protected void Button1_Click(object sender, EventArgs e)
            {
                this.NumericUpDownExtender1.Minimum = 1;
                this.NumericUpDownExtender1.Maximum = 4;
                this.TextBox1.Text = "1";
            }
    
            protected void Button2_Click(object sender, EventArgs e)
            {
                this.NumericUpDownExtender1.Minimum = 5;
                this.NumericUpDownExtender1.Maximum = 9;
                this.TextBox1.Text = "5";
            }
    
            protected void Button3_Click(object sender, EventArgs e)
            {
                this.NumericUpDownExtender1.Minimum = 10;
                this.NumericUpDownExtender1.Maximum = 15;
                this.TextBox1.Text = "10";
            }

    Hope that helps, thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 16, 2014 3:08 AM