Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace CS_ASP_025
- {
- public partial class Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if(!Page.IsPostBack)
- {
- ViewState.Add("MyValue", "");
- }
- }
- protected void addButton_Click(object sender, EventArgs e)
- {
- if (firstCheckBox.Checked &&
- secondCheckBox.Checked &&
- thirdCheckBox.Checked)
- {
- resultLabel.Text = "They're all checked!";
- }
- else
- {
- // I set up NOW the ViewState to nothing, which is what I want to get in case that the if statement does not apply:
- ViewState["MyValue"] = "";
- // but I need a string to pass to the label so:
- string emptySolution = ViewState["MyValue"].ToString();
- resultLabel.Text = emptySolution;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement