NumericUpDown Ajax Extender Control in VB.NET

Here you will learn how can we increment and decrement integer value with the help of NumericUpDown Extender Control in Ajax.
  • 5203

Introduction : NumericUpDown Extender Control can easily be associated with any TextBox control and allow user increment and decrement a value define at design time such as day, week or month in a year.

Step : 1 Open Visual Studio and select File menu  option.

  • Select Web Site option.
  • Selcet ASP.NET Web Site.
ASP-page1.gif

Step : 2  Go to Solution Explorer and right click.

  • Select Add New Items.
  • Select WebForms option.
webforms.gif

Step : 3  Drag and Drop Control in ToolBox.

  • Select TextBox control, NumericUpDown Extender Control.
  • Go to Source option and write a code.

Code :
<title>numeric updown control</title>
</head>
<
body>
<form id="form1" runat="server">
    <div>
     <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
<
table>
    <tr>
 <td>
select numeric value choose up and down button</td>
<
td>
        <asp:TextBox ID="TextBox1" runat="server" Text = "3" Width = "100px" style = "text-align:center"></asp:TextBox>
 </td>
        </tr>
        <tr>
        <td>select faviourate month</td>
        <td>
<asp:TextBox ID="TextBox2" runat="server" Text = "jun" Width = "100px" style = "text-align:center"></asp:TextBox>
        </td>
        </tr>
        <tr>
        <td>use image increment decrement</td>
        <td>
        <asp:TextBox ID="TextBox3" runat="server" Text = "0" Width ="100px" style = "text-align:center"></asp:TextBox>
</
td>       
        <td>
        <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl = "~/image2.gif" AlternateText = "UP" Width = "100PX" BorderColor = "Aqua" />
        <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl = "~/image4.gif"   AlternateText ="DOWN" Width = "100PX" BorderColor = "Azure" />
        </td>
        </tr>
        </table>
        <br />
        <br />
    <asp:NumericUpDownExtender ID="NumericUpDownExtender1" runat="server" TargetControlID = "TextBox1" Width = "150" RefValues = "" TargetButtonDownID = "" TargetButtonUpID = "" Maximum = "10" Minimum = "5">
    </asp:NumericUpDownExtender>
    <asp:NumericUpDownExtender ID="NumericUpDownExtender2" runat="server" TargetControlID = "TextBox2" Width = "150" RefValues = "jan;feb;mar;apr;may;jun;july;aug;sep;oct;nov;dec">
    </asp:NumericUpDownExtender>
    <asp:NumericUpDownExtender ID="NumericUpDownExtender3" runat="server" TargetControlID = "TextBox3" Width = "150" TargetButtonDownID = "ImageButton1" TargetButtonUpID = "ImageButton2">
    </asp:NumericUpDownExtender>
    </div>
    </form>
</body>
</
html>

Step : 4 Press F5 and run.

increment.gif

Step : 5  When we click in Down and UP arrow value is decrease and increase.

incdec.gif

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.