Clientscriptmanager. getpostbackeventreference method andThe clientscriptmanager. getpostbackclienthyperlink method has the same functions. All scripts are generated on the client. When a specific event of the control is triggered, it can be sent back to the server.
Their performance on the client is a little different. getpostbackclienthyperlink performs as: javascript :__ dopostback ('mycontrol1', 'myanchor1'), and getpostbackeventreference performs as :__ dopostback ('mycontrol1 ', 'myancor1 ').
Where getpostbackeventreference can be used, it should be replaced by getpostbackclienthyperlink (personal opinion, for reference only ). However, it is not necessarily where getpostbackclienthyperlink can be used. I have read the source code of the two methods and called getpostbackclienthyperlink within the getpostbackclienthyperlink method. Internal String Getpostbackclienthyperlink (Control, String Argument, Bool Escapepercent, Bool Registerforeventvalidation)
{
Return("Javascript:" + This. Getpostbackeventreference (control, argument, escapepercent, registerforeventvalidation ));
}
What I wonder is, since getpostbackeventreference can be used instead of getpostbackclienthyperlink (personal opinion, for reference only), why does Microsoft not merge it into a method? In this way, you do not need to consider the differences between the two methods. I hope some friends can give a reasonable explanation.