lundi 2 mars 2015

How to pass codebehind information into javascript function


I have a button in my updatepanel and I'm trying to call a javascript function (after it does it's processing).


I put this code inside the Page_Load:



Dim cstype As Type = Me.GetType()
Dim cs As ClientScriptManager = Page.ClientScript
cs.RegisterStartupScript(cstype, "modalScript", "jsModal('" + msg + "');", True)
keywordSearch.Attributes.Add("onclick", "jsModal('" + msg + "');")


Client Side javascript:



function showModal(msg) {
$("#modal-content, #modal-background, #modal-close").toggleClass("active");
var returnString = msg;

$('#modal-content div').each(function (index) {
$(this).html(returnString);
});
}


How do I pass the values I gather from the server side click event into the javascript function?





Aucun commentaire:

Enregistrer un commentaire