Showing posts with label scriptmanager. Show all posts
Showing posts with label scriptmanager. Show all posts

Wednesday, March 28, 2012

very weird problem

I have installed lastest ajax and also toolkit too. I created master page and default aspx page, then I put my scriptmanager inside the master page and update panel inside the default page, I didn't choose ajax enable website because I have a hard time to place my existing web.config files, assemblies, connection strings to right place of the enable ajax's web.config file. Maybe I should though, with this error.

I get errors sometimes with all the controls in update panel, is not recognized my html tag, even though my controls are declared, it says it is not, But it builds application suscessfully. I made sure I put this

<%@dotnet.itags.org.RegisterAssembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"Namespace="System.Web.UI"TagPrefix="asp" %>

to my page and also in web.config file under config section also assemblies too. Thing is I think every time I backup my website to my documents, for some reason a while later this happens. I even reset my iis to clear my temp folder of asp.net too. Still. Why this is happening ?

You'll also need an reference to the following assemblies:

- AjaxToolKit.dll
- System.Web.Extensions.dll

You can do this using right click on your project, "Add Reference" and point to this DLL's


On bin folder, I have got these ar, cs, de, es, fr,he,hi,it,ja,ko,nl,pt, ru,tr-TR,zh-CHS, zh_CHT all
thas AjaxControlToolkit.resources.dll in it.
Then AJaxCotrolKit.dll under neat AjaxControlKit.dll.refresh and AjaxControlKit.pdb

Microsoft.Web.UI.WebControls.dll with Microsoft.Web.UI.WebControls.dll.refresh


I have these dll on my bin now, and still problem


I had these dll on program file but not pointing to my project. I am right clicking my project and add references, choosing these dll and adding but it is not showing under my bin folder for some reason, can someone tell me steps to how to add these dlls to my projects.


Is anybody didn't have this problem? I go crazy here with this..


this was nothing to do with ajax, it was copy paste problem..

ViewState

Hi,

Is there any way to turn off ViewState (for real) using the ScriptManager and UpdatePanel? I have EnableViewState on both set to false, but Im still seeing responses of about 100k.

Thanks

Joe

set the enableviewstate=false.

then use ctl+F5 for clear the cached output


Tried that, but it didnt make a difference (unless you are talking about at the page level, in which case I cant without fairly significant changes to things unrelated to what Im working on)

Thanks,
Joe


The EnableViewState property of the ScriptManager only refers to the ViewState of the particular ScriptManager control itself.

Due to the underlying way that UpdatePanels work, the full page's ViewState must be sent to the server. The full page life cycle is still executed in a partial postback, so the ViewState is necessary to re-instantiate the state of the page and it's controls.

However, you canuse page methods to avoid the data-heavy partial postbacks in many cases. The best solution really depends on what exactly you're trying to do, but there's unfortunately no way to remove the ViewState from partial postbacks.

Monday, March 26, 2012

Visual Studio doesnt recognize(see) ATLAS from LAN!

When I try to open a website from server(LAN) I get following error within VS 2005:

Error 1 Element 'ScriptManager' is not a known element. This can occur if there is a compilation error in the Web site. ...

but the site works properly anyway... This error just annoys me, I can't see any Intellisence code for atlas components...

I have installed VS on server and installed Atlas components there too. VS shows Atlas tags properly when I launch VS from server, but doesn't do that when I try to open the same project from another computer.

The other computer has installed VS 2005 too...

Can anyone answer how to solve this?

hello.

i think this has been reported here...if i'm not mistaken, it only works without any problems when you open a local project.

VS 2008 RTM AJAX Toolkit 3.5 Autocomplete extender has issues

I just installed VS 2008 RTM and the autocomplete has issues. I created a new page added the scriptmanager and set it up to enablepagemethod so that I could use my local database to supply the autocomplete strings.

I dropped a textbox on the page then I dropped the extender onto the control. It appeared in the properties list of the textbox as expected. I changed some properties and set the ServiceMethod.

The extender did not alter the source. All the property changes were lost. I tied this several times and always the same result. The properties could be changed in the properties window but these are not updated in the source aspx page. So when you switch to source view from design the changes are simply lost.

For those who would like to implement a pagemethod rather than a webservice call, I found two good sources:

http://allwrong.wordpress.com/2007/03/13/ms-ajax-autocomplete-extender-using-a-page-method/

http://fredrik.nsquared2.com/viewpost.aspx?PostID=393

From my codebehind page:
<* The autocomplete extender is designed to use a web service to supply the items for the list box. Sometimes this
* is certainly an over-kill or the data may be accessable directly from the application's database connection. A
* web service is an un-needed layer for these times. So here is how to call a "page method" to supply that data.
*
* 1 - add: using System.Web.Services;
* 2 - In the html, modify the ScriptManager with the EnablePageMethods set to true.
* ex: <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True"></asp:ScriptManager>
* 3 - add a declaration for the page method: [WebMethod]
* 4 - add: public static string[] methodNameHERE(string prefixText, int count)
*
*/

///<summary>
/// ServiceMethod - The method to be called. The signature of this method must match EXACTLY as below.
///</summary>
///<param name="prefixText"></param>
///<param name="count"></param>
///<returns>string array</returns>
[WebMethod]
publicstaticstring[] getCompanyNames(string prefixText,int count)
{
bbCMScore bb =newbbCMScore();
string[] s = bb.getGroupingUsingUserCompanyNameSource(prefixText, count).ToArray();
return s;
}

The ASPX code looks like this:

<asp:TextBoxID="tbGrouping"runat="server"></asp:TextBox>
<cc1:AutoCompleteExtenderID="tbGrouping_AutoCompleteExtender"runat="server"EnableCaching="true" CompletionSetCount="20" CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem"CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" MinimumPrefixLength="2" TargetControlID="tbGrouping" ServiceMethod="getCompanyNames">
</cc1:AutoCompleteExtender>

The above works as it should. The problem is the properties are not updating. This causes VS 2008 RTM to error with a "souce code not available" error which certainly doesn't point to the real problem. You thought you set the properties and really they were not set.

Larry Aultman

Hi Larry,

Your problem is such weird issue. Can you modify or add extra code to your page? We suggest that you should check which version of AJAX Control Toolkit that you are using now. Please upgrade it to V11119. Also, you should check the .NET Framework version and AJAX Control Toolkit version. So do the web.config settings. AJAX Control Toolkit are divided into two versions for supporting .NET Framework 2.0 and 3.5.

Best regards,

Jonathan


Jonathan,

During the upgrade to RTM from Beta 2, I uninstalled everything Beta2. I uninstalled all projects from my machine, and deleted all traces of my development environment. I installed the RTM, downloaded the latest versions of AJAX toolkit. I created an new project.

I did verify that all my versions are for 3.5. My work around is to just not use the properties window for the control. However this control has other isses that are show-stoppers. I have commented on them in this forum under the "onClientItemSelected" event that will not fire. I can make it autocomplete but I can't get an event fired so it isn't much use to me. Thus for the moment I can't use it in production.

Thanks for the reply. I hope that someone is able to find the problem as it would be useful to users.

Larry Aultman


Hi Larry,

wph101larrya:

My work around is to just not use the properties window for the control.

Only for AJAX Contol Toolkit's Controls or all the Controls?

If the former, please do this and have a test.

We suggest that you should download a sample fromhttp://www.asp.net/learn/ajax-videos/ and have a test. Please make sure Javascript is not forbidded in you machine.

Best regards,

Jonathan

Saturday, March 24, 2012

Warnings at web server side

Hello,

Log of IIS 5.0 under Win 2000 Server contains the following warnings relating to PreRender of the AJAX ScriptManager:

"Exception information:
Exception type: InvalidOperationException
Exception message: Partial rendering requires a browser that supports W3C DOM Level 1.0.

Thread information:
Thread ID: 11
Thread account name: WEBSERVERA\ASPNET
Is impersonating: False
Stack trace: at Microsoft.Web.UI.ScriptManager.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
"

Do you have an idea what the users see in their browsers in this case? Or please give me a hint which browser I should use to test this (I think it should be a really old one)

Regards,

Di.

Hi Di,

You are right about the browser being old. For AJAX to work the browser should support XMLHttp Object.

On your pages you can run a client script which would check for this object and display a browser compatibility issue than waiting for the page to be sent to the server.

Check this link on how to check for the object in different browsers.

http://www.w3schools.com/dom/dom_http.asp

Happy programming,
Anton


Hi Anton,

Thanks for the info.

But I still want to find out what users see in their browser in the case of such warnings. How does it affect their work with the web site...

Regards,

D.


I like your enthusiasm. You can download Multiple IE fromhttp://tredosoft.com/

which has simulator from IE 3.0 onwards.

You can also download older version of Netscape fromhttp://browser.netscape.com/ns8/download/archive.jsp

but they dont have all versions but start from 4.7 onwards

Happy programming,

Anton


Thanks. Will check 'em.

Wednesday, March 21, 2012

Web App Projects and ScriptManager/UpdatePanel

I am VERY new to this so please excuse me for this obvious question. I have started a basic web app project in VS2005. Just a button, label and textbox. Wors fine. If I drop a scriptmanager and update panel on the page and move the three controls to the update panel I get a scripting error that 'Sys' is not defined. The error is in the page source script shown below:

Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], [], [], 90);

Is there a way to prevent this or edit the script that the script manager produces so as to not throw the error?

Thanks

Hi ixis,

You will have to use the "ASP.NET-Enabled Web Site" template instead of the "Empty Web Site" when creating a new Ajax application so that http handlers and modules are registered in your web.config. Here's an example of an Ajax-Enabled Web Site's web.config:


<configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" /> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" /> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" /> </sectionGroup> </sectionGroup> </sectionGroup> </configSections> <system.web> <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </controls> <tagMapping> <add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="System.Web.UI.Compatibility.CompareValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="System.Web.UI.Compatibility.CustomValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="System.Web.UI.Compatibility.RangeValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="System.Web.UI.Compatibility.RegularExpressionValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="System.Web.UI.Compatibility.RequiredFieldValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="System.Web.UI.Compatibility.ValidationSummary, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </tagMapping> </pages><!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="false"> <assemblies> <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </assemblies> </compilation> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </httpModules> </system.web> <system.web.extensions> <scripting> <webServices><!-- Uncomment this line to customize maxJsonLength and add a custom converter --> <!-- <jsonSerialization maxJsonLength="500"> <converters> <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/> </converters> </jsonSerialization> --> <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. --> <!-- <authenticationService enabled="true" requireSSL = "true|false"/> --> <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and writeAccessProperties attributes. --> <!-- <profileService enabled="true" readAccessProperties="propertyname1,propertyname2" writeAccessProperties="propertyname1,propertyname2" /> --> </webServices><!-- <scriptResourceHandler enableCompression="true" enableCaching="true" /> --> </scripting> </system.web.extensions> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </modules> <handlers> <remove name="WebServiceHandlerFactory-ISAPI-2.0"/> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ScriptResource" verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </handlers> </system.webServer></configuration>

Thanks, I'll give that a try. Just to note because I wasn't very clear in my original post, if I create a normal ASP.NET Website project, the UpdatePanel works just fine. If I create a Web Application Project using the Visual Studio 2005 Web Application Project Model I have the problem. I'm not saying your solution isn't what I am looking for just clearing up the original question. I am certainly going to review my web.config as per your post.

Web Service as Embedded Resource

Hi,

Is it possible to add a Web Service as an Embedded Resource and then add it the same way as I add javascriptfiles to the ScriptManager from a Custom Control:
ScriptManager.RegisterClientScriptResource(Me, Me.GetType(), "CustomControls.WebService.js")

/Andreas

Solved it: Created a custom VirtualPathProvider (with the library as an input) and registered it in my custom control.

Can you post some more detailed information about how you actually solved it ?

Would be great, I'm having the same problem...

Patrick