no postback

M

MA

Hi!

I have a database-driven web user control. On this control i have a grid
with a datatable inside, getting info from db. Lets say it looks like a
sheet in ms excel.
My problem is that every time I push a button (ex save), the page reloads.
This takes a while and feels like overkill when I only want to update one
cell on my page.
Is there a way to go around this? Lets say I push the save-button and only
one cell is updated.

Anyone who have a solution to this?

/Marre
 
N

Nicholas Paldino [.NET/C# MVP]

Marre,

The only way to get around this would be to have the javascript on the
client side issue a request in the event handler for the button click. This
would most likely require that you have security permissions to instantiate
an ActiveX control (most likely the XML HTTP component), which are not
normally enabled by default.

I believe this strategy is used in some places in .NET 2.0, but it is
not browser-independent, so I wouldn't say you can rely on it as a solution
unless you can be assured that only IE clients will be used, and the
appropriate security settings are in place.

Hope this helps.
 
S

Scott C. Reynolds

Did you try putting an if statement for Page.IsPostBack? Then you can
only update what you want on postback, and leave all the rest as it was,
only to be loaded on first page load.
 
M

MA

Hi!

Yes, I did that. I don´t want the postback at all, but it seems like it´s
something I have to live with ;)

/Marre
 
M

Mohamoss

Hi Marre
one thing that you can do is to cache your control and make
only the save button to cause postback (set the rest controls
autopostback=false) .. hope that helps
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 
S

Scott C. Reynolds

Yeah, if the button causes data to go from the page to the database
there really isn't any way (that I know of) to avoid the round trip.
The best you could hope for is to minimize the amount of stuff that
happens during the trip.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top