Pass Value(databinder.eval) to Javascript Function

July 15, 2009

In some scenario we have to call Javascript Function with dynamic parameter values.

Take a scenario in which we have to pass variables to javascript on ‘onchange; event of Textbox which is in TemplateColumn of gridview.

Here is the Small Example for the same.

I have a Javascript Function with the name ‘processRequest’ with three Parameters like sender of type object, columnName of type string and ID of type int. i want to call this function while user has changed text in Gridview Textbox.

Here is my Javascript Function’s Decalration:
function processRequest(sender,columnName,ID)
{
var Values = sender.id+”/@,@,@/”+sender.value+”/@,@,@/”+columnName+”/@,@,@/”+Qid;

alert(Values);
}

now to call this function i have added ‘onchange’ event of the Textbox like this:

ProcessRequest

Thats it!!!!

Note : i have known the ASCII character for the Single Quote from HERE