Showing posts with label website. Show all posts
Showing posts with label website. Show all posts

Wednesday, March 28, 2012

Extending CascadingDropDown to update other controls

My idea:

I have a basketball stats website that I'm trying to migrate to AJAX due to its no-postback. I have an "Add Game" page, in which I want to have the user select a team from a drop down list, but then I want to populate a control other than a drop down list (perhaps just a list of some sort, so the user can see all the options). The CascadingDropDown control in the AJAX toolkit accomplishes this for drop down lists, but I'm wondering if it could be extended to other controls?

I hope all of this makes sense. I'm open to more questions if it's unclear.

Thanks.

Tony

Hi,Tony

I am afraid we cannot find out the exact root cause without further information captured when the problem occurs.

To troubleshoot this issue, we really need more source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

Thank you.

Saturday, March 24, 2012

Exception: Extender controls may not be registered after PreRender

Hello,

I'm dynamically adding UserControls and Extenders for those Controls to my website.
After a postback I get this exception:

"Extender controls may not be registered after PreRender."

What is the (general) problem with that?

Thanks a lot!
Heinz

I am getting the same error message trying to add a UserControl with a SliderExtender on it. This seems like it should be a common problem. I can′t find any general answers for this one, did you find a solution for it Billy_Joe?
This sounds like an issue with ASP.NET AJAX rather than something specific to the Toolkit. Have you searched the ASP.NET AJAX forums?

Hi

Im also getting the "Extender controls may not be registered before PreRender." error and was wondering if anyone found any answers. Im trying to combine a textbox and CalendarExtender together and then use it in another server control. Ive tried to use this control straight on to a page as well and it still fails. The page contains a ScriptManager and an Update panel. Im using the 1.0.10201.0 of the AjaxToolKit. Any response is appriciated.

This is my code so far:

public class CustomDateControl : Control, INamingContainer
{
private TextBox dateTextBox = new TextBox();
private CalendarExtender ajaxCalenderExtender = new CalendarExtender();

public CustomDateControl()
{
}

public string Value
{
get
{
this.EnsureChildControls();
return this.dateTextBox.Text;
}
set
{
this.EnsureChildControls();
this.dateTextBox.Text = value;
}
}

protected override void OnInit(EventArgs e)
{
ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
if (scriptManager != null)
{
scriptManager.RegisterExtenderControl<CalendarExtender>(ajaxCalenderExtender, dateTextBox);
}
base.OnInit(e);
}


protected override void CreateChildControls()
{
this.dateTextBox.ID = "dateTextBox";
this.Controls.Add(dateTextBox);
this.ajaxCalenderExtender.ID = "calendarExtender";
this.ajaxCalenderExtender.TargetControlID = dateTextBox.ID;
this.ajaxCalenderExtender.Page = this.Page;
this.Controls.Add(ajaxCalenderExtender);
base.CreateChildControls();
}
}


Hi, did anyone here ever come up with an answer for this? I'm pretty stumped. I'm dynamically adding a ModelPopupExtender to my page; on the first load of the page it works fine, but on any postback it is throwing this error.

Thanks.


This problem has to do with the lifecycle of the webpart (server control) with respect to extender controls such as the ajaxcontrol toolkit.

I've once called MS support on this and was told that AJAX ControlToolkit is not supported , only AJAX.NET Extensions which means the updatepanel and scriptmanager.

It should work, i stuck a scriptmanager on a masterpage of an asp.net web site and the server control (webpart ) worked. I even used the ajax.net extensions tabcontainer and tabcontrols. Once the scriptmanager is on the page before the webpart it should work


Here's what I did to get around it:

At first, I was saving the dynamically added custom controls to a Session variable, pulling them back out as the page reloaded in order to rebuild the Control Tree. (Actually, I was saving the controls in a List<> collection, then saving that list in the session... running a foreach to pull them back out in the page_load event. To add to the complication, the custom controls was really a panel with several labels, text boxes, and AJAX extenders built into it.)

Well, a bit of research shows that controls, even custom controls, can not be re-used directly. It looks like the AJAX extenders are complaining that they had already been pre-rendered because theywere pre-rendered the last time they were put on the page, so obviously they can't be pre-rendered again. (This was a big DUH moment for me.)

So, instead of putting the controls back on the page, I wrote a quick and dirty function... It takes the old custom control as an argument and returns a brand new custom control with the same values...

private CustomPanel RefreshPanel(CustomerPanel oldPanel)
{
CustomPanel newPanel =new CustomPanel();
newPanel.value1 = oldPanel.value1;
// etc...
return newPanel;
}

// and in the Page_Load...

foreach (CustomPanel oldPanelin Session["SavedPanelsList"])
{
updatePanel.ContentTemplateContainer.Controls.Add(RefreshPanel(oldPanel));
}

Yes, it is dirty... It works for now, though, and with a deadline looming, I'm just glad that there will be time to refactor later.

I hope this helps someone get unstuck.

And, of course, the best solution remains to pre-define the controls into the form first, and set them to be visible = false by default. If you're working with 0 to 20+ of these controls, though, it might be best to do things the hard way and mess with the dynamic controls.

Exception with Asp.net Ajax 1.0 beta 2 + VS.net

Hi,

I have installed Asp.net Ajax 1.0 beta 2.0 on VS 2005. but whenever I create any new website using asp.net template, VS2005 is throwing following exception. I tried to installed couple of times but everytime VS.net is throwing same exception

"Package Microsoft.Web.AJAXExtension.Designer.VisualStudioToolbox.AJAXExtension,Version=1.0.61025.0,Culture=neutral, PublicKeyToken=null' has failed to load properly (GUID = {CF28F3C7-5DEE-44D1-9B49-E6EB5FD0E186})"

Thanks

The problem is in the?"PublicKeyToken=null".Try?to uninstall?Ajax?Beta?2?and?create?a?new?asp.net?website?to?
check?if?it?works. If?not, maybe?the?problem?is?in?Visual?Studio?.Net?2005. Otherwise?try?to?reboot?your?PC?and?re-install?Ajax?Beta?2?to?your?PC.?Please?give?us?a?reply?after?you?try?it.

Hi ,

Thanks for information. I found some problem in machine.config. after re-installed vs.net 2005, it is workign fine.

Thanks.

Wednesday, March 21, 2012

Eventlog warning

I keep getting this warning in the eventlog from my website that uses atlas. I am not doing anything with Cryptography so I am thinking it is from atlas. Any idea on how to fix this?

Event Type: Warning
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1309
Date: 9/1/2006
Time: 4:50:28 PM
User: N/A
Computer: xxxxxxxxxxxxx

Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 9/1/2006 4:50:28 PM
Event time (UTC): 9/1/2006 9:50:28 PM
Event ID: 2d0ae359c3f644e1abe59a1f0154872d
Event sequence: 4021
Event occurrence: 2
Event detail code: 0

Application information:
Application domain: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Trust level: Full
Application Virtual Path: /
Application Path: xxxxxxxxxxxxxxxx
Machine name: xxxxxxxxxxxx

Process information:
Process ID: 7920
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Exception information:
Exception type: CryptographicException
Exception message: Padding is invalid and cannot be removed.

Request information:
Request URL:http://www.windowsformsdatagridhelp.info/WebResource.axd?d=TiBePznmD981jNt4qHilAUYivOfdjr3CnSFDzk5Y9MU1&z=1
Request path: /WebResource.axd
User host address: 72.30.102.135
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Thread information:
Thread ID: 1
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo)
at System.Web.UI.Page.DecryptString(String s)
at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at Microsoft.Web.Services.WebResourceCompressionModule.OnPreRequestHandlerExecute(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Custom event details:

For more information, see Help and Support Center athttp://go.microsoft.com/fwlink/events.asp.

Bump. I am getting spammed with error messages similar to this. Anybody know the exact cause and how to fix it?

This exception is generated by the new feature in 2.0 calledhealthMonitoring

Basically your app is throwing a exception when hitting this page:

http://www.windowsformsdatagridhelp.info/WebResource.axd?d=TiBePznmD981jNt4qHilAUYivOfdjr3CnSFDzk5Y9MU1&z=1

and the framework is writing the log. You can disable Health monitor on your web.config

<healthMonitoringheartbeatInterval="0"enabled="false">

</healthMonitoring>


I disabled the health monitor in the web.config (isn't it off by default anyway?) and the error is still coming up. I have no other controls making this call to WebResource.axd other than Atlas, so what's the deal with the Cyptography errors?

anyone get a fix on this? I'm getting the same error...

to add insult to injury, I have 1 server running a few sites... I get this error regarding one of my sites, and that seems to take down another site. both sites are running under their own application pool. also, every time I get a 1309 error message, it seems to be followed by at least 2 ".NET Runtime 2.0 Error Reporting" errors (error id 1000, category "None"). anyone have any idea's?

Cheers


Quick question - is your site dynamically generated - meaning that utilize a IHTTP handler to generate the pages / page urls ?

If so then the error you are getting can be fixed...see this blog entry -

if you are serving it all from the file system then it will have no real relevance unless you are doing some kind of url rewriting...

May or may not fix your error....


I am not using any IHTTP handlers or doing anything with Cryptography so I was suprised I was getting the error. Turning off the health monitoring has stopped the event log messages. I am in the process of rewritting the website to use the asp.net ajax beta 1. Hopefully whatever was causing the error was fixed in the latest beta

the problem is usually caused by the request parameter(hashed string value) be invalid and the webresource.axd fail to verify it.

Have you ever found it occurs exactly when you interactively visit any page in your ASP.NET 2.0 application or any other user who get such error when they directly visit the pages in your application?

A web crawler could be causing this by making a request to a url with a hash that has expired ex:

http://www.windowsformsdatagridhelp.info/WebResource.axd?d=TiBePznmD981jNt4qHilAUYivOfdjr3CnSFDzk5Y9MU1&z=1

This will work for sometime after the page is generated but then the hash will expired.

if you are running a web farm you may run into this problem, because you need to configure the mchine.config using the same key

http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx?feedbackid=17c64976-ee21-4055-9de4-992d9c59e589

Other causes could be third party products on the web server such as SecureIIS (by eeye.com). If you go into SecureIIS and disabled the security for the website in question, your JavaScript / WebResource.axd - 404 error may go away.


i'm also geetting the same error... it just hangs or freezes and produce the warning message at the event viewer... but i tried to put the site on another computer and it works perfectly...

has anyone resolved the problem yet?

Errors while Using MasterPage and AJAX.

Hello,

I Creat a New AjaxEnabled WebSite. Now I take one Master Page. Put My Script Manager On this Page, Now I create Content Page for my Master Page. Now when I place any of Ajax control (for example UpdatePanel) It shows me an Error -- Update Panel is not known element.This can occur if there is a compilation error in website. I am not able to use ajax controls.

Now I go to HTML Source Editing Menu and select different Target Schema For Validation than all controls start working Properly. Now I close my visual studio and reopen my web site that errors apears again and again I have to change Target Schema for Validation.

My real Application caontains over 200 pages. All need to be used with master page. so its very tough for me to handle this. Any one can show me the way how I can overcome this? If I do not use Master page than its working fine but I can not do like this.

Further Currently I m using Windows XP. And this problem is not faced with Windows VISTA.. Than what is the reson behind that?

hello.

are we talking about ide errors or compile time errors? if it's ide errors, then welcome to "the real world" since I've never been able to solve mine while i was using vs 2005 (and even now, in 2008, i do get those kind of errors sometimes)


I also have this problem, but it compiles and runs, so I just don't care about it and try to live with this...


Its IDE Error.. And its fine after I compile and rum my APP

But when I use AutoComplet Cotrol... Then I must remove all errors from all the pages where I have use Auto Complet cotrol. Other wise it will not work after I deploy my web site.


hello again.

hum, i'm not following. can you give more details about that?


Hi,

This can be cause by diffrerent things, please check the following link for more information, thanks:

http://forums.asp.net/p/1038012/1772299.aspx

http://www.msdner.com/forum/thread479164.html

the issue is caused by the permission setting of the current
machine. I think there are some restrictions in the specific folder you
create before. So, after you choose the default creation, the issue has
been resolved.

Best Regards,

Errors in web.config when creating AJAX-type projects

Hi,

Whenever I create a AJAX website, or AJAX Control toolkit website, errors are found in my web.config, even before I've done anything

Warning 1 The 'requirePermission' attribute is not declared. C:\Documents and Settings\Louis\My Documents\Visual Studio 2005\WebSites\AJAXEnabledWebSite1\Web.config 6 213 C:\...\AJAXEnabledWebSite1\
Warning 2 The 'requirePermission' attribute is not declared. C:\Documents and Settings\Louis\My Documents\Visual Studio 2005\WebSites\AJAXEnabledWebSite1\Web.config 8 205 C:\...\AJAXEnabledWebSite1\
Warning 3 The 'requirePermission' attribute is not declared. C:\Documents and Settings\Louis\My Documents\Visual Studio 2005\WebSites\AJAXEnabledWebSite1\Web.config 9 199 C:\...\AJAXEnabledWebSite1\
Warning 4 The 'requirePermission' attribute is not declared. C:\Documents and Settings\Louis\My Documents\Visual Studio 2005\WebSites\AJAXEnabledWebSite1\Web.config 10 213 C:\...\AJAXEnabledWebSite1\

Any ideas?

bump anyone?

EDIT: Also, I noticed intellisense seems to be broken, in the sense I only get "!--, ![CDATA[]], ?" when I type "<"


Ok, installing SP1 kinda solved it.

Errors hosting using AJAX ASP.NET

Hello,

I am a hosting website with a host who claims to have the latest version of the AJAX ASP.NET.. On my machine everything works fine while on the hosters it doesn't giving me an error like this

Configuration Error:


Parser Error Message:Couldnot load file or assembly 'System.Web.Extensions, Version=1.0.61025.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of itsdependencies. The system cannot find the file specified.

Line 38: </httpHandlers>
Line 39: <httpModules>
Line 40: <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Line 41: </httpModules>
Line 42: </system.web>
 
Please anyone knows why I'm getting that error?
Thanks! 

Means the hoster does not have the 'System.Web.Extensions.dll install in the gac, you can put it on the bin directory and make sure the hoster is running in medium or full trust. Check this post for more details:http://alpascual.com/blog/al/archive/2006/12/20/Browse-all-AJAX-controls-at-ajax.alpascual.com.aspx

Hello AlbertPascual and thanks!

I will try that... but what if the Hoster is saying that the latest version is installed?... could be it wasn't installed correctly? I know this framework by default gets installed in the GAC, so there shouldn't be any problem with that!

THanks!


You can always override what they have by adding the dlls in your bin directory, if running at full trust, you'll be using your dlls instead of the hoster dlls.

Hope this helps


I belive still loading the old dll from your hoster and cannot find that method, check the public key PublicKeyToken=31bf3856ad364e35' to see if that's your dll public key

Thanks again!

in fact thanks to you it did help as moved on to another error now :)


Parser Error Message:Couldnot load type 'System.Web.UI.Compatibility.RequiredFieldValidator' fromassembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35'.

Line 1: <%@. master language="C#" autoeventwireup="true" inherits="Main, App_Web_main.master.cdcab7d2" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
What could this error be ? 


How can I check the public key?

how can I make sure they are pointing to my bin directory? there are no <trust> tags in my web.config and not even in the default installation of the AJAX fframework

Thanks!


hello.

i think that you haven't updated your web.config to the last version. it seems like you're strill trying to get the compatibilty validadors from the ajax dll and in the current version they're in an extra download which you can get from one of the top posts of the ajax library forum

hmmmmm yes your right... I solved it now working

however I'm concerned about the hosters how they said they have the latest version of AJAX 1.0 and then I had to use the Bin... I wish to eliminate the Bin folder so as to use the GAC which should be faster!!!

Thanks anyway!


Actually - the only faster there is is the first time the app spins up... placing something in the Gac does not make it faster overall it just means that it is spun up before the first person has requested a method etc from what is contained withing... this is a major misconception... GACcing something only means it is already resident but once something that is not gacced versus something is is spun up - they are equal in perf...just FYI