I have implemented a JavaScript function to expand and collapse gridview rows. Below is the script:
<script type="text/javascript">
function divexpandcollapse(divname) {
var div = document.getElementById(divname);
var img = document.getElementById('img' + divname);
if (div.style.display == "none") {
div.style.display = "inline";
img.src = "Img1/minus.gif";
} else {
div.style.display = "none";
img.src = "Img1/plus.gif";
}
}
</script>
Currently, when calling this JavaScript in my gridview, it expands immediately. I would like the panel to expand slowly. Is there an error in the coding with the setTimeout function? Any assistance on how to achieve this would be greatly appreciated...
<asp:TemplateField ItemStyle-Width="20px">
<ItemTemplate>
<a href="JavaScript:setTimeout(divexpandcollapse('div<%# Eval("ClaimMasterId") %>'),1000);">
<img id='imgdiv<%# Eval("ClaimMasterId") %>' width="9px" border="0" src="Img1/plus.gif"
alt="" /></a>
</ItemTemplate>
<ItemStyle Width="20px" VerticalAlign="Middle"></ItemStyle>
</asp:TemplateField>