mardi 14 août 2018

ASP.net C# - Site Settings page - Use checkbox to hide div on different page

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.

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?




Aucun commentaire:

Enregistrer un commentaire