views:

67

answers:

2

Hi,

how I can do a manuell postback in the code?

I don't want a Redirect, because e.g. the user has entered values in fields in the site and decide than to login. I only want a simple Postback.

A: 

What's your point? Do you want to generate a postback script?

Page.ClientScript.GetPostBackEventReference(this, "Arguments", false);

Afterward, for handling the postback you must implement the System.Web.UI.IPostbackEventHandler.

But if you want a cross postback, check it out:

http://www.c-sharpcorner.com/UploadFile/DipalChoksi/xpgpostbk_asp2_dc08102006235543PM/xpgpostbk_asp2_dc.aspx

Mehdi Golchin
+1  A: 

If you have link/image buttons on you page you can do:

__doPostBack('link/image button name',''); // in javascript

or if not:

var f = document.forms[0]; //if you only have one forms(this standard on asp.net)
f.__EVENTTARGET = 'some control name';
f.submit();
jerjer