Solved

Javascript function kills ASP.NET form content

Posted on 2007-04-10
6
192 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio npm 1 29
Regarding swagger API 1 32
IntelliJ and Eclipse Neon 2 installations 4 31
Consume a webservice via VB in Visual Studio 2015 3 11
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

679 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