Solved

Javascript function kills ASP.NET form content

Posted on 2007-04-10
6
188 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

708 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

20 Experts available now in Live!

Get 1:1 Help Now