I want to create at runtime some items that must not hit the "async postback".
Actually I have a button for each row in my grid view. This controls must not generate the partial postback but the complete postback ('cause the result must be the download of a report).
Actually I tried in 2 ways:
On page load
add the item to the ScriptManager via:
ScriptManager.GetCurrent(this).RegisterPostBackControl(control);
this code is hitted the right number of time, but partial postback is still generated
On item generation
in this event I do something like:
var button = (Control)sender;
ScriptManager.GetCurrent(this).RegisterPostBackControl(button);
Why isn't this working?
In both cases I hit the specific case and "register" the controls as "do full postback" so way do I get the partial one?
Thank you
I don't know what you mean by partial postback but I guess you are trying to do something on button click event which you want to occur after page load. There is a quick walkaround for this, on pageload event you can check which button was clicked.
if(IsPostBack){
clickedButtonID=Request.Form["__EVENTTARGET"];
}
I find out a solution that works and that does not involve any particular code / overriding.
I was focussing on the single "automatically-generated" button but when I start thinking about areas and parents everything goes fine.
As solution I simply register the WHOLE GridView to the Script Manager, by this way, all the controller inside generates a full postback instead of a partial one.
In my Page_Load I have now:
ScriptManager.GetCurrent().RegisterPostBackControl(grd_Reports);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.