how to work more than one button in a asp form
I have more than one buttons in a form. if i click the first button. a text box wil开发者_StackOverflowl be created. while click on the second button the page will refresh and the text box will be gone.
How do I solve this problem?If you mean that you dynamically create the textbox when the first button is clicked, you need to create that textbox on every postback.
Instead, why not keep the textbox permanently on the page, but have it set invisible. When the first button is clicked, make the textbox visible. Save the visibility state in Session state.
You can solve this problem very easily. this is a page post back problem when you click on the page then you page will be post back and again reload. so the first button code you can write in if condition like:
if(!IsPostback)
{
// WRITE CODE HERE FOR FIRST BUTTON
}
精彩评论