Forcing a page to postback

  • Thread starter Thread starter John Morgan
  • Start date Start date
J

John Morgan

I suppose the answer to this is staring me in the face but....

How do I programmatically get a page to post back?

The actual situation is that I am using an aspx table control and
changing the text within a cell. Though the cell text is updadated
successfully it does not show up on the screen until it the page is
posted back..

At the moment I am using a button which does nothing, processes no
code, but ensure a postback .

I wish to be able to force this postback as soon as the text in the
cell is updated (programmatically) so that it shows up on the screen
immediately.

I would be grateful for any help,

Best wishes, John Morgan
 
You can setup a client side event that will make a javascript call
myForm.submit(). Alternatively you can use one of the methods exposed by the
Page class: GetPostBackClientEvent, GetPostBackClientHyperlink,
GetPostBackEventReference.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
If you are using a table, my guess is that you have multiple cells that you
will be updating, the postback will probably become really annoying.
You should probably look into hooking up ASP.Net Ajax http://ajax.asp.net
or Anthem http://anthemdotnet.com and refreshing just the table,
instead of forcing a postback on the entire page.

Also, tables are really heavy on the HTML and because of your choice not to
use a data grid, you probably don't care about paging, sorting, or
displaying hierarchal data. You would probably be better off writing you own
custom control to display CSS friendly Spans and Divisions.

Regards,
Brian K. Williams
 
Thanks both of you for your advice.

I am looking into it at this moment,

Best wishes, John Morgan
 
Back
Top