viola123
asked on
How to toggle a <hr> tag in code behind(.aspx.cs page)?
Hi All,
i have a gridView and have the following requirements:
<hr> is hidden when first loading the page;
when there is data in gridView---> display <hr>;
if there is no data in gridView---> hide <hr>;
i am using javascript to do it but i found <hr> is always hidden, can anyone point me to the right direction?
attached the code.
i have a gridView and have the following requirements:
<hr> is hidden when first loading the page;
when there is data in gridView---> display <hr>;
if there is no data in gridView---> hide <hr>;
i am using javascript to do it but i found <hr> is always hidden, can anyone point me to the right direction?
attached the code.
<hr id="hrExport" style=" display:none;" />
*********************************
string javaScript = string.Empty;
if (dt.Rows.Count > 0)
{
javaScript = @"<script type='text/javascript' >
function DisplayHr1() {
var hr = document.getElementById('hrExport');
hr.style.display = 'block';
}</script>";
Page.ClientScript.RegisterStartupScript(this.GetType(), "DisplayHr1", javaScript);
}
else
{
javaScript = @"<script type='text/javascript' >
function DisplayHr2() {
var hr = document.getElementById('hrExport');
hr.style.display = 'none';
}</script>";
Page.ClientScript.RegisterStartupScript(this.GetType(), "DisplayHr2", javaScript);
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi,
i got error:
'System.Web.UI.WebControls .PlaceHold er' does not contain a definition for 'Text'
thanks
i got error:
'System.Web.UI.WebControls
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i figure it out based on Craig's suggestion.
thank you Craig!
thank you Craig!
ASKER
thanks a lot. i will try and let you know the result