Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

Wednesday, March 28, 2012

UpdateProgress Problem

I am running Atlas on a Win 2K3 Server and I installed the latest version of Atlas today. I created a simple hello world page, which runs as expected. However, when I add an UpdateProgress control and try to view the page, the following two alert boxes appear (in order):

"Assertion Failed: Could not resolve reference to object named "_pageRequestManager" for "dataContext" property on object of type "Sys.Binding"

"Assertion Failed: No data context available for binding with ID"" and dataPath "inPostBack" on object of type "Sys.Binding"

The ASPX page that works correctly is:

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
lbTest.Text="Hello World!";
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Atlas Test</title>
</head>
<body>
<form id="form1" runat="server">
<atlas:ScriptManager id="ScriptManager1" runat="server"></atlas:ScriptManager>

<atlas:UpdatePanel id="update1" runat="Server" Mode="Conditional">
<ContentTemplate>
<asp:Label id="lbTest" runat="server">This is a test</asp:Label>
<asp:Button id="Button1" runat="server" Text="Test Atlas" OnClick="Button1_Click" />
</ContentTemplate>
</atlas:UpdatePanel>
</form>
</body>
</html>

The ASPX page that fails is:

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" %>

<script runat="server">

protected void Button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(2000);
lbTest.Text="Hello World!";
}

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Atlas Test</title>
</head>
<body>
<form id="form1" runat="server">
<atlas:ScriptManager id="ScriptManager1" runat="server"></atlas:ScriptManager>

<atlas:UpdatePanel id="update1" runat="Server" Mode="Conditional">
<ContentTemplate>
<asp:Label id="lbTest" runat="server"></asp:Label>
<asp:Button id="Button1" runat="server" Text="Test Atlas" OnClick="Button1_Click" />
</ContentTemplate>
</atlas:UpdatePanel>

<atlas:UpdateProgress ID="ProgressIndicator" runat="server">
<ProgressTemplate>
<div id="progressArea">
Loading the data, please wait... <asp:Image ID="LoadingImage" runat="server" ImageUrl="~/img/spinner.gif" />
</div>
</ProgressTemplate>
</atlas:UpdateProgress>
</form>
</body>
</html>

My web.config file looks like this:

<?xml version="1.0"?>

<configuration>

<configSections>
<sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
<section name="converters" type="Microsoft.Web.Configuration.ConvertersSection"/>
</sectionGroup>
</configSections>

<microsoft.web>
<converters>
<add type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/>
<add type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/>
<add type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/>
</converters>
</microsoft.web>
<system.web>
<compilation debug="true"></compilation>

<pages>
<controls>
<add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
<add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
</controls>
</pages>

<authentication mode="Forms" ></authentication>

<xhtmlConformance mode="Strict"/>

<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/>
</httpModules>

</system.web>
</configuration>

I pulled the UpdateProgress directly from a sample online, and I can't figure out why it doesn't work.

Can anyone spot any obvious errors? Are there trust issues related to the DLL that holds the UpdateProgress class?

Any help, leads or links would be helpful - thanks.

Update - the first example I posted above DOES NOT WORK. The postback was so fast I mistakenly thought it was working.

No Atlas scripts are working above - anyone have any ideas?


I discovered the problem. I had forgotten to add an "EnablePartialRendering"attribute to true on my ScriptManager.

The first page above had a pagewith just an UpdatePanel. The pageworked, but it posted back instead of updating through atlas. When I added an UpdateProgress, I got thefollowing two error messages:

"Assertion Failed:Could not resolve reference to object named "_pageRequestManager" for"dataContext" property on object of type "Sys.Binding"

"Assertion Failed:No data context available for binding with ID"" and dataPath"inPostBack" on object of type "Sys.Binding"

I couldn't find anyinformation on these error message, and I assumed there was some problem in theinstallation. When I included the "EnablePartialRendering"attribute it solved the problem. I'msure as the Atlas documentation expands, this issue will be covered morethoroughly.

Thaks to Scott Gu and Matt Gibbs for taking some time to respond to my questions about it.
It is possibly related with this problemhttp://forums.asp.net/thread/1243525.aspx

UpdateProgress stops working after first firing

Running locally, my apps work fine. When I deploy to a remote server, my UpdateProgress controls stop working or work intermittently. The server is IIS6 on 2003. Sharepoint is running on the server but I have added scriptresource.axd and webresource.axd to excluded paths. Latest version of Ajax is installed. Seperate app pool. The hard thing is it works locally!! What else can i look at?? Here is the source:

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="UPTest.aspx.cs" Inherits="UPTest" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label1" runat="server"></asp:Label> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="0" runat="server"> <ProgressTemplate> <img alt="progress" src="Images/indicator_green.gif" /> </ProgressTemplate> </asp:UpdateProgress> </ContentTemplate> </asp:UpdatePanel> </form></body></html>

-----------

using System;using System.Web.UI.WebControls;public partialclass UPTest : System.Web.UI.Page{protected void Button1_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(5000); Label1.Text = DateTime.Now.ToLongTimeString(); }}

I'm getting this issue as well.

Any one know of a fix / explanation?


i am experiencing this as well.

anyone??


NOTE: fixed this issue by adding the "DisplayAfter" property w/any value

<

asp:UpdateProgressID="progressPanel"DisplayAfter="1"runat="server">
Unfortunately this did not work for me...has anyone else found another solution to this by any chance?

I ended up just using the javascript events in the end to show and hide a div.

think they're called onbeginrequest and onendrequest or something similar

HTH


Ok, call me dense, but I am not seeing this event anywhere in the scriptmanager, updatepanel, or updateprogress control...could you point me in the right direction please?

http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerBeginRequestEvent.aspx

http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerEndRequestEvent.aspx


Martin,

Thank you for this....I thought you had it solved for me, but it seems I have hit another snag. It seems that after the first call the div I am using is removed from the DOM rather than just being set to hidden. I can no longer find it in the DOM inspector thus my Javascript call can not find the element the next time the panel comes around...what is strange is that it is being removed before the EndRequestHandler is called...so there must be an event between BeginRequestHandler and EndRequestHandler that seems to be removing the element from the DOM. Did you run into this problem or am I just lucky ;-)

Thanks in advance,

Josh


Is your div inside the Update Panel itself?

If so it may be getting replaced by the contents of the Ajax call.


Unfortunately I wish it was as trivial as that, but it is not inside my update panel. I am quite lost on what could be doing this...

Josh


Ok I have worked on this all day today and have made noprogress...here is my code, please someone tell me what I am doingwrong...
1<%@. Page Language="C#" MasterPageFile="~/site.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs"2 Inherits="Default2" Title="Untitled Page" %>34<%@. Register src="http://pics.10026.com/?src=Modules/MainNavigation.ascx" TagName="MainNavigation" TagPrefix="uc1" %>5<%@. Register src="http://pics.10026.com/?src=Modules/Products/ProductSummaryDisplay.ascx" TagName="ProductSummaryDisplay"6 TagPrefix="uc2" %>7<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">8 <asp:ScriptManager ID="ScriptManager1" ScriptMode="Release" EnablePartialRendering="true" runat="server">9 </asp:ScriptManager>1011 <script type="text/javascript">12 Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);13 Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);14 function BeginRequestHandler(sender, args)15 {16 var elem = args.get_postBackElement();17 ActivateAlertDiv('visible', 'AlertDiv');18 }19 function EndRequestHandler(sender, args)20 {21 ActivateAlertDiv('hidden', 'AlertDiv');22 }23 function ActivateAlertDiv(visstring, elem)24 {25 var adiv = $get(elem);26 adiv.style.visibility = visstring;27 }28 </script>2930 <div id='leftcontent'>31 <uc1:MainNavigation ID="MainNavigation1" runat="server" />32 </div>33 <div id='centercontent'>34 <div class='sectionheader'>35 <a href="<%=Page.ResolveUrl("~/default.aspx")%>">Home</a> >><asp:Label ID="lblBreadCrumb"36 runat="server"></asp:Label></div>37 <asp:UpdatePanel ID="UPanel1" ChildrenAsTriggers="true" runat="server" UpdateMode="conditional">38 <ContentTemplate>39 <asp:Panel ID="Panel1" runat="server" Height="50px" Width="700px" HorizontalAlign="Center">40 <div style="float: left;">41 <asp:LinkButton ID="btnDecreasePage1" runat="server" OnClick="btnDecreasePage1_Click"><< Previous ></div>42 <div style="float: left;">43 Page44 <asp:Label ID="lblCurrPage1" runat="server" Text="1"></asp:Label>45 of46 <asp:Label ID="lblTotalPages1" runat="server"></asp:Label></div>47 <div style="float: left; clear: right;">48 <asp:LinkButton ID="btnIncreasePage1" runat="server" OnClick="btnIncreasePage1_Click"> Next >></asp:LinkButton>49 </asp:Panel>50 <div style="float: right">51 Num Products Per Page:<asp:TextBox ID="txtProductsPerPage" runat="server" Text="6"52 AutoPostBack="true" MaxLength='4' Width="3em" OnTextChanged="txtProductsPerPage_TextChanged"></asp:TextBox> </div>53 <br />54 <asp:DataList runat="server" ID="productList" RepeatColumns="3" RepeatDirection="Horizontal"55 EnableViewState="False">56 <ItemTemplate>57 <uc2:ProductSummaryDisplay ID="ProductSummaryDisplay1" runat="server" ProductGUID='<%# Eval("ProductGUID")%>'58 ProductName='<%# Eval("ProductName")%>' ImageFile='<%# Eval("imageFile")%>'59 ProductID='<%# Eval("productID")%>' OurPrice='<%#Eval("OurPrice")%>' RetailPrice='<%#Eval("RetailPrice")%>'60 ShippingEstimate='<%#Eval("ShippingEstimate")%>' Rating='<%#Eval("Rating")%>'61 SKU='<%#Eval("SKU")%>' />62 </ItemTemplate>63 </asp:DataList>64 <asp:Panel ID="Panel2" runat="server" Height="50px" Width="250px" HorizontalAlign="Center">65 <div style="clear: left; float: left;">66 <asp:LinkButton ID="btnDecreasePage2" runat="server" OnClick="btnDecreasePage1_Click"><< Previous ></div>67 <div style="float: left;">68 Page69 <asp:Label ID="lblCurrPage2" runat="server" Text="1"></asp:Label>70 of71 <asp:Label ID="lblTotalPages2" runat="server"></asp:Label></div>72 <div style="float: left">73 <asp:LinkButton ID="btnIncreasePage2" runat="server" OnClick="btnIncreasePage1_Click"> Next >></asp:LinkButton>74 </asp:Panel>75 </ContentTemplate>76 </asp:UpdatePanel>77 <div id="AlertDiv" class="loadingbox" style="visibility:hidden;">78 <img src="images/spinner.gif" align="absmiddle" />  Processing...79 </div>80 </div>81 <div id='rightcontent'>82 </div>8384</asp:Content>85

Thank you in advance,

Josh


Your manual show/hide should work. The fact it isn't could be for the same reason the UpdateProgress wasn't working. Examine your document for possible missing closing tags, etc. Look at the rendered html instead of the aspx. Inside the update panel, the "<<" and ">>" in your next/previous buttons looks suspect. Encode them as >> and << (they almost look like html tags otherwise). If you have any <script src="http://pics.10026.com/?src="> tags make sure they are not of the self-closing variety. For example <script src="http://pics.10026.com/?src=.." type="text/javascript"></script>, not <script src="http://pics.10026.com/?src=.." type="text/javascript" />.

Is $get(elem) returning an element or null?


Well you sir hit the nail on the head, I had some open tags. It wasn't showing up on source view as an issue strangely enough. I just went down one by one.

Also thank you for pointing out my glaring mistake with the >> and <<, that is not normal practice for me in my defense....

Thanks again!

Monday, March 26, 2012

Updating an UpdatePanel only when certain item is clicked in Datalist

I have 2 UpdatePanels each with a Datalist in them. Here is my code:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DataList2" />
</Triggers>
<ContentTemplate>
<asp:DataList ID="DataList1" runat="server" DataSourceID="Ods1"BorderStyle="Solid" GridLines="Both" RepeatDirection="Horizontal">
<ItemTemplate>
<asp:ImageButton ID="ThumbImage1" runat="server"ImageUrl='<imagepath...>' />
</ItemTemplate>
</asp:DataList>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<asp:DataList ID="DataList2" runat="server" RepeatColumns="4"DataSourceID="Ods2" BorderStyle="Solid" GridLines="Both"RepeatDirection="Horizontal" OnItemCommand="DataList2_ItemCommand"CellPadding="5">
<ItemTemplate>
<asp:ImageButton ID="ThumbImage2" runat="server"ImageUrl='<imagepath...>' CommandName="ThumbImage"CommandArgument='<passing the id...>' />
<br />
<asp:ImageButton ID="DeleteImage" runat="server"ImageUrl="images/delete.gif" CommandName="DeleteImage"CommandArgument='<passing the id...>' />
</ItemTemplate>
</asp:DataList>
</ContentTemplate>
</asp:UpdatePanel>

and the code in DataList2_ItemCommand is as follows:

protected void DataList2_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "DeleteImage")
{
//code to delete the image from database

...
this.DataList2.DataBind();
this.UpdatePanel2.Update();
}
else if (e.CommandName == "ThumbImage2")
{
//code to add the thumb image to the table attached to datalist1.
...
...
this.Datalist1.DataBind();
this.UpdatePanel1.Update();
}
}

As you can see in the above code, I want to update the UpdatePanel1 only when the imagebutton "ThumbImage2" is clicked and NOT when the imagebutton "DeleteImage" is clicked in Datalist2. But because Datalist2 is the cause of the AsyncPostBackTrigger for UpdatePanel1, it is updated when either one of the imagebuttons are clicked. Is there a way to change this?

Please help.

You don't want to set the datalist as the trigger, you want to set the individual ImageButtons as the triggers. Remove the triggers from UpdatePanel1, as well as the UpdateMode="Conditional".

<asp:UpdatePanelID="UpdatePanel1"runat="server">
<ContentTemplate>
...
</ContentTemplate>
</asp:UpdatePanel>

Then in the DataList2_ItemDatabound event, add the following:

ProtectedSub DataList2_ItemDataBound(ByVal senderAsObject,ByVal eAs System.Web.UI.WebControls.DataListItemEventArgs)Handles DataList2.ItemDataBound
Dim ibtnAs ImageButton =CType(e.Item.FindControl("ThumbImage2"), ImageButton)
Dim trggrAsNew AsyncPostBackTrigger
trggr.ControlID = ibtn.ClientID
trggr.EventName ="Click"
UpdatePanel1.Triggers.Add(trggr)
EndSub


In the ItemCommand event, I am executing some server side code for the imagebutton that was clicked in that specific row of datalist based on its id (which I retrieve using e.CommandArgument).

If I use the approach that you mentioned above, how do i retrieve the database id of the image clicked?

Thanks


DataList2.DataKeys.Item(e.Item.ItemIndex)


The solution you suggested works like a charm. I removed the datalist as the trigger & added the imagebutton as trigger in ItemDataBound event. Also, I still execute the server side code in ItemCommand event based on the which button clicked & everything works fine.

Thanks a ton.

Updating and ASP Textbox from Server Side Script using AJAX Extensions

I've searched the web extensively and cannot find an answer to a question that I believe is simple.

I have an application running AJAX extensions so that scripts are run at server side. Everything works great. The problem I have is that based on selections in the script I need to base data to ASP.NET VB code behind to intergrate with an existing application.

Quite simply I want to update a hidden textbox then use that data to pass along to another asp page. I know how to pass the data once I get it to and ASP control. Just need to get it to the ASP side of the server.

Thanks in advance for any help.

Brian

I solved my problem.

Make sure there is an Name tag on the textbox that you will be using to pass info to code behind

This will accept a value and display it.

<inputtype="text"id="textbox1" value="JavaScript JumpStart"runat=server>

If you want to use the value in the code behind file this is what you need.

<inputtype="text"id="textbox1"name="textbox1"value="JavaScript JumpStart"runat=server>

Note the addition of the name tag.

Updating one updatepanle data from other updatepanel

I have a september ctp atlas dll. We have one updatepanel with timer which fires every 5 seconds & get application variable data from server.In second updatepanel we have a treeview which we want to update only if value in application variable changes.If we put timer in treeview updatepanel then treeview refreshes with images,nodes which we do not want.Can we add nodes in treeview from another updatepanel.Unfortunately, the treeview is not yet supported (as well as some other databound controls that use templates)...There are some hacks you can try in the meantime...for instance the gridview when template is not supposed to be supported but I have managed to get it to work by using a combinations of controls...another good post to read is this...

Saturday, March 24, 2012

Upgrade from Beta

Hi ive got a server that is running ASP.NET 2.0 AJAX Extensions Beta 2,

ivebuilt a new app using the official release 1.0, when I place the new framework on the server will it cause any issues on my existing app as they will be runing side by side?

I believe that during the installation of the latest version, you will be prompted to remove the old version first. So you will need to upgrade your existing app first.

I'm not sure if copying the dlls directly from where you installed them on your machine and pasting them into the server's GAC would work or not, but it's worth a shot. Technically they're different versions and should be capable of being installed side-by-side, but the installer doesn't allow it.


There are migration guides availablehere. Side by side install is not supported. You need to upgrade to ASP.NET AJAX 1.0.

Upgrading from atlas to ajax extensions 1.0

Hello

I have some projects wich I build in Atlas and are already finished and properly running on my server.

I want to updatethe server in order to runNEW asp.net applications using AJAX.

Question: If I upgrade mySERVER to Ajax Extensions, will my existing Atlas projects (wich I don't plan to modify) still run fine?

Thanks

Well,

As I remember that in Atlas, all the dlls are in the bin folder; and the new AJAX, everything is in the GAC. I don't think there will be a problem if you install AJAX on your server, because you don't even use it. And if you don't intend to modify anything, then don't bother installing Ajax on your server.

But if you do sometimes in the future, then you need to modify your .aspx pages including the Web.Config file;

The new one has more to offer ... ..... good luck ......


Please also refer to : http://ajax.asp.net/documentation/default.aspx?tabid=47

See section Migration Guides


Upgrading from Beta 2 to 1.0 in production server

Hi there! I'm going to upgrade MS Ajax as subject. I read somewhere else I should restart IIS to make it use the new version. How can I do it without restarting the server? Any other things I should have in mind while performing the upgrade?

Thanks,

-Benton

Hi benton,

Restart IIS --> Open --> run --> iisrestart

Regards,

Upload AjaxControlToolkit.resources.dll in production server

Do I really need to upload all AjaxControlToolkit.resources.dll in my production server?

Thanks!

Only if you want to support the relevant languages. If English is all you need, feel free to omit the satellite DLLs.

Uploading file during onchange

I try to upload file in server during user select file:

<inputid="iupload"runat="server" type="file"style="width:1px"/>
<inputtype="hidden"id="hdName"runat="server"/>

<scriptlanguage="javascript">
function Doo(){
document.getElementById('hdName').value = document.getElementById('iupload').value;// to check path
WebForm_DoCallback('__Page',document.getElementById('iupload').value,CallbackFunction,'context',null,false);returnfalse;
}
</script>

and on server side:

protectedvoid Page_Load(object sender, EventArgs e)
{
string argClientFunction ="";
string cScript = ClientScript.GetCallbackEventReference(this, argClientFunction,"CallbackFunction","'context'","null",false);
string f=@dotnet.itags.org."
javascript:Doo();";
iupload.Attributes.Add("onchange", f);

string scr ="<script language=javascript>";
scr +="function CallbackFunction(result, context)";
scr +="{";
scr +="document.getElementById('spUploaded').innerText += 'Done';";
scr +=" return false;";
scr +="}";
scr +="</script>";
RegisterStartupScript("scr" +this.ClientID, scr);

}


publicvoid UploadFile(string fileName)
{
// try to upload file to server
}
publicstring GetCallbackResult()
{
UploadFile(evArg);

evArg = String.Empty;

return evArg;
}
publicvoid RaiseCallbackEvent(string eventArgument)
{
evArg = eventArgument;
}

Problem occur in UploadFile(...): When I try to get iupload.PostedFile for file uploading it's null. I can get file name only.

How can I upload file normally without postback with onchange ?

I need upload file to server as Gmail or Yahoo Mail!

File uploads require a full postback. There has been a lot of talk on here about sites such as gmail that appear to asynchronously load a file. At this point, the only way that I have heard of this successfully implemented is by using IFrames and have another page that does the full postback, but doesn't look like it.


Thank you! I have heard about Iftame to upload files. Have you any information about this?


Not really... we haven't got into handling file uploads very often, and if we do, we would probably use the telerik fileupload control since we have the suite and I believe it handles very large files much better that the built in fileupload for asp.net. When I tested both of them, I was able to crash IIS with the built in control by trying to upload a dvd image because it seemed to check for the file size only after it had been processed through IIS, but the telerik control seemed to do that in pieces which didn't cause it to lock up.

UploadPanel and Session problem

I have an UpdatePanel and a simple asp Button inside it, that produces asynchronous postbacks to server. Server-side onButton_Click event handling is a lasting operation(about 5 sec) thats why if async postback is in process user should be able to go to another page or make any actions.

Everything works fine unless the session object is used anywhere in application(not even in the button on click handler!). If session object is used IE doesnt allow you to make any type of postback while current async postback is in progress.

Has enyone encountered such a problem? Please Help!

Hi,

Asp.net is typical a multi-thread environment, and for thread safety, page requests using session state internally use a ReaderWriterLock to manage access to the session state.So, the second request will not be able to access it untill the lock by the previous request is released.

It should work if the second page doesn't make use of session or use <a> tag to perform redirection.


Hope this helps.

Wednesday, March 21, 2012

Urgent - Trying to make Localization work (RC version)

I am going crazy with localization. It doesn't work :(

I have 2 projects: a web application (ajax enabled) and a class library with a server control.

I have this in my server control:

[assembly:

WebResource("SomeControl.myScript.js","text/javascript")]

[assembly:

ScriptResource("SomeControl.myScript.js","SomeControl.Res","SomeControl.Res")]

The myScript.js file is marked as embedded resource.

I have SomeControl.res and SomeControl.pt-BR.res resource files.

I have EnableScriptLocalization="true" in my ScriptManager.

I am registering myScript.js in the OnInit phase of the server control, like this:

// get script manager

ScriptManager scrMgr =ScriptManager.GetCurrent(this.Page);// register javascript fileScriptReference scriptRef =newScriptReference(

Page.ClientScript.GetWebResourceUrl(

this.GetType(),"SomeControl.myScript.js"));

scriptRef.NotifyScriptLoaded =

true;

scriptRef.ScriptMode =

ScriptMode.Auto;

scrMgr.Scripts.Add(scriptRef);

--

The problem is that the client side resource object is not being generated!!!

When I run the page and look with Fiddler, I have only the contents of myScript.js,but not the contents of the resources that I need.

I should have the contents of the resource files ready to be used client side.

I really need this feature and I am speding hours with this without success... I'd like to know if anyone here could make it work, and if possible, give me a help.

Thanks!

I found the problem :)

I must register myScript.js like this:

// get script manager

ScriptManager scrMgr =ScriptManager.GetCurrent(this.Page);// register javascript fileScriptReference scriptRef =newScriptReference("SomeControl.myScript.js","SomeControl");

scriptRef.ResourceUICultures =

newstring[] {"pt-BR" };

scriptRef.NotifyScriptLoaded =

true;

scriptRef.ScriptMode =

ScriptMode.Auto;

scrMgr.Scripts.Add(scriptRef);

Now it works...

Cheers!

Urgent: AutoCompleteExtender doesnt work/Updatepanel doesnt work

This is my code for the AutoCompleteExtender

<asp:textboxid="txtQuickSearch"runat="server"CssClass="inputText"style="width:145px; "></asp:textbox>

<atlas:AutoCompleteExtenderrunat="server"ID="acSearch">

<atlas:AutoCompletePropertiesTargetControlID="txtQuickSearch"Enabled="True"ServicePath="http://localhost/Sony.BusinessSuite.Web.UI/AtlasServices/MasterData.asmx"ServiceMethod="GetAllModels"minimumprefixlength="2"/></atlas:AutoCompleteExtender>

When i start typing fiddler shows:

#ResultHostURLBodyCachingContent-TypeUser-defined1401localhost

/Sony.BusinessSuite.Web.UI/AtlasServices/MasterData.asmx?mn=GetAllModels

4.431text/html

The same happens with an update panel...

basically i've been trying to use atlas things in the application we are working on here for about 3 weeks now... and up until now it has been very cumbersome and time consuming.

Hi,

Could you post the code for the method you are using in your webservice

Thanks


Hi,

you are getting a 401. I believe that it happens because you are trying to access a web service in another domain and this is not allowed in normal conditions. Please checkthis thread.

Here's the webservice code, thanks in advance to have a look...

[WebService(Namespace ="http://tempuri.org/")]

[WebServiceBinding(ConformsTo =WsiProfiles.BasicProfile1_1)]

[ToolboxItem(false)]

publicclassMasterdata :WebService

{

[WebMethod]

publicstring[] GetAllModels(string prefixText,int count)

{

ArrayList filteredList =newArrayList();

//Get the available product categories from the principal object.

Principal principal = (Principal)Context.User;

List<Category> myCategories = principal.Categories;

List<DKCategory> myDKCategories =newList<DKCategory>();

foreach (Category catin myCategories)

myDKCategories.Add(newDKCategory(cat.OID));

//Get the models from the masterdata service (limited to the users available categories).

Proxy.Pricing.Model.ModelService ModelSVC =new Proxy.Pricing.Model.ModelService();

List<Model> myModelsSVC = ModelSVC.GetModels(myDKCategories,null);

foreach (Model modin myModelsSVC)

{

if (mod.Name.ToLower().StartsWith(prefixText.ToLower()))

filteredList.Add(mod.Name);

}

return (string[])filteredList.ToArray(typeof(string));

}

}


Hi,

I tried the solution in the thread you suggested, but it didn't work. I don't think it is related to this though, because the webservice i'm calling is in the same project than the page consuming it.

Could the problem be related to the fact i'm using the "web application project"? or nested masterpages?

Wesley


hello.

what response do you get from fiddler?


Hi,

Have you tried using as RelativePath within your ServicePath parameter?

Regards

Use a DragPanelExtender and an AlwaysVisibleControlExtender component at the same time pro

<asp:Panel ID="Panel3" runat="server" Height="3333px" Width="3333px">
<asp:Panel ID="Panel1" runat="server" Height="150px" Width="125px" BackColor="black">
<asp:Panel ID="Panel2" runat="server" Height="25px" Width="125px" BackColor="Blue">
</asp:Panel>
</asp:Panel>
</asp:Panel>
<cc1:DragPanelExtender ID="DragPanelExtender1" runat="server" TargetControlID="Panel1" DragHandleID="Panel2">
</cc1:DragPanelExtender>
<cc1:AlwaysVisibleControlExtender ID="AlwaysVisibleControlExtender1" runat="server" TargetControlID="Panel1">
</cc1:AlwaysVisibleControlExtender>

I use a DragPanelExtender and an AlwaysVisibleControlExtendercomponent at the same time.
It works perfectly if I don't scroll the web page.
After I scroll the web page, the drag and drop behavior notworks properly. When I drag the Panel2, the Panel1 will disappear until I dropthe Panel2, the Panel1 will appear again.
Does anyone know how to solve this problem?

Does anyone know how to solve the problem?


Hi Vincent901529,

I have tested your sample and I think this issue is cuased by the scroll offset. I suggest that you should post it to CodePlex. If you insist on resolve it by yourself. We suggest that you should move the Panel to its right place on its mousedown event. You can modify on the mouseDownHandler (Line : 140 V11119) in the FloatingBehavior.js under the DragPanel directory.

 function mouseDownHandler(ev) { window._event = ev; var el = this.get_element(); if (this.checkCanDrag(ev.target)) { //new added logic.
 .... ; // calculate the new location.
$common.setLocation(el, newLocation); // reset the showing position.
 _dragStartLocation = $common.getLocation(el); ev.preventDefault(); this.startDragDrop(el); } }
  Best regards,
Jonathan

Many thanks for your replying.

It is very helpful.

Use Asp.net ajax with running the installation program.

Can asp.net ajax be deployed to a production server via a xcopy operation (as part of the application)? Is it possible to deploy without having to have the server admins run the ajax installation program on the production server?

Thanks

Copy the System.Web.Extensions and System.Web.Extensions.Design from the GAC of your local pc into the bin directory of you production server. Ensure that your web.config has the required setting for Ajax Framework.

How to copy System.Web.Extensions and System.Web.Extensions.Design from GAC? Can I copy this assemblies from C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025?

Whats the "required settings"?

Is that enough:

<?xmlversion="1.0"?>

<configurationxmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<configSections>

<sectionGroupname="system.web.extensions"type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<sectionGroupname="scripting"type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<sectionname="scriptResourceHandler"type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="MachineToApplication"/>

<sectionGroupname="webServices"type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<sectionname="jsonSerialization"type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="Everywhere"/>

<sectionname="profileService"type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="MachineToApplication"/>

<sectionname="authenticationService"type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="MachineToApplication"/>

</sectionGroup>

</sectionGroup>

</sectionGroup>

</configSections>

<system.web>

<pages>

<controls>

<addtagPrefix="asp"namespace="System.Web.UI"assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addnamespace="AjaxControlToolkit"assembly="AjaxControlToolkit"tagPrefix="ajaxToolkit"/>

</controls>

</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.

-->

<compilationdebug="true">

<assemblies>

<addassembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addassembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

<addassembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies>

</compilation>

<httpHandlers>

<removeverb="*"path="*.asmx"/>

<addverb="*"path="*.asmx"validate="false"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addverb="*"path="*_AppService.axd"validate="false"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addverb="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>

<addname="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>

<validationvalidateIntegratedModeConfiguration="false"/>

<modules>

<addname="ScriptModule"preCondition="integratedMode"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</modules>

<handlers>

<removename="WebServiceHandlerFactory-Integrated"/>

<addname="ScriptHandlerFactory"verb="*"path="*.asmx"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addname="ScriptHandlerFactoryAppServices"verb="*"path="*_AppService.axd"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addname="ScriptResource"preCondition="integratedMode"verb="GET,HEAD"path="ScriptResource.axd"type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</handlers>

</system.webServer>

</configuration>

Thanx