So one thing I often do in the codebehind is setup the javascript events to avoid in-line code.
myButton.Attributes.Add("onclick", string.Format("fnDoSomething(this, '{0}', '{1}');", myList.CliendId, myStatus.CliendId));
Very standard, nothing exciting. But one day I forgot the quotes:
myButton.Attributes.Add("onclick", string.Format("fnDoSomething(this, {0}, {1});", myList.CliendId, myStatus.CliendId));
To my surprise in the script I had actually passed the myList and myStatus objects themselves.... not the IDs.
This seemed pretty cool, no need to do a document.getElementById. But I was worried this wouldn't work on all browsers or in all circumstances.
Can anyone say difinitively if this is bad practice?