Tuesday, October 16, 2012

NumericUpDownExtender Example

 

Sample Example using NumericUpDownExtender – AJAX ToolKit Control

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NumericUpDownExtender.aspx.cs"
Inherits="Ajax_Controls_Examples_NumericUpDownExtender" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Numeric up Down Extender</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <ajaxToolkit:ToolkitScriptManager ID="Sc1" runat="server">
        </ajaxToolkit:ToolkitScriptManager>

        <asp:TextBox id="txtCounter" runat="server"></asp:TextBox>
        <ajaxToolkit:NumericUpDownExtender ID="NumericUpDownExtender1"  runat="server"
            TargetControlID="txtCounter" Minimum="1" Maximum="10" Width="130">
        </ajaxToolkit:NumericUpDownExtender>      
    </div>
    </form>
</body>
</html>

Output

NumericupdownExtender1               NumericUpDownExtender2

We can use NumericUpDownExtender not only for incrementing numbers but also with characters using its “RefValues” attribute. We need to specify comma separated values .

NumericUpDownExtender Example using RefValues attribute:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NumericUpDownExtender.aspx.cs"
Inherits="Ajax_Controls_Examples_NumericUpDownExtender" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Numeric up Down Extender</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <ajaxToolkit:ToolkitScriptManager ID="Sc1" runat="server">
        </ajaxToolkit:ToolkitScriptManager>
        <asp:TextBox id="txtCounter" runat="server"></asp:TextBox>       
        <ajaxToolkit:NumericUpDownExtender ID="NumericUpDownExtender1" runat="server"
            TargetControlID="txtCounter" RefValues="Red;Blue;Green;Yellow;" Width="130">
        </ajaxToolkit:NumericUpDownExtender>      
    </div>
    </form>
</body>
</html>

Ouput :

NumericUpDownIndicator3         NumericUpDownIndicator4

1 comment:

  1. How to Set Empty value to NumericUpDownExtender in asp .net?

    ReplyDelete