View Full Version : Posting data back to the sever
oferbar
December 6th, 2006, 06:10 PM
Hi,
I have used the widget sample successfully.
However, I need to post the address list back to the server for processing in ASP.NET 2.0.
Do you have some sample code handy to show how to do this?
Many thanks
Ofer
kas
December 8th, 2006, 01:38 PM
From engineering:
I would suggest one of two things: 1) send the data up via AJAX by using an XMLHttpRequest and sending the contents of the text field as the body, or 2) submit the form with the textbox to the server and have the ASP page process it then (you can call form.submit() to programmatically submit the form).
To advise more specifically, I would need to know more details about the intended flow: is this meant to be done “in the background” on the page where the widget is launched, or is it “submitting” that page after names have been selected. If the former, XHR is the way to go; if the latter, form submission is probably a better choice.
Hope this helps, js
palizada
December 19th, 2006, 10:29 AM
Hi oferbar....
I´ve developed the plaxo address book in my aplication in ASP.NET 2.0 and wrote this code. . . i hope it help you.
1.- In function returned by the gadget put the __dopostback method: Inside the function i replace the invalid quoted chars and after rise the __dopostback function whit the id of my asp:button and the argument that will be received in the OnClick method on server side.
function onABCommComplete(data)
{
var contacts = document.getElementById(tbContacts);
var contactsToImport;
if (document.all)
contactsToImport = contacts.innerText;
else
contactsToImport = contacts.textContent;
var replaced = contactsToImport.replace(/"/g,"");
contactsToImport = replaced;
replaced = contactsToImport.replace(/ </g,",");
contactsToImport = replaced;
replaced = contactsToImport.replace(/>, /g,"|");
contactsToImport = replaced;
replaced = contactsToImport.replace(/>/g,"");
contactsToImport = replaced;
replaced = contactsToImport.replace(/>/g,"");
contactsToImport = replaced;
replaced = contactsToImport.replace(/ñ/g,"ñ");
contactsToImport = replaced;
replaced = contactsToImport.replace(/á/g,"á");
contactsToImport = replaced;
replaced = contactsToImport.replace(/é/g,"é");
contactsToImport = replaced;
replaced = contactsToImport.replace(/Ã/g,"í");
contactsToImport = replaced;
replaced = contactsToImport.replace(/í³/g,"ó");
contactsToImport = replaced;
replaced = contactsToImport.replace(/íº/g,"ú");
contactsToImport = replaced;
ClearContacts();
__doPostBack(btnImport, contactsToImport);
}
2.- In the codebehind you can parse the argument received like yuo want.
protected void proceedToImport_Click(object sender, EventArgs e)
{
string rawContacts = this.Request.Params.Get("__EVENTARGUMENT");
//put your code here.
}
palizada
December 19th, 2006, 10:32 AM
Hi,
I have used the widget sample successfully.
However, I need to post the address list back to the server for processing in ASP.NET 2.0.
Do you have some sample code handy to show how to do this?
Many thanks
Ofer
Hi oferbar....
I´ve developed the plaxo address book in my aplication in ASP.NET 2.0 and wrote this code. . . i hope it help you.
1.- In function returned by the gadget put the __dopostback method: Inside the function i replace the invalid quoted chars and after rise the __dopostback function whit the id of my asp:button and the argument that will be received in the OnClick method on server side.
function onABCommComplete(data)
{
var contacts = document.getElementById(tbContacts);
var contactsToImport;
if (document.all)
contactsToImport = contacts.innerText;
else
contactsToImport = contacts.textContent;
var replaced = contactsToImport.replace(/"/g,"");
contactsToImport = replaced;
replaced = contactsToImport.replace(/ </g,",");
contactsToImport = replaced;
replaced = contactsToImport.replace(/>, /g,"|");
contactsToImport = replaced;
replaced = contactsToImport.replace(/>/g,"");
contactsToImport = replaced;
replaced = contactsToImport.replace(/>/g,"");
contactsToImport = replaced;
replaced = contactsToImport.replace(/ñ/g,"ñ");
contactsToImport = replaced;
replaced = contactsToImport.replace(/á/g,"á");
contactsToImport = replaced;
replaced = contactsToImport.replace(/é/g,"é");
contactsToImport = replaced;
replaced = contactsToImport.replace(/Ã/g,"í");
contactsToImport = replaced;
replaced = contactsToImport.replace(/í³/g,"ó");
contactsToImport = replaced;
replaced = contactsToImport.replace(/íº/g,"ú");
contactsToImport = replaced;
ClearContacts();
__doPostBack(btnImport, contactsToImport);
}
2.- In the codebehind you can parse the argument received like yuo want.
protected void proceedToImport_Click(object sender, EventArgs e)
{
string rawContacts = this.Request.Params.Get("__EVENTARGUMENT");
//put your code here.
}
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.