Wednesday, March 21, 2012

ModalPanel - How can I us AJAX instead of postback to update database ?

I'm new to AJAX and this suite of tools. I have a page that when a user clicks a link button my ModalPanel with various input fields appears. When the user clicks the okay button I want to make an async call instead of having the page post back. I need to be able to call one of my business objects defined in C# so what is the best way to do this?

If you can provide details or even a small example I would appreciate it.

My code behind method looks like this:

void OnClick(...)

{

Broker b = new Broker();

b.name = NameTextBox.Text;

b.account = AccountTextBox.Text;

b.Save();


}

Why not just wrap the modalpopup in an updatepanel and let the page postback? It is easier then to have access to the server controls from the form and have full interaction with the other page elements during the postback in case you want to update other stuff on the page.

What benefits are you looking for by not posting back?

Jason

No comments:

Post a Comment