In the code snippet below, I have a function that handles the event when a treenode is changed:
protected void mytv_SelectedNodeChanged(object sender, EventArgs e)
{
TreeView tv = sender as TreeView;
var nid = tv.SelectedNode.Value;
ScriptManager.RegisterStartupScript(this, this.GetType(), "anyname", "show(nid)", true);
}
The variable nid in the code snippet above captures different values (1,2,3) based on the clicked treenode.
Is there a way to directly pass this nid value as a parameter to the show() javascript function?
If not, how should I handle this scenario?
Here is the definition of the javascript function mentioned in the code snippet:
function show(nid)
{
if (nid == 4) {
alert('testing');
}
else
{
alert('what???');
}
}