If I have

tow textbox

and 2 button

first button ok and secon is clear or reset

how i can clear the input and input another values??

Recommended Answers

All 13 Replies

In the second buttons click event you would set the two textboxes to a empty string.

textBox1 = "";
textBox2 = "";

In the second buttons click event you would set the two textboxes to a empty string.

textBox1 = "";
textBox2 = "";

Also i want to refresh the form

when i try just this code before; clear the text but still the labels and picture not disapear

and when i input another values the forms is continue not start from the begining

I think you should include in your Page_Load Event

label.visible = false;
picture.visible = false

so they will disappear.

I think you should include in your Page_Load Event

label.visible = false;
picture.visible = false

so they will disappear.

but I have Alot of Label and picture, which already I Wirte visibale for it

If you are loading the pictures and labels proramtically them you must have an idea of which objects are being updated.

Do you know which obkjects you want to clear?

If you are loading the pictures and labels proramtically them you must have an idea of which objects are being updated.

Do you know which obkjects you want to clear?

yes, clear text box

and visibale all labels and progressbar and set timer to false

aslo I wanted start the program from the beganning???

Well you have not showed any code of what you are doing or trying to do. But I would think that if you want to restart the page fresh then in the button click event for the reset button do a response.redirect

protected void reset_Click(object sender, EventArgs e)
    {
        Response.Redirect("your_page.aspx");
    }

If you find that the Cache is holding the values then you may have to add this in your page load event.

Response.Cache.SetExpires(DateTime.Now.AddTicks(500));

Well you have not showed any code of what you are doing or trying to do. But I would think that if you want to restart the page fresh then in the button click event for the reset button do a response.redirect

protected void reset_Click(object sender, EventArgs e)
    {
        Response.Redirect("your_page.aspx");
    }

If you find that the Cache is holding the values then you may have to add this in your page load event.

Response.Cache.SetExpires(DateTime.Now.AddTicks(500));

It is not work , Response is not ddeclear

Try....

HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddTicks(500));

>how i can clear the input and input another values??

Use JavaScript.

<script type="text/javascript">
  window.onload=function()
   {
         var btn=document.getElementById("btn1");
         btn.onclick=function() {
            document.getElementById("txt1").value="";
            document.getElementById("txt2").value="";
         };
    };
</script>

<body>
 <form runat="server" id="form1">
     <asp:TextBox id="txt1" runat="server" />
     <asp:TextBox id="txt2" runat="server" />
     <input type="button" id="btn1" value="Clear" />
 </form>

It is not work , Response is not ddeclear

Yes I know that Response.Redirect is not ddclear. First you wanted to know how to clear an input "how i can clear the input and input another values??" so I showed you
textBox1 = ""; which should have been textBox.text = """";

Then you said you wanted to clear everything and start the forms from the begining. Thats why I said Response.Redirect, this way you can load the page from the begining.

Anyway I'm not sure what "ddeclear" is but I do hope you get it working the way that you like.

Take Care

Also i want to refresh the form

when i try just this code before; clear the text but still the labels and picture not disapear

and when i input another values the forms is continue not start from the begining

protected void reset_Click(object sender, EventArgs e)
{
// It will work dear.
textBox1.Text = "";
textBox2.Text = "";
}

I want to convert number to word which I enter in the textbox. I try to convert number to word in the textbox in ASP, but it can't work. What may I do?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.