Solved

Javascript function kills ASP.NET form content

Posted on 2007-04-10
6
189 Views
Last Modified: 2013-11-07
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>
0
Comment
Question by:sl1nger
  • 3
  • 3
6 Comments
 
LVL 3

Expert Comment

by:dmagliola
ID: 18887693
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)
0
 

Author Comment

by:sl1nger
ID: 18890394
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??
0
 
LVL 3

Accepted Solution

by:
dmagliola earned 500 total points
ID: 18890828
Truth is, this could be incredibly simple, or very complex, it depends a lot on what you're doing.
Can you tell us a bit more of your controls structure?

How are you showing this data that is "disappearing" on postback?
In which controls?
When do you load it (which event)?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:sl1nger
ID: 18891783
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>
0
 
LVL 3

Expert Comment

by:dmagliola
ID: 18891808
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?
0
 

Author Comment

by:sl1nger
ID: 18891821
I was able to diagnose on your thoughts.  THx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now