|
Rank: Advanced Member Groups: Member
Joined: 8/25/2007 Posts: 34
|
Unable to cast object of type 'System.String' to type 'EO.Web.ElementStyle'.
I upgraded from Aspxlabs with the new control set and ran into this (new) problem. It happens when I try to run this line of code:
Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "Script", "window.open('../inventory/orders/" + filename + "');", true);
The original error was I was rendering tables into a PDF using tablename.RenderControl, I originally override the render method and all is good.
This page worked fine using the AspxLab tabstrip, but seems broken beyond repair using the EO, everything else in the page works. I also use 3 different callback panels in the page and I think one of my tables is inside the callback panel.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
It's the same problem as you had yesterday. The same solution applies. http://www.essentialobjects.com/Forum/Default.aspx?g=posts&t=628Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/25/2007 Posts: 34
|
The issue yesterday was new code I was writing, this is old code and worked beutifully forever with the AspxLabs code until now when I upgraded to EO. I've got a dozen pages with this problem, so do I need to reinstall the old version and undo the upgrade process? The solution you gave to yesterday's problem would not be relevant to this as I call this code from a button click.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
Please post the stack trace. The problem is definitely in your code. Of course, if you feel the old version works fine and upgrading doesn't worth the effort you may want to undo the upgrade process. It would be up to you.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/25/2007 Posts: 34
|
Would it matter that I am using:
Build 2007.1.32 ?
Here is the stack trace, and it's not "feel", it's fact it worked previously and now it doesn't after I upgraded.
Current Time: 10/23/2007 11:50:14 AM SHOCKER Exception of type 'System.Web.HttpUnhandledException' was thrown. System.InvalidOperationException: RegisterForEventValidation can only be called during Render(); at System.Web.UI.ClientScriptManager.RegisterForEventValidation(String uniqueId, String argument) at System.Web.UI.WebControls.CheckBox.RenderInputTag(HtmlTextWriter writer, String clientID, String onClick) at System.Web.UI.WebControls.CheckBox.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlTableRow.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlTable.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at Damage_Claims_view_claim.print_wo_Click(Object sender, EventArgs e) in d:\Websites\SSI_WEB\Damage_Claims\view_claim.aspx.cs:line 552 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
OR
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'System.String' to type 'EO.Web.ElementStyle'.] EO.Web.WebControl.PreRenderStyle(h bag, Int32 field, String overrides) +165 EO.Web.WebControl.PreRenderStyle(h bag, Int32 field) +35 EO.Web.Calendar.a(Int32 A_0) +46 EO.Web.Calendar.b(EventArgs A_0) +331 EO.Web.Calendar.a(EventArgs A_0) +29 System.Web.UI.Control.PreRenderRecursiveInternal() +77 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Versile,
Both errors seem to be caused by the fact that you called RenderControl in your button click event. The first error has nothing to do with us ---- the standard ASP.NET CheckBox control calls RegisterForEventValidation inside its Render method and this is not allowed unless the page is indeed in its rendering stage.
The second error is caused by the same issue. Our controls have been rendered twice. Once by your RenderControl, another time when the page renders. Similar to the standard ASP.NET CheckBox, this is also not allowed. Even though the error messages are different, the true cause is the same ---- the controls can only be rendered during the page's rendering stage (which implies rendering only once).
If you need to support printing feature, you can consider using iframe to pull a complete page and let it goes through the normal page cycle. Messing with page rendering cycle is generally not a good thing. Not only our controls do not like that, many MS controls do not like that either.
When I said "you feel" in my previous post, I meant if "you feel upgrading doesn't worth the effort". Sorry about the confusion.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/25/2007 Posts: 34
|
I completely understand where the error is now, but the first error is the error prior to me making some modifications to the page. The second error is after those modifications. (I moved the override statement above the buttonclick statement?)
Neither is rending ANY eo controls, but rather both are rendering INSIDE eo controls (pageview). I know it's generally speaking not the greatest method but the alternative was not pretty (timewise), and it worked beutifully using the AspxLab tabstrip.
So - Is my only two alternatives to re-write the 12 pages, or downgrade (at least these pages) to aspxlabs?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Versile,
No offending...but your current implementation is on the wrong direction --- that's why before you change it, you hit MS's wall and after you change it, you hit our wall. So if it's just for the sake of correctness, all 12 pages should be rewritten. But as mentioned in previous post, if it just works fine with previous release (meaning the previous release is more tolerable), it might make sense for you to downgrade. I do not see a third option here (I do not see the need for one, either).
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/25/2007 Posts: 34
|
I made some changes to all the instances, and am not sure if this is related but occasionally I get this error (I email all errors to myself) 10-20 times at once.
Also, I was getting repeated security validation errors with the controls that I was able to correct by turning off page encryption and eventvalidation. Again, these errors didn't happen under AspxLabs version but do now. The new control set has some REALLY awesome functionality but it just seems the result is rendered differently. I.e. using a Tabstrip with multipage and pageviews, if I click on the 2nd tab and open up another pageview, with a grid inside that is built with a raises server event on the Tabstrip, it will render the page, then fill in the gridview 5-10 seconds later, leaving people to believe the page is done loading when it is not. ? It still works, and I've got 500+ users running the site pretty much constantly so the error to valid use ration is very low - still some annoyances.
Current Time: 10/28/2007 7:56:18 PM SHOCKER Virtual Url 9cc2706e-16d5-4bcf-a16b-179addb58c8e not registered. System.Web.HttpException: Virtual Url 9cc2706e-16d5-4bcf-a16b-179addb58c8e not registered. at EO.Web.Internal.ak.a(cv A_0) at EO.Web.Internal.ak.a(HttpApplication A_0) at EO.Web.Internal.d4.a(HttpContext A_0) at EO.Web.Runtime.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
|
|