Home > DeveloperSection > Articles > Ajax Toolkit NumericUpDownExtender Control in ASP.Net

Ajax Toolkit NumericUpDownExtender Control in ASP.Net


AJAX AJAX 
Ratings:
0 Comment(s)
 11166  View(s)
Rate this:

Ajax Toolkit NumericUpDownExtender Control in ASP.Net


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

Code:

Add these control on aspx page

<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

<%--Add the NumericUpDown Extender --%>

<cc1:NumericUpDownExtender ID="NumericUpDownExtender1" runat="server" TargetControlID="TextBox1"Width="200" RefValues="Red;Blue;Green;Brown">

</cc1:NumericUpDownExtender>

 

<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

AjaxControl Toolkit NumericUpDownExtender Control in ASP.Net

When you click up or down button then Next Value will show in the TextBoxAjaxControl Toolkit NumericUpDownExtender Control in ASP.Net

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


Don't want to miss updates? Please click the below button!

Follow MindStick