![]() ![]() ![]() Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to. If the LinkButton causes the postback (it is clicked and doPostBack is called to initiate postback), Click and Command event is raised on the server, latter being bubbled up if the LinkButton is in GridView, DataList etc. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Dim csm As ClientScriptManager = Page. command names etc aren't roundtripped to the doPostBack call since they are already set on the server. When javascript code makes a call to this javascript function, it will then perform a PostBack, which will mimic the action that occurs when the "MyButton" button is clicked. When the page is built, this javascript function will be available. The ASP.Net code will insert javascript code in my function to perform the PostBack for the "MyButton" control. In the code-behind, I'm creating my own javascript function. The ClientScriptManager.GetPostBackEventReference Method will build the code you need to use in javascript to perform a PostBack from a particular controlīelow is an example (in VB.Net). Var argument = ((Button)(sender)).CommandArgument //"MyArgument"ĪSP.Net provides a way for you to build a call to perform a PostBack from javascript. Var target = ((Button)(sender)).ClientID //"btnNew" Then, add the following method in the code behind: protected void DoPostback(object sender, EventArgs e) If you don't necessarily want to use JavaScript, modify the button's definition like this: In the code behind, in the Page_Load method, read the Request and the Request: protected void Page_Load(object sender, EventArgs e) Modify the button definition like this (I'm already assuming that it's nested inside an UpdatePanel): If you want to use your JavaScript function to trigger the postback, you need to replace the OnClick with OnClientClick. Hello Will, The standard work-around for this problem is to add a hidden button to the page and set its id to the form tag's DefaultButton attribute. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |