In gridview’s column i have a linkbutton and a label under it.
I want to hide/unhide label when linkbutton is clicked. I want to use javascript because i don’t want any postbacks.
My java scripts function needs to receive the reference of label which corresponding to the linkbutton that was clicked. (then i will use document.getElementById(inputRef).style.display) to toggle the state.
How do I pass the needed label’s reference to the javascript function?
Thanks
One way is to manage this in your grid’s ItemDataBound event handler and pass the label’s ClientID as a string paramater for that JavaScript call.
e.g. myLinkButton.attributes.Add(“onclick”,”javascript:HidColumn(‘” + myLabel.ClientID + “‘);”);