Welcome to Dream.In.Code
Become an Expert!

Join 150,391 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,058 people online right now. Registration is fast and FREE... Join Now!




NumericUpDown in asp.net..?

 
Reply to this topicStart new topic

NumericUpDown in asp.net..?

ashmah24
10 Mar, 2008 - 03:26 AM
Post #1

New D.I.C Head
*

Joined: 10 Mar, 2008
Posts: 1

I am developing a web application where i am showing the calender for the date and start and end time. For the display of time there is no such control as in windows.form like numericupdown in asp.net.
so i used 3 textboxes and 2 buttons which resembles the control for windows timer setting

CODE

<div>
    <p>
        <asp:Label ID="Label1" runat="server" Text="Label">Time-in (h:mm)</asp:Label>
        <asp:TextBox ID="TextBox1" runat="server" CssClass="noright" Height="16px" Width="20px" MaxLength="2" OnTextChanged="TextBox1_TextChanged" AutoPostBack="true"></asp:TextBox><asp:TextBox ID="TextBox3" runat="server" CssClass="noleftright" ReadOnly="True">:</asp:TextBox><asp:TextBox ID="TextBox4" runat="server" CssClass="noleft" Height="16px" Width="20px" MaxLength="2" AutoPostBack="True" OnTextChanged="TextBox4_TextChanged"></asp:TextBox><span id="Span1" style="width:20px; height:11px; font:bold 7px Webdings;"><input type="button" name="btnUp1" value="5" title="Increase"/><input type="button" name="btnDn1" value="6" title="Decrease"/></span>
    </p>
    </div>


and the c# code
CODE

protected void TextBox1_TextChanged(object sender, EventArgs e)
        {
            if (Int32.Parse(TextBox1.Text)> 23)
            {
                TextBox1.Text = "23";
            }
            else if (Int32.Parse(TextBox1.Text) < 0)
            {
                TextBox1.Text = "0";
            }
        }

        protected void TextBox4_TextChanged(object sender, EventArgs e)
        {
            if (Int32.Parse(TextBox4.Text) > 59)
            {
                TextBox4.Text = "59";
            }
            else if (Int32.Parse(TextBox4.Text) < 0)
            {
                TextBox4.Text = "0";
            }
        }




iam not able to handle the event for mouse click event on the textbox, so that i can get a spinner look for the text box....and can also increment the values on the button click event .
is there any other way to do this.....?
Please help....




User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 05:55PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month