0
votes

Scenario:I have two ASPX page page1.aspx and page2.aspx.In page1.aspx there is one button named "VIEW" and in page2.aspx there is set of four buttons named "button 1","button 2","button 3" and "button 4" respectively which are defined under table tag and also there is one search text box along with search button click on page2.aspx.

My Problem statement is: When you click on "VIEW" button of page1.aspx,you should get navigate to page2.aspx and the set of four buttons which is on page2 should get invisible/disabled on page2.aspx and when i put some search word (for example Microsoft) in search text box and click on search button which is on page2.aspx,then all set of four buttons should get visible/enable along with the search results.

Issue that i am facing is, i am able to successfully navigate from page1.aspx to page2.aspx and set of four buttons which is on page2 is also getting invisible on page2.aspx.But,when i put some search criteria in search text box of page2.aspx and do the search by clicking on search button ,i am able to get search results,but my set of four buttons is not getting visible/enable on page2.aspx.I am using button.visible = "true" inside search_click() function in code behind file of page2.aspx.cs.

1
Are the search results covering up your buttons by any chance. Is this a css / layout issue?wingyip
No,my search result is not covering up my buttons.I dont think its a css/layout issue and yes i am using updatepanel as well as ajax.so what u say do i have to use updatepanel or not ?user1783170
You can certainly use an updatepanel but this is probably the source of your problem. I will edit my answer below and tell you what to do.wingyip
Hey wing,thanks for the help.I'll try and let you know whether it worked or not.user1783170
Hi wing,It worked.Thanks for your help.user1783170

1 Answers

0
votes

Wrap your buttons in an asp panel. Set the visible attribute of the panel to false in the aspx page so that it is false by default.

Make the panel visible from within the Search button click event.

for example within that event you only need the code:

Panel1.Visible= true

If you are using updatepanels then you should probably put your button panel in a separate updatepanel and set the updatemode to conditional. You should then be able to set a trigger on the updatepanel so that content refreshes only when the search button is clicked.

<asp:UpdatePanel ID="upButtons" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="btnSearch" />
  </Triggers>
  <ContentTemplate>
    <<your buttons here>>
  </ContentTemplate>
</asp:UpdatePanel>

I think your answer will be along these lines. You can also trigger an update directly from code with something like the following in your Search button click event.

upButtons.Update 

Wing