Click here to Skip to main content
15,888,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Lets make it simple: I do a sql statement and I see num variable is 0 or 1. Also I have a form with 2 buttons and a checkbox.

XML
<form id="form1" runat="server">
     <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />
     <input type="button" onclick="criarNota();" value="Criar Nota" />
     <input type="button" onclick="botaoCarregarNotas();" value="Carregar Notas" />
     <asp:CheckBox id="check" Text="Auto Load" TextAlign="Right" AutoPostBack="True" OnCheckedChanged="Check" runat="server" />
 </form>


I still didnt do the action event onclick for the checkbox (SQL query to DB), but lets suppose when I check the box I want the second button of the form dont appear on the next page load (num value to 0).

How can I do that?
Posted

Save the value of the CheckBox in a session variable, and in the OnPageLoad method of the page, check the value of the session var, and show/hide the other control as appropriate.

 
Share this answer
 
v2
Comments
Maxdd 7 26-Dec-10 12:18pm    
But how could I assign show/hide properties to buttons ?
"when I check the box I want the second button of the form dont appear on the next page load (num value to 0)"
When you are playing with postback then you can directly set the 'Visibility' of the button.

All you need is to put-set an ID property of buttons to access them and 'runat="server"' such that you can access them in your code behind on server side.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900