Script callback returning ViewState?
- From: "Flinky Wisty Pomm" <Pathogenix@xxxxxxxxx>
- Date: 1 Dec 2005 08:08:34 -0800
Okay, I'm pretty baffled by this one.
I've got a page in a popup which takes a postcode; looks up a list of
addresses for that postcode; then uses a callback to get the details
for a specific address, build a JS object and pass it back to the
window.opener.
This used to work, but without any obvious cause it has started
throwing an error. The error text comprises the XML returned from the
server AND (mysteriously) the viewstate. Here's the callback method:
<code>
public string GetCallbackResult()
{
return LoadSingleAddressAsXml(_callbackArg);
}
private string LoadSingleAddressAsXml(string addressId)
{
Connection accountDetails = GetAccountDetails();
PostcodeAnywhereProvider data = new
PostcodeAnywhereProvider(accountDetails);
FullAddress address = data.getAddress(addressId);
StringWriter Output = new StringWriter(new StringBuilder());
XmlSerializer s = new XmlSerializer( typeof( FullAddress ) );
s.Serialize(Output,address);
Trace.Warn(Output.ToString());
return outstring;
}
</code>
The trace shows a perfectly correct response without any additional
text.
The JS looks like this
<code>
addInitFunc(initCallback);
function initCallback()
{
pageUrl='/PostcodePopup.aspx';
_InitWebCallback();
}
function doCallback()
{
var list = getSingleElement("selAddress", "select");
var aId = list.options[list.selectedIndex].value;
WebForm_DoCallback('__Page',aId,receiveCallBack,null,oncallbackerror,true);
}
function onCallbackError(e)
{
alert("Oops! An error occurred while contacting the server!\nPlease
try again in a moment\n"+e);
}
function receiveCallBack(xml)
{
var oDomDoc = Sarissa.getDomDocument();
oDomDoc.loadXML(xml);
var oAddress = parseAddress(oDomDoc);
sendAddress(oAddress);
}
</code>
The onCallbackError function is called and my alert runs something like
Oops! An error occurred on the server, please try again in a moment
/wEWHQLggdzjDgLJrO+CAQLAzrGoBwLt/YqPAwLO547CDgLt/ZbPAgLO55qCDgLt/dIPAs7n1sIPAu39vs8DAs7nooIPAu39+o8BAs7nvsQEAu39xk8CzueKhAQCk6Wj9QcC7f2Cjg4Ck6WPtQcC7f3uzwECk6XL9QQC7f3qgQcCk6XXtQQC7f32wQYCk6WT9AUCzufeQwKTpf+1BQLO56oDAs7n5sMBAs7n8oMBOUBN2Lkkie4wjPMIfrnhEv/BivE=
<Address Building="My Parent's Address" Street="My Parent's Road"
Locality1="Deepest Darkest Derbyshire" Locality2=" Locality3=""
town="None Worth Mention" postcode="ABC 123" county="Derbyshire"
country-id="335" address-id="0" />
.
- Follow-Ups:
- Re: Script callback returning ViewState?
- From: Nilesh Deshpande
- Re: Script callback returning ViewState?
- Prev by Date: VS 2005: Web & namespaces
- Next by Date: Re: to read Web.Config Section
- Previous by thread: VS 2005: Web & namespaces
- Next by thread: Re: Script callback returning ViewState?
- Index(es):
Relevant Pages
|