Answer: With the help of ClientId we can pass textbox control id from code-behind to Javascript function.
For Example:-
//Aspx Part
function get_value(id)
{
var value = document.getElementById(id).value;
alert(value);
}
//Code-Behind Part
ScriptManager.RegisterStartupScript(Page, typeof(Page), "message", "javascript:get_value('"+ txt_name.ClientID +"');", true);
Asked In: Many Interviews |
Alert Moderator