NumericUpDownExtender which automatically adds two buttons to a text box: One for increasing its value, one for decreasing it.

NumericUpDown Properties:

TargetControlID - The ID of the TextBox to modif

Width - Combined size of the TextBox and Up/Down buttons .This property is not used if you provide custom buttons.

RefValues - A list of strings separated by semicolons (;) to be used as an enumeration by NumericUpDown Extender


Add these control on aspx page

<asp:ScriptManager ID="ScriptManager1"
<%--Add the NumericUpDown Extender --%>
<cc1:NumericUpDownExtender ID="NumericUpDownExtender1" runat="server" TargetControlID="TextBox1"Width="200" RefValues="Red;Blue;Green;Brown">
<asp:Label ID="Label1" runat="server" Text="Change this text color." Font-Bold="true"Font-Size="Large" Font-Names="Arial"></asp:Label>
<br/><br/><br />
<asp:TextBox ID="TextBox1" runat="server" Font-Bold="true" ForeColor="Blue" BackColor="Azure"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Change Label" Font-Bold="true" OnClick="Button1_Click"Height="30" />
Here TargetControlIDis "TextBox1" in whichUpDownExtender will be apply
Write these codes on Button1 click event
protected void Button1_Click(object sender, EventArgs e)
        Label1.ForeColor = System.Drawing.Color.FromName(TextBox1.Text);   

FromName property will gets the color name from TextBox1 .TextBox1 Gets the value from RefValues.

Run The Project

Ajax Toolkit NumericUpDownExtender Control in ASP.Net

When you click up or down button then Next Value will show in the TextBox

Ajax Toolkit NumericUpDownExtender Control in ASP.Net

When you click Change Color Button then Label Text color will be change into the selected color.     


  Modified On Nov-30-2017 06:04:16 AM

Leave Comment