简体   繁体   中英

asp.net + javascript passing argument to button click

I have a javascript script like this below which the 'args' contain a string that I want to pass it to my 'btnLoadGridFrTrans_VouHist' button click. Can someone please advice. Thanks.

function frmIframeChild_VouHist(args)

{            

 var btn = document.getElementById('<%=btnLoadGridFrTrans_VouHist.ClientID%>');            

 if (btn) btn.click();       

 }

  Protected Sub btnLoadGridFrTrans_VouHist_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLoadGridFrTrans_VouHist.Click
        LoadGrid()
        ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "Test", "$('#uidivCardInfo').css('display','inline');$('#divNewMembershipTypeIssuance').css('display','none');$('#divCard_Process').css('display','inline');ShowHide('Voucher_History','" + URLEncryption(CardNo) + "','success#tabs_Used');", True)
  End Sub

You could add a hidden field (containing the value of args) to the document just before submitting it. The click event could read the value of the hidden field via Request.Form[" fieldName "] .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM