0

The below programming works properly to show and hide gridviews:

<script type="text/javascript">
function hideGrid()
{document.getElementById("Gridview3").style.displa y = "none";}

function showGrid()
{document.getElementById("Gridview3").style.displa y = "block";}
</script>

<INPUT Type="button" Value="Show Material List" OnClick="showGrid()">
&nbsp;&nbsp;
<INPUT Type="button" Value="Hide Material List" OnClick="hideGrid()">

<div id="Gridview3">
<asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" 
DataSourceID="SqlDataSource2" 
style="text-align: center; margin-left: 370px;">
<Columns>
<asp:BoundField DataField="ItemID" HeaderText="ItemID" SortExpression="ItemID">
<HeaderStyle Width="50px"></HeaderStyle>
</asp:BoundField>
<asp:BoundField DataField="ItemDesc" HeaderText="ItemDesc" SortExpression="ItemDesc">
<HeaderStyle Width="400px"></HeaderStyle>
</asp:BoundField>
</Columns>
</asp:GridView>
</div>

What I need is to have the gridview hidden when the page opens. If I set the visible property of the gridview to false, I cannot view the page even with the "Show Material List" button created above.

Edited by __avd: Added [code] tags.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by __avd
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.