| Author: Kumar R 06 Sep 2008 | Member Level: Gold | Rating: Points: 2 |
after submitting the button clear the textbox
textbox1.text=""
|
| Author: varun 06 Sep 2008 | Member Level: Gold | Rating: Points: 6 |
There are two approach for this:
1. Client Side: If you want to clear the textbox as soon as user click the button without going to server side then use javascript:
add one attribute to button like this:
<asp:Button id="btn" runat="Server" OnClientClick="return refresh(<%=txtbox.ClientId%>);" />
Add a javascript function refresh like this:
function refresh(opt) {
document.getElementById(opt).value="";
//if you just want to clear the text and no postback then write this return false; //if you requre post back write return true; }
2. Second wayout is at server side. When page is posted back, on button_Click event write txtbox.Text="";
|