Link to home
Start Free TrialLog in
Avatar of sl1nger
sl1nger

asked on

Javascript function kills ASP.NET form content

I need to retain a pages content.

1. The page submits a search result on an asp page.
2. The result is displayed
3. A user clicks on a javascript drop-down nav bar.
4. The drop-down opens to a list of links and the previous search results are cleared from the screen.(still on the same page)

The problem -- step 4..  I want to keep the search result on the page.
..the line that's cleared on my js call back

<uc1:my_results id="myResults" runat="server" Visible="True"></uc1:my_results>
Avatar of dmagliola
dmagliola

Your problem is directly related to Viewstate / Recreating the data/controls.

If you don't know what Viewstate is and how it works, please read: http://msdn2.microsoft.com/en-us/library/ms972976.aspx

If you do know (or if you just read the previous article), please read:
http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx
(this one is really enlightening)

After that, you should have a clearer idea of what's going on. If you still need help, please give us a little more information as to how your page is structures / how the information is shown / what controls are in use. What I can deduct from your code is that you have a UserControl of your own to show the results.

If you can, give us some details on how the information is shown inside this control (in what types of controls / using a repeater / generating output HTML code manually / etc)
Avatar of sl1nger

ASKER

I thought this would be a simple solution.  The javascript does a post back to the page.  Shouldn't I just be able to resubmit the query.  onunload form..  something like that??
ASKER CERTIFIED SOLUTION
Avatar of dmagliola
dmagliola

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sl1nger

ASKER

How are you showing this data that is "disappearing" on postback?
<uc1:my_results id="myResults" runat="server" Visible="True"></uc1:my_results>
In which controls?
in the back vb  --
myResults.showResults(txtPart.Text, CType(txtQuantity.Text, Integer), countryID, currencyID, True)
myResults.Visible = True
When do you load it (which event)?
on query
<asp:button id="btnSubmit" runat="server" Text="Submit" OnClientClick="return btn()"></asp:button>
Could you send the code to the "showResults" function?
That is probably the answer to my question "how are you showing this data"

Also, what's the Javascript code you're using for making the postback?

Do you have this page running in some public server where I could see it?
Avatar of sl1nger

ASKER

I was able to diagnose on your thoughts.  THx