Click here to Skip to main content
15,913,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Below JQuery is going to update two cells in UI show or hide:
<pre lang="xml">function DisplayExistingStatus() {
    if($("#<%=IsNew.ClientID %>").val() == $("#<%=hfIsNew.ClientID %>").val()) {
        $("#<%=tdLblECS.ClientID %>")[0].style.display = "";
        $("#<%=tdECS.ClientID %>")[0].style.display = "";
        ValidatorEnable($("#<%= rfvExistingCollStatus.ClientID %>")[0], true);
        //ValidatorEnable(document.getElementById("<%= rfvExistingCollStatus.ClientID %>"), true);
    } else {
        $("#<%=tdLblECS.ClientID %>")[0].style.display = "none";
        $("#<%=tdECS.ClientID %>")[0].style.display = "none";
        ValidatorEnable($("#<%= rfvExistingCollStatus.ClientID %>")[0], false);
        //ValidatorEnable(document.getElementById("<%= rfvExistingCollStatus.ClientID %>"), false);
    }
}


And in page load events, do display/hide with the record which retrieve from DB:
C#
if (this.IsNew.SelectedValue != ViewState["IsNew"].ToString())
{
    this.tdECS.Attributes.Add("style", "display:none");
    this.tdLblECS.Attributes.Add("style", "display:none");
    this.rfvExistingCollStatus.Enabled = false;
}

In order to update one sub column to null when it was hide, I have written one check function:
C#
if ((this.Master.FindControl("Content").FindControl("tdECS") as HtmlTableCell).Style.Value == "display:none")
    collObj.ExistingCollStatus = null;


However, this style can not be updated when UI have been changed.
Wait for help
Posted

1 solution

The problem is:
When page load, the cells tdECS and tdLblECS have "display:none",
Then update to display these two cells,
Click Save button, the style which get in svc side is still "display:none",
OR:
When page load, the cells tdECS and tdLblECS do not have "display:none",
Then update to hide these two cells,
Click Save button, the style which get in svc side is still null.
 
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