Use of __EVENTARGUMENT in postback
This may be a basic question. I know __doPostback()
function accepts 2 arguments, eventtarget
and eventargs
. eventtarget
is used to identify the control that causes postback. Then what is the use of eventargs
in __doPostback
function?
I saw the __doPostback
function always set the __EVENTARGUMENT
hidden field to nothing for any postbacks caused by controls wit开发者_JS百科h even autopostback to true or a control like linkButton.
Please give me your input.
If you want to assign the _EVENTARGUMENT you can manually invoke the postback with javascript:
javascript:__doPostBack('MyControl', 'myArgument');
This site explains how ASP.NET uses the postback mechanism: http://aspalliance.com/895_Understanding_the_JavaScript___doPostBack_Function.5
The __EVENTARGUMENT
is any relevant event arguments regarding the control performing the postback. For most controls, there are no specialized event arguments, and since event arguments are different for every control, null
is passed to represent a default argument should be created during the event sequence.
Try watching the __EVENTARGUMENT
that gets passed when you have a specialized control (such as a linkbutton in a gridview that has commandname/commandargument/etc assigned). You should begin to see values getting passed.
精彩评论