Hide gridview on page open

Joined
Jan 13, 2011
Messages
9
Reaction score
0
I am new to this but utilizing your website I found the below code and modified it to work with my page to hide and display a gridview. This programming works fine:

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

function showGrid()
{document.getElementById("Gridview3").style.display = "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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top