开发者

__EVENTTARGET not populating after button click + C#/ASP.NET

开发者 https://www.devze.com 2023-01-09 20:59 出处:网络
I have an asp button that produces this html: <input type=\"submit\" name=\"ctl00$m$g_a2ba5666_c8e9_4bd7_a44a_f9407dbe2199$ctl00$btnAddWebPart\" value=\"Add Report\" id=\"ctl00_m_g_a2ba5666_c8e9_

I have an asp button that produces this html:

<input type="submit" name="ctl00$m$g_a2ba5666_c8e9_4bd7_a44a_f9407dbe2199$ctl00$btnAddWebPart" value="Add Report" id="ctl00_m_g_a2ba5666_c8e9_4bd7_a44a_f9407dbe2199_ctl00_btnAddWebPart" />

When the button is submitted and the page_load method is hit, I am trying to do this:

String target = Page.Request.开发者_如何学JAVAParams.Get("__EVENTTARGET");

but, for some reason 'target' is empty. I checked to see if __EVENTTARGET is getting populated and it is an empty string. Any ideas as to why this is happening? It is something really silly.

Thanks.


Wrap this button up in an ajaxtoolkit update panel. that way you can update the various page components (add / remove your web parts) within an async call.

This means that the page is partially rendered instead of it being the result of a full postback.

I agree with Josh on this ... handling the event in this way is ugly and against the intended purpose of this part of asp.net from microsoft.

partial postbacks dont result in that ugly flicker effect so this should produce the result you want and not effect the rest of the page.

0

精彩评论

暂无评论...
验证码 换一张
取 消