hello to all,
i have write a code in asp.net to show and hide the div.
according to the value in the query string.
here is my code:
if (Request.QueryString["divid"] != null)
{
divid =Request.QueryString["divid"].ToString().Trim();
if (divid == "watercalc")
{
watercalc.Style["display"] = "block";
pregnancycalc.Style["display"] = "none";
heartbeatcalc.Style["display"] = "none";
fatcalc.Style["display"] = "none";
heightcalc.Style["display"] = "none";
}
else if (divid == "pregnancycalc")
{
watercalc.Style["display"] = "none";
pregnancycalc.Style["display"] = "block";
heartbeatcalc.Style["display"] = "none";
fatcalc.Style["display"] = "none";
heightcalc.Style["display"] = "none";
}
else if (divid == "heartbeatcalc")
{
watercalc.Style["display"] = "none";
pregnancycalc.Style["display"] = "none";
heartbeatcalc.Style["display"] = "block";
fatcalc.Style["display"] = "none";
heightcalc.Style["display"] = "none";
}
else if (divid == "heightcalc")
{
watercalc.Style["display"] = "none";
pregnancycalc.Style["display"] = "none";
heartbeatcalc.Style["display"] = "none";
fatcalc.Style["display"] = "none";
heightcalc.Style["display"] = "block";
}
else if (divid == "fatcalc")
{
watercalc.Style["display"] = "none";
pregnancycalc.Style["display"] = "none";
heartbeatcalc.Style["display"] = "none";
fatcalc.Style["display"] = "block";
heightcalc.Style["display"] = "none";
}
}
now, i want to compress my code.
i know i can do it with the use of array but i am unable to do this.
anyone could help me?please......