|
Rank: Member Groups: Member
Joined: 6/21/2007 Posts: 12
|
I have two questions...
1)I have a callbackpanel with no controls and the EnableViewState property of the callbackpanel set to false. When I look at the http content of the callback response triggered with a EO_Callback to this callbackpanel, I see almost 14K of Viewstate data. Why is there Viewstate data being returned as part of this callback response?
2)I have a multipage control with two PageViews. There are several callbackpanels in each pageview. When one PageView is active the other has its Visible property set to false. Everything thing works perfectly with one exception. If I view PageView1, then look at PageView2, then use the Back button on the browser, I get an error message to the effect that the callback fails because the server did not recognize this callback and processed it as a normal request. None of my callback panels are dynamically generated. The callback that triggers the exception is an in line call to EO_Callback. My code is rather involved, but if need be I can construct a simple example. I am hoping that there is some conceptual issue that will help me drill into the problem without needing to do that.
Regards, Jim
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Jim,
ViewState is always returned in our newest version because in ASP.NET 2.0 the view state has to match event validation data. When that is updated, view state has to be updated. In fact for this reason, EnableViewState is to be obsoleted.
As for the back button, I can't think of anything except that I am a bit curious about why hitting the back button would trigger eo_Callback. Anyway a sample would definitely help.
Thanks
|
|
Rank: Member Groups: Member
Joined: 6/21/2007 Posts: 12
|
Thanks for your response regarding the ViewState issue (item #1).
It has taken me a bit of time to construct a very short demo of the second issue I raised. I have a simple page with one button that when clicked switches from one PageView to another. The second page view contains a google map and a callbackPanel. To make a long story short, when you click the button, you will see it generates a callback exception. I can eleminaet this exception 3 ways. First, I can comment out the eo_Callback() in the <Script> block and I get no exception. Second, I can force pageView1 and pageview2 to be both visible by commenting out the lines that set the Visible property to false depending on the PageView that is active. Third, I can simply comment out the body of the load() funciton which generates a map. This is all very mysterious to me, and it seems that there must be some interaction between Google Maps and your controls. Hopefully my sample code is simple enough for you to find an expliaination. Note that you shouldn't need a key for google maps if you are running on a localhost. Regards, Jim
<body onload="if(window.load)window.setTimeout('load()',100);" onunload="if(window.GUnload)GUnload()" > <form id="form1" runat="server"> <asp:Button ID="Button1" runat="server" Text="Go To View 2" /> <eo:MultiPage ID="MultiPage1" runat="server" Height="180px" Width="100%"> <eo:PageView ID="PageView2" runat="server" Width="100%"> PageView2 <eo:CallbackPanel ID="CallbackPanel2" runat="server" Height="150px" Width="200px"> </eo:CallbackPanel> <div id="map" style="width: 500px; height: 300px"></div> <script src="http://maps.google.com/maps?file=api&v=2&key=" type="text/javascript"></script> <script language="javascript" type="text/javascript"> eo_Callback('CallbackPanel2'); function load() { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(37.4419, -122.1419), 13); } </script> </eo:PageView> <eo:PageView ID="PageView1" runat="server" Width="100%"> PageView1 </eo:PageView> </eo:MultiPage> </form> </body>
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click MultiPage1.SelectedIndex = 0 PageView2.Visible = True PageView1.Visible = False End Sub
Protected Sub CallbackPanel2_Execute(ByVal sender As Object, ByVal e As EO.Web.CallbackEventArgs) Handles CallbackPanel2.Execute End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load MultiPage1.SelectedIndex = 1 PageView2.Visible = False PageView1.Visible = True End Sub
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
That surely will give you that error. When you set PageView's Visible to false, PageView and all its children controls, including the CallbackPanel is not rendered at all, that's why you are getting that error. In ASP.NET, setting a control's Visible to fase is pretty much the same as removing it from .aspx file.
When you use a MultiPage control, you do not need to set PageView's Visible. It's automatically handled. That's the purpose of MultiPage and PageView control. Remove the code that sets PageView's Visible should fix the problem.
Thanks
|
|
Rank: Member Groups: Member
Joined: 6/21/2007 Posts: 12
|
I don't think that you looked at my code very carefully, nor did you bother to try it.
Only the unselected PageView has its Visible property set to false. If you comment out the calls to Google maps in the load function, the callback works perfectly with the unselected pageview Visible property set to false. Please take 5 minutes and try the sample code that I sent to you. You will see the issue that I talking about.
Note that the reason that I set the Visible property to false is that your code uses a CCS Display:none to disable the unselected pageView. This means that all of the controls are rendered and sent to the client, but not displayed. Setting Visible to false prevents this.
Regards,
Jim
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Jim,
We did try your sample code and saw the error message --- and we have spent well over 5 minutes on it. The root of the problem is your code.
We see the error message by loading the page and click Button1 --- Even though it might take a little effort to explain:
1. The page is initially rendered, with PageView2 invisible. The CallbackPanel does not exist; 2. User clicks Button1, Button1_Click executes and turns PageView2 visible; 3. Since now PageView2 is visible, eo_Callback get triggered; 4. eo_Callback posts a request back to the server; 5. The server load view states information and correctly restores PageView2's Visible as True since this is the last state; 6. The server calls Page_Load again, at here your code resets it PageView2's Visible to false; 7. Callback continues to execute to finish the normal page flow (Page_Load -> event handlers -> rendering), only to find it is no longer visible; 8. When it comes to the client side, it displays an error message to notify user of this problem;
As you can see, our control worked as intended from the begining to the end. Step 6 obviously is something that you overlooked and caused the unintended result. It is important to understand that for a control to work, the page is always loaded first. Thus even a Callback call goes through the full page cycle.
Let us know if this makes sense to you.
Thanks
|
|
Rank: Member Groups: Member
Joined: 6/21/2007 Posts: 12
|
Your detailed explaination helped me isolate that problem that I was encountering. I was getting a callback error when I used the browser back button. I restore visability of page views from session variables when the page loads. I can now see that when I press the back button and the callback fires, the wrong page view visibility gets set in the Page_Load event handler that runs befire the callback event gets executed.
Sorry about the insinutation that you hadn't looked at the code, but it wasn't obvious from your initial resonse that you had tried it. Thanks for taking the time to document your analysis of my sample code.
Regards,
Jim
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Jim,
Glad to hear it worked out for you! I apologize for not making it obvious in my first reply. But we are happy that the problem is solved and appreciate you updating us!
Thanks
|
|