Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Wednesday, March 28, 2012

Why IsPostBack=false? How to repair that?

I'm using Ajax.Net. There is UpdatePanel on the page. It contains GridView. When I press "Edit", "Update" or "Cancel" button in the GridView then UpdatePanel reloads. Also executes code "if (!IsPostBack) { ... }" in Page_Load event on the server - but I don't need it!!! This code must run only once when page is loading for the first time.

protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) { ...// Here there are bindings for each control. // This code must run only once ...// On every action with GridView (which is placed in the UpdatePanel) // this code executes again and again. // Why? And how to prevent that? } }

1) Why IsPostBack=false (in Page_Load) on any action with GridView?

2) How to prevent that?

when you are clicking the button it's like you are reloading the all page but not the design... If you do not bind again the gridview loses data... Best solution is to cache the datatable that binds the gridview and binding the gridview to that... You can always verify the state of the grid to verify if you do some code...

As I understood, on every asynchronious postback (or mayme it's callback) the page is creating as it is not postback (isPostBack=false).

I think that it is better to use Session instead of Cache because every user has it's own data in the tabe.


cache in client... it's not postback... because the reference it's different... when you have difficulties test without the updatepanel to see if it's another reference of the page or not...

and i know what you're thinking the adress it's the same... it's ASP my friend... works that way.


What means "cache in client"? How? I can cache data only on server.


HttpContext.Current.Cache.Insert(itemString, Obj, HttpCacheability.Public, DateTime.Now.AddHours(expiration), TimeSpan.Zero)



Oh, it's caching on the server side, I thought you means caching data on the client side.

I change a bit my question. So, on each asynchronious postback executes code "if (!IsPostBack) { ... }" in Page_Load. But I want to prevent it. This code must executes only once when page is loading for the first time. How can I know if the page is loading for the first time or it is asynchronious postback? I want something like that: "if (!IsPostBack && !isAsynchroniousPostBack) { ... }"


did you tried with page.callback?


most likely no. what do you mean?


Put if not ispostback and not iscallback...


I wrote "!IsPostBack && !IsCallback && !IsAsync" - IsCallback and IsAsync always =false. IsPostBack in some cases =true and in some cases = false


tell me what are the cases that give true...

you don't have the need to put all of this...

if it doesn't control for you the postback you can put a viewstate that keeps the state of the grid.

just like this:

If not ispostback and viewstate("Should_Enter_Here")

end if

and in the event of the grid put this viewstate equals a true.


What you are looking for isIf (!ScriptManager.GetCurrent(Page).IsInAsyncPostBack).

http://www.asp.net/learn/ajax-videos/video-173.aspx


Thanks

Why it always return to the original place?

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<cc1:DragPanelExtender ID="DragPanelExtender1" runat="server" TargetControlID="Panel1"
DragHandleID="Panel2">
</cc1:DragPanelExtender>
<asp:Panel ID="Panel1" runat="server" Height="300" Width="200">
<asp:Panel ID="Panel2" runat="server" Height="25" Width="200" BackColor="Black">
</asp:Panel>
Test</asp:Panel>

I would like the Panel1 can be dragged and stay the place where I drop it.

How to do that?

I believe the body of the page has to have been assigned some sort of physical dimension:

http://forums.asp.net/p/1150327/1874846.aspx

See point #23 and Listing 6 of this article:

http://aspalliance.com/1450_Working_with_DragPanel_AJAX_Control.4


Many thanks for replying.

Why javascript function can not be found in Firefox with a AJAX page?

Following page works fine with IE. When click on Html button, the javascript function is called and works fine.

But when run the same page in Firefox, it reported that the error as below:

myFunction is not defined

onclick(click clientX=0, clientY=0)

What's the possible reason and how to solve it?

--the page code:the page also include some Ajax toolkit and the code for that is omitted.

<%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false" Codebehind="workshop.aspx.vb" Inherits="my.workshop" %>
<!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>Workshop Registeration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<link href="http://links.10026.com/?link=StyleSheet1.css" rel="stylesheet" type="text/css" />
<script type="text/jscript" language="javascript" >

function reset(){
document.workshop.reset();
}

function myFunction() {
alert("test");
}

</script
</head>
<body class="page">
<form id="workshop" runat="server">
<asp:ScriptManager runat="server" EnableScriptGlobalization="true" ID="MasterScriptManager"
EnablePartialRendering="true" ScriptMode="Release" AsyncPostBackTimeout="72000">
</asp:ScriptManager>
<div>
<table border="1" cellpadding="0" cellspacing="0">
<tr class="namearea">
<td align="center" class="dataarea">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="right" style="width: 50%">
<input class="jsbutton" onclick="javascript:myFunction();" type="button"
value="Button1" />
</td>
<td align="left" style="width: 50%; background-color: White;">
<br />
<asp:PlaceHolder ID="plcmyHolder" runat="server"></asp:PlaceHolder>
<br />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Change the script type from text/jscript to text/javascript and it'll work.

why Javascript doesnt work properly in updatepanel?

i wanna my gridview to change into editrow model by click any space in the row , so i wrote in the aspx page:

.....
<script type="text/javascript">
function ClickEvent(cId)
{
var id=cId;
document.getElementById("rowid").value=id;
document.getElementById("btnBindData").click();
}
</script>
.....

<asp:LinkButton ID="btnBindData" runat="server" OnClick="btnBindData_Click" Width="0px" style="width:0px; height:0px"></asp:LinkButton>
<input type="hidden" id="rowid" runat="server" /> //send clicked row index to editindex property

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:BoundField DataField="userName" HeaderText="userName" SortExpression="userName" />
<asp:BoundField DataField="userPassword" HeaderText="userPassword" SortExpression="userPassword" />
</Columns>
</asp:GridView>

In the aspx.cs file i wrote:

.......

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#dfe345'");

e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");

e.Row.Attributes["style"] = "Cursor:hand";

e.Row.Attributes.Add("OnClick", "ClickEvent('" + e.Row.RowIndex + "')");

}
}

......

protected void btnBindData_Click(object sender, EventArgs e)
{
GridView1.EditIndex=Convert.Int32(this.rowid.Value);

.....

GridView1.DataBind();
}

It works well without UpdatePanel ,but when put the GridView in the UpdatePanel ,when I click the row, the GridView got disappeared.

Replace asp:LinkButton with asp:Button. If you want you can sorround your button with a hidden div (to hide from the user). Also add UseSubmitBehavior="false" to the asp:Button.

For example:

<div style="display: none; line-height: 0pt;">
<asp:Button id="btnBindData" runat="server" OnClick="btnBindData_Click" UseSubmitBehavior="false" />
</div>

Why JSON?

Say, please, what was the main reason to use JSON object serializing in Atlas instead of SOAP? Easy deserializing? Or light weight? Or something else?

And will Atlas support SOAP in the future?

Thanks.

Pavel,

Easy deserializing is indeed a big part of it. The ability to just call JavaScript's 'eval' instead of having to reconstruct an object graph from an XML DOM makes JSON much easier to you. JSON is also a more concise format.

It is conceivable that Atlas will support SOAP in the future.

David


Thanks for quick answer.

Why Microsoft done this in Ajax

Hello,

Till the time i have heard that Microsoft is releasing the ASP.NET AJAX i am excited that i have to just copy the dll's of this ASP.NET AJAX into my webapplication becaz earlier i have used Atlas products dll in my application , in that i just cpoied the dll into the bin folder of my application and its working perfect.

But i can't understand the reason why Microsoft have removed this feature from his new release ASP.NET AJAX, they know this that many websites running on hosted servers and they d't have permission to install any software on that server still they have done this,

Can any one explain me why they have done this is there any reason for this, Is ASP.NET AJAX not working fine in the din folder or Wht?

Now with ASP.NET AJAX you dont need to copy the ajax framework dll into the bin directory as you used to do with ATLAS. When ASP.NET AJAX was installed, these dll's will be installed directly into the GAC and all most all the hosting providers might have done this already. You just need to re-configure your web.config file and also keep track of the changes from ATLAS to BETA to RC which can be found at

Converting Applications from "Atlas" CTP to ASP.NET AJAX RC
Converting Applications from ASP.NET AJAX Beta 2 to ASP.NET AJAX RC

Its not that ASP.NET AJAX is not working fine with the bin folder. With each and every release, there will be changes like adding new functionality, bug fixing etc..,

Thanks

Why mix live.com with ATLAS? or even pageflakes?

I am not sure if other people has the some question as I have. I am using ATLAS, and trying to find out what features are available. There are more features to come, but I need keep looking what are available since I don't want to deveope them if they are there ready for use.

But look on the ATLAS pages, often you will see pageflakes, live.com etc. They are good sites, they are using ATLAS. But the thing is they don't build with ATLAS only. So my question is what is the point to put them here, just let us admire the nice features they have but no way to build our site like thme?

hello.

well, i guess that is what you'll have to do with everything, ie, you'll allways have to expand/tweak it to fit your needs. seeing sites like those might give you new perspectives about what you can do with the platform.

Why must I double-click the Confirm/Cancel Buttons of a ConfirmButtonExtender

Hello everybody

I'm using ConfirmButtonExtenders in my pages, but I have got an issue with them: I must double click the confirm or cancel buttons in order for something to happen.

I've typed no code but

<ajaxControlToolkit:ConfirmButtonExtender runat="server" ID="CBESupprimerIB" TargetControlID="LBSupprimerAnnonce" ConfirmText="<%$ Resources:Resource, RLConfirmSuppression%>"></ajaxControlToolkit:ConfirmButtonExtender>

Why is this ?


Thanks for your help

Hi,

It's hard to tell why from your description. I tried it, and can't reproduce the issue.

Can you investigate more and be more specific about how to reproduce it?


Simple error that concentration would have helped me to catch:

I simply had two Extenders and both extended the same Button so that I needed two click twice to validate my choice.

Thank you for telling me to investigate more, this helped me find where the issue came from...

Why My AutocompleteExtender doesnt work Im gone crazy!!

Hi All!!!

I'm looking for help. I read lot of post in this forum but my AutocompleteExtender still not work. Can somebody help please!

this is my code behind of my Webservice

1using System;2using System.Data.SqlClient;3using System.Web;4using System.Collections;5using System.Collections.Generic;6using System.Web.Services;7using System.Web.Services.Protocols;8910/// <summary>11///12/// </summary>13[System.Web.Script.Services.ScriptService]14[WebService(Namespace ="http://tempuri.org")]15[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1, EmitConformanceClaims = true)]16public class AutocompleteList : System.Web.Services.WebService {1718 public AutocompleteList () {1920//Uncomment the following line if using designed components21 //InitializeComponent();22 }2324 [WebMethod]25 [System.Web.Script.Services.ScriptMethod]26 public string[] GetList(string prefixe, int count)27 {28 List<string> art = new List<string>();29 string cnx = global::System.Configuration.ConfigurationManager.ConnectionStrings["artistesSQLServices"].ConnectionString;30 string select = "SELECT DISTINCT nom FROM [Table] WHERE nom LIKE @dotnet.itags.org.VALUE";31 SQLServer server = new SQLServer(cnx);32 if (server.Connect.State == System.Data.ConnectionState.Open)33 {34 SqlDataReader reader = null;35 SqlCommand cmd = new SqlCommand(select, server.Connect);36 cmd.Parameters.Add(new SqlParameter("@dotnet.itags.org.VALUE","%" + prefixe + "%"));37try38 {39 reader = cmd.ExecuteReader();40 cmd.Parameters.Clear();41 }42catch (Exception ex)43 {44string mess = ex.Message;45 }46finally47 {48if (reader.HasRows)49 {50while (reader.Read())51 {52 art.Add(reader.GetValue(0).ToString());53 }54 }55 reader.Close();56 reader.Dispose();57 cmd.Dispose();58 server.SQLDisconnect();59 }60 }61return art.ToArray();62 }63}

this is the code of my aspx page

<%

@dotnet.itags.org.PageLanguage="C#"MasterPageFile="~/users/Site.master"AutoEventWireup="true"

CodeFile

="Test.aspx.cs"Inherits="users_Test"Title="Untitled Page" %>

<%

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

<%

@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>

<

asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server"><asp:ScriptManagerID="ScriptManager1"runat="server"EnablePageMethods="true"EnablePartialRendering="true"></asp:ScriptManager><ajaxToolkit:AutoCompleteExtenderID="AutoCompleteExtender1"runat="server"TargetControlID="TextBox2"ServiceMethod="GetList"ServicePath="../AutocompleteList"CompletionInterval="10"CompletionSetCount="10"MinimumPrefixLength="3"Enabled="true"EnableCaching="true"></ajaxToolkit:AutoCompleteExtender> <asp:TextBoxID="TextBox2"runat="server"></asp:TextBox>

</

asp:Content>

Hi,

Change your First Parameter "string prefixe" to be "string prefixText" . The Parameters are hard-coded in the WebService Invocation.

Check this Thread ..http://forums.asp.net/1598039/ShowThread.aspx#1598039


thanks for your help phanatic it works very well ............ BUT in debug mode only

when i call my page by this url :http://mymachine/mypage.aspx the autocompletion doesn't work. Do you know why?


ok,

we are making progressSmile

I see that you are calling an ASPX Page , are you trying to use the PageMethods ?

If you are , Please checkhttp://forums.asp.net/thread/1205564.aspx

If it resolves your issue , please mark my reply as the answer


still doesn't work!

I have "myage.aspx" which contains the autocompleteextender, and 2 others files (Autocomplete.asmx and Autocomplet.cs) which contains the code of my webservice


still doesn't work!

I have "myage.aspx" which contains the autocompleteextender and the two files of my webservice the "Autocomplet.asmx" and the code-behind "Autocomplete.cs"


hi,

Please drop me a sample at Phani_Rajyn@.yahoo.co.in


i've just sent you a sample

Hi ,

The sample contains SQLDataSource Connections and a lot of dependencies .

I cannot run this on my machine

can you please send me a self-contained sample that can run anywhere ?


hi phana

i've done some test with an other code in my webservice like this

1[WebMethod]2 [System.Web.Script.Services.ScriptMethod]3public string[] GetCompletionList(string prefixText,int count)4 {5int i = 0;6int iLength = 10;7 List Values =new List<string>();8for (i = 0; (i < iLength); i++)9 {10 Values.Add(Convert.ToString(prefixText + i.ToString()));11 }12 String[] strReturn =new String[Values.Count];13 strReturn = Values.ToArray();14return (strReturn);15 }

this code work very fine in debug mode and in normal mode. In my code i'm connecting to a SQLSERVER 2005 in an other machine.


I've done a test

I code a new page aspx just with the textbox an the autocompleteextender

i try my webservice it works fine. but when i add my website in IIS the autocompletextender doesn't work. it seems to be an issue in my IIS settings con you tell me what are the settings for IIS please


Hi,

"this code work very fine in debug mode and in normal "

If the code above works , then there are no issues with the AutoCompleteExtender , you should investigate the calls to the SQL Server you are making to understand what the issue is .

As far as IIS is concerned, are you gettting any errors related to IIS configuration ?


i find the issue it seems that IIS don't use my authentification to connect to the sqlserver

i've change my connection string and use the "sa" id user and password to connect

thx a lot for your help phana


just an other question can tell me how can i do a drag n drop from a textbox to an other textbox?

Hi,

great to know that we resolved the issue.

Can you please mark my reply as the answer ?

Why my web services cant accept parameter?

When my javascript call the echoString(s) in the following code, it return nothing

<%@dotnet.itags.org. WebService Language="C#" Class="WebService" %>

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebService : System.Web.Services.WebService {

[WebMethod]
public string echoString(string s) {
return s;
}

}

The strange things are my .NET program works fine with the code above and my javascript client program doesn't work with the code above but works fine with other people's web services. EX:

http://www.mssoapinterop.org/asmx/simple.asmx?op=echoString

What is wrong with my code? Thank you!!!!!!!!!

asdpai:

what is wrong with my code?

nothing, code is correct. Decorate youre WebService with theSystem.Web.Script.Services.ScriptService() and the WebMethode with the ScriptMethod() attribute eg.

<%@. WebService Language="C#" Class="WebService" %>

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
usingSystem.Web.Script.Services;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService()]
public class WebService : System.Web.Services.WebService {

[ScriptMethode()]
[WebMethod]
public string echoString(string s) {
return s;
}

}

Hope that coul help.

Why no Atlas Web Site template?

Hello -

Just getting started with Atlas. Downloaded and installed ASP.NET AJAX 1.0 Beta 2 and ASP.NET 2.0 AJAX Futures November CTP, but when I go to open a new Web site in VS2005, "Atlas" Web Site does not appear under My Templates (as the tutorials indicat should be the case).

What does appear under Installed Templates is ASP.NET Ajax-Enabled Web Site and ASP.NET Ajax CTP-Enabled Web Site. I chose the latter; however, none of the controls with the Atlas prefix (such as <atlas:ScriptManager>) are available to me through type-ahead.

Any suggestions on this are appreciated.

Eric

I just posted the same issue 15 minutes ago, Can please pass along any information if you come up with a fix.


In beta 2 version, prefix 'atlas' is replaced by 'asp'.
In beta 2 version, prefix 'atlas' is replaced by 'asp'. I am not sure what this means... Details please.

The responder means:

<atlas:ScriptManager>)

is now

<asp:ScriptManager>)


Does this mean that we no longer need the Atlas Web Site Template? Is it replaced with the ASP.NET AJAX-Enabled Web Site?
That is correct forget you even heard the word Atlas (its all Ajax now)
Thanks for the help. I am new at this programming and I have a lot to learn in a little time.

Hi,

When you install AJAX Extensions Beta2, It will adds some controls to Visual Studio2005 ToolBox.

So, open one ASP.NET website and click the ToolBox, goto AJAX Extensions Tab, click that Tab, it will show all controls which are newly installed.

All controls[UpdatePanel,..] will starts with 'asp'.

in design mode, drag-and-drop one control into the design view and goto the source view, there you will see the AJAX controls syntax.

Pradeep

why not EnablePartialRendering="true"?

why the attribute is not set by default, is there any specific behavior?

enablePartialRendering

="true"

Yes - it changes the way script manager deals with the page. This allows UpdatePanel to work. Without an UpdatePanel on the page, you don't need it enabled.


thank- i see that

but isnt the update panel the mostly used? or ... activate the partial reendering when update panel comes to page ...


I haven't worked through all the scenarios here, but one of them is that the UpdatePanel has some issues in Safari right now. Perhaps this question would be better suited for the general Atlas forum. Thanks!

Return Value

true if partial rendering is enabled and full-page updates are suppressed; otherwise,false. The default istrue.

Remarks

Even if theEnablePartialRendering property istrue,partial-page rendering might not occur for the following two reasons:the browser does not support partial-page rendering or theSupportsPartialRendering property is set tofalse.

You can override the value of theEnablePartialRendering property at run time during or before the page'sInit event. If you try to change this property after the page'sInit event has occurred, anInvalidOperationException exception is thrown.

why now i cant use the namespace Sys.Data

How i can create a datatable in javascript to pass to a webmethod now if the namespace Sys.Data is removed?

Thanks

Just add the Preview version.

why page load is called when an updatepanel is updated

Hi,

i have just observed that when a request is posted to server inside an updatepanel. then load method of page is called.

create a page with script manager and updatepanel. put a button inside the panel. add a msgbox in the load eventhandler of page.

now when u will click the button page load eventhandler would be executed. i was expecting that only the load event of update panel would be executed not the page one. because what ajax says is that whole page is not reloaded only the updatepanel is reloaded. does it mean that the ajax only helps to not activate the back button on browser but underlying it reloads the page in fact.

thanks

Hi i think you misunderstood something. what AJAX meant for is not exactly for asynchronous postbacks. This means that you cant execute two threads parallelly. But what it does is partial rendering. During an async postback all the usual events will be executed but only the contents inside the Update panel will be rendered.


hello.

well, what they're trying to say is that only the updatepanel contents will be updated during a partial postback. you can use the scriptmanager isinasyncpostback property to see if you're in a partial postback scenario:

http://asp.net/AJAX/Documentation/Live/mref/P_System_Web_UI_ScriptManager_IsInAsyncPostBack.aspx


rex_alias:

Hi i think you misunderstood something. what AJAX meant for is not exactly for asynchronous postbacks. This means that you cant execute two threads parallelly. But what it does is partial rendering. During an async postback all the usual events will be executed but only the contents inside the Update panel will be rendered.

I'm pretty sure that's exactly what AJAX is meant for.

And you can execute two threads parallelly.

Partial rendering isn't related to AJAX, you can have partial rendering without AJAX, and you can have AJAX without partial rendering, although it's implemented in the UpdatePanel and its implementation uses AJAX.

And yes, the whole life cycle of the page happens on the server, but only the relevant portions of the output are rendered into a xml based diff-gram, and sent to the client.


This is the nature of Update Panel. You can filter out the Regular Post Back with an Async by Checking the Page ScriptManager.IsInAsyncPostBack. Or if you do not want to page to be called then use the Client Centric Development Model which is calling the Web Service or Static Page Methods.

Why Popup Calendar doest trigger textbox event OnTextChanged?

A textbox connect to an Atlas Toolkit Control PopupCanendar.
There is a javascript for OnTextChanged event of this textbox.

When using popup calendar to select a date for this textbox, it doesn't trigger this event.
But if type date in textbox directly, it is OK. the OnTextChanged will be fired.

Why? what's the solution for this case?The DOM is a little weird in that script changes don't tend to fire the associated event handlers that get fired when the user makes a change. It sounds like you're hitting that here. It's possible to fire the event from script, too, so maybe you want to try that. If you switch to PopupControl's CommitScript mode, I think you should be able to make this change fairly easily.

Why POST is slower than GET?

Sorry, my question can be silly and a little OT, but I'm really stuck on it...I'm performing some tests with AJAX, actually I'm not using a particular framework or some already written Javascript code. The test is just a simple HTML page that sends (one after the other) 10 requests to another page (in the same site). I'm writing out the time elapsed between the request and the response of every one. When I try this page on my local web server I get very fast responses (more or less 0.01 seconds), with both IE7 or FF2. When I do the same test from another machine (in the same network, and the network has not problems of traffic) I have totally different results. If the page is performing a GET to the server the requests are very, very fast with boht IE7 and FF2. But if I change the GET to a POST (with very few bytes of data) FF2 because much slower (0.25 seconds) and IE7...I don't know...on some machines is still very fast, but on others is as slow as FF2. I can't understand when and why?!? I tried with IE7 on XP (fast), IE6 on XP (fast), IE7 on Vista (some fast and others slow)...there are too many variables, I'm really stuck and I can't understand the difference between these machines. The security parameters seems to be the same, I tried to change them at once...

Please, help me

Cold

This is a great article about why HTTP Post is more expensive than GET. Basically it queries twice and sends more bytes over the wire.

http://msmvps.com/blogs/omar/archive/2006/09/22/Atlas-2_3A00_-HTTP-POST-is-slower-and-it_2700_s-default-in-Atlas.aspx


Thank you very much for your reply. The problem is I'm not using any framework at all and all the requests I'm doing I have written in Javascript code by myself. I checked the code many times, but I couldn't find any problems on it. And I don't have the problem of the double request, as I'm sending just one POST request with the body togheter. And, even if I found a reason for the POST to be slower than the GET, I could not understand why in some machine every request is slow and in others they are so fast (using IE)! There should be some reason, but until now I didn't find any...


I don't understand what about the article doesn't apply to your situation. Basically

1) the browser waits for the server to respond "100 Continue" before the form is submitted. There is no such delay for GET requests.

and 2) the data itself contains additional info such as content types and etc. There are actually 2 requests going on for each POST, and the actual data is twice as long. It's nothing to do with you actually manually sending 2 requests.



This can be true using Atlas, but I'm actually monitoring the requests using Fiddler, and I don't have 2 requests! I have just one request, with the body I have specified on the send() method. I don't have any of the behaviours that the article is talking about. There is just an HTTP request (with method POST) and the resposte to the request, nothing more!

Hope this help to understand my problem...

Cold

Why Properties Sub Controls?

I don't understand why ACT always uses a special sub control within its controls.

Usually in ASP.NET controls are designed to have attributes on their own. Why this design?

TIA,

Axel Dahmen

Hi Axel,

The Toolkit sits directly on top of the ASP.NET AJAX Framework, which chose to use this approach. I think it's because this is how control extenders work in WinForms and they were going for a familiar approach - but this has actually been changed in the beta so that the properties, etc., have been moved up to the extenders.

Thanks,
Ted

Why Response.Redirect() opens up a new browser window in AJAX?

I have an AJAX enabled page displayed in amodal dialog, When I click on a button that has a Response.Redirect() code, a new browser window gets opened, which is weird and not the behavior that I expect.

I should note that this page worked properly before adding the AJAX related stuff.

I highly appreciate any insight into this problem.

try use server.transfer


I had already tried the Server.Transfer but I got a client side alert: "Sys.WebForms.PageRequestManagerParserErrorException: The message recieved from the server could not be parsed,..."
Try to navigate to next page in Javascript instead of on Server side. I think this can solve the issue.

hello.

i think the problem is that submitting a page on a popup will open another window by default. you can workaround this by adding an iframe to your popup window which loads the page you need.


Thanks, I think the only workaround to my problem was to use the IFrame in the modal window, but still, I'm wondering why the use of Server.Transfer() caused the error in AJAX, and, why the Response.Redirect() would open up a new window, was I missing somthing or it's just the way AJAX works!

May I ask that Response.Redirect is logical/possible at all during a partial postback (for example in an updatepanel's button click event)?!

Simply move that specific button which yield Response.Redirect outside of the updatepanel, maybe it helps.


Yes, the button which yielded the Response.Redirect() or Server.Transfer() for that matter, was inside the UpdatePanel, I moved it outside the UpdatePanel and my problem was solved. Actually the UpdatePanel was inside a Container UserControl, I think I should make use of UpdatePanel more narrowly focused.

Thank you very much indeed.


response.redirect will be correctly interpreted by the ajax platform. you can check this by using ?a "normal" page. the problem that was happening here was related with modal dialogs and the issue described is not an ajax problem.

server.transfer won't work correctly with ajax and shouldn't be used from controls placed inside the updatepanel. this is understandable because partial postbacks expect to receive a predefined message from the server and whe you do a server.transfer you end up retunring a new page to the user which doesn't conform to the expected message.

So response.redirect works with ajax.

If ajax open the redirected page via javascript (maybe using window.open( ... ) ), that can be a problem.

Modern tabbed browsers are configurable how to treat popup pages from normal links or from javascript (new window, same window, new tab, disable totally javascript popups etc.)

I recommend for Robert to try the page in firefox, and play with advanced firefox settings (type about:config in the address bar, and play with "browser.link.open_newwindow.restriction" and similar settings, you can google for help how it works)

ps:

If the button must be in the updatepanel, maybe it is possible to register a script in the server side which open the new window by javascript (a more controlled way.)


I am also running into this problem and am unable to place the control outside of the Update Panel. I am not clear as to how an IFrame would be implemented. Is it meant that an IFrame should be used in place of the AJAX update panel or in addition to? How would this implementation work specifically?

Thanks for any information in advance.


MaybeScriptManager.RegisterPostBackControl could be used to eliminate this problem in some cases.

So leave your button (which has the codebehind redirect logic) in the updatepanel, but use the RegisterPostBackControl method so it will cause a full normal postback. That way you have a normal redirect, not the ajax client side redirect.


Thanks for the responses.

I did try the following on the control that is being clicked to fire the Redirect:

ScriptManager1.RegisterPostBackControl(this.testButton);

Unfortunately, this still launches a new window during the redirect.

Does anyone have any other ideas as to how i can do this? I would be open to attaching some javascript to the button in order to perform the redirect, however, I have already tried adding the following with no success:

ScriptManager.RegisterClientScriptBlock(this.buttonTest,this.buttonTest.GetType(),"Redirect","window.location = 'http://www.testpage.com'",true);


jriell:

I have already tried adding the following with no success:

ScriptManager.RegisterClientScriptBlock(this.buttonTest,this.buttonTest.GetType(),"Redirect","window.location = 'http://www.testpage.com'",true);

If you choose that way (custom client side redirect), I recommend the following to try:

Put a regular input button, link etc. in the updatepanel, for example:

<input type="button" value="test" onclick="window.location.replace( 'http://www.testpage.com' );" />

If that works, try the script withthe RegisterClientScriptBlock stuff.

why ScriptManager is not recognized by VS?

Hi,

I drag and drop AJAX ScriptManager control to the source view of default.aspx, here is the code (the third and fourth lines are for ScriptManager):

<%@dotnet.itags.org. Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
Status:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
<asp:ListItem Selected="True" Value="false">Active</asp:ListItem>
<asp:ListItem Value="true">Complete</asp:ListItem>
</asp:DropDownList>

But I found ScriptManager tag is underlined with curly red line. When I mouse hover on ScriptManager tag, I see a tip

Element ScriptManager is not a known element. This can occour if there is a compilation error in the website.

But I could compile and run the site successfully. The bugging thing is that all the AJAX control, such as UpdatePanel is not recognized by VS too.

any idea?

Thx

Tao

From what I know, this is what is happening...

The cause for this error is, in your web.config look for this tag...and change the tagprefix from default asp to anything else...

<controls>
<add tagPrefix="ajax" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls
and now change the <asp:UpdatePanel> to <ajax:UpdatePanel> . All your errors should be gone.

please Let us know if this fixes...


This does solve the problem. But I don't understand why. Originally, the AJAX control defined in System.Web.Extensions is registered as tagPrefix = asp. So when I use asp:ScriptManager tag, VS should be able to locate the assembly and recognize it, theoritically. Do you know why I have to replace "asp" prefix with something else, such as ajax?

Thx

Tao


Theoretically I too expected the same. We found this fix on some blog(Thanks to him for posting it), I forget the link!. But it solved the dirty red squiggly lines and I made a note of it. May be, experts here can give hind sight of why and the details behind this...

Happy Coding :)

Why ScriptManager in MasterPage is not enough to the toolkitExtender control?

This is the error I get when look on a page and drop the User control that include the ajaxTooltip from any type.

Any suggestion?

The Error

Do you use ScriptMangerProxy?you need to use ScriptManager/ ScriptManagerProxy both for master page.

Where to add the ScriptManager and where to add the ScriptManagerProxy to get a clear design time project developing?

To explain the controls, pages, masters I have, here are they:

1. A master page that include a ScriptManager (I try to include a ScriptManagerProxy also).

2. A page that inherit the MasterPage and have a User Control in it by design time(drag and drop).

3. A User Control that have a modalPopupExtender in it, that work properly.

My only problem that other developers use my User Control in them Pages and the User Control(that added to the page) raise a:

Error Rendering Control

An unhandled exception has occurred.

The control with ID 'MpdalPopupExtender1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

What can I add to the Page, Master or may be web.config?