on markup page, we have these buttons hidden:
<asp:TextBox ID="searchBox" runat="server"></asp:TextBox><asp:Button ID="btnSearch" runat="server" Text="Search Site" />
<br /><br />
<asp:Button runat="server" ID="checkall" Text="Check All" OnClick="checkall_Click" />
<asp:Button runat="server" ID="uncheckall" Text="Uncheck All" OnClick="uncheckall_Click" />
Our desire is that on page load, hide the checkall and uncheckall buttons.
If the search button is clicked, then make the checkall and uncheckall buttons visible.
So far, my effort isn’t working well.
First on page_load(…) event, I have these:
'make them hidden by default
checkall.Visible = False
unckeckall.Visible = False
Then on btnSearch_click (…) event, I want to make sure that search button is clicked and then make checkall and uncheckall buttons visible.
If (btnSearch.ID = "btnSearch") Then
checkall.Visible = True
unckeckall.Visible = True
End If
So far, it isn’t working well.
On page load, the checkall and uncheckall buttons are hidden, just like we want.
When a user clicks Search Site, they are visible. That’s good too.
Problem is when I click on checkall to check the checkboxes, the checkall/uncheckall buttons disappear again.
We only want them invisible when search sit button is not clicked.
Any ideas?
Move your initializing code inside a
!IsPostBackcheck:Better yet, remove it from the C# make it declarative:
Edit: Or, in VB:
Right? My VB may be a little rusty.