0

I am working on a Site Settings page. From this page I would like to have users be able to mark or unmark a checkbox, which will then hide content(div's) that are on OTHER pages. Note that this should hide for everyone in a particular organization. However different organizations will want to show or hide certain fields.

This is what I have found in my research so far: Hiding a div using a asp.net checkbox oncheckchanged event

I'm assuming the following is created first:

CheckBox myCheckbox = new CheckBox();  

Then sent to the method:

protected void chk_CheckedChanged(object sender, System.EventArgs e)
{
    switch ((sender.checked)) {
        case true:
            div.Visible = false;
            break;
        case false:
            div.Visible = true;
            break;
    }
}

However I believe this is intended for the same page. So I looked up how to access a div from a different page. I found this but not sure it answers the question: How can I access div in a page from another page? Shouldn't I be able to essentially mention the page I want to access, then mention the ID of the div on that page that I want to access?

3
  • Store the value in a Session or Cookie and use it on the pages where the div is. Commented Aug 14, 2018 at 16:47
  • You are going to have to save the state of the checkbox in session or cookie storage. When you go to the "other" pages read the cookie or session variable. Commented Aug 14, 2018 at 17:49
  • Will session/cookie still be viable organization wide? The changes are per organization, not per user. Commented Aug 15, 2018 at 17:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.