Solved

Javascript function kills ASP.NET form content

Posted on 2007-04-10
6
190 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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.

786 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