user3841736 user3841736 - 6 months ago 24
HTML Question

OnClick cant find the sub i'm calling

I'm building some html text to put on a window.
It works mostly as intended but a button I'm displaying - when clicked cant find the subroutine I'm calling. I just cant see what I've missed or doing wrong. Not sure if I need javascript? Thanks.

'OpenImage' is a subroutine on the server side. I pass this some variables.
'details' is the text string I'm creating.

details = details & "<input type=""image"" runat=""server"" ID=""ButtonOpen"" src=""../Images/icon_view.gif"" OnClick=""openimage('" & recDataSP.ItemUkey.ToString() & "','" & quote & "','')"" />"

Answer

If I am reading your question correctly shouldn't you be declaring your button with the javascript and then declare your image.

<button id="BtnSave" runat="server" OnClick=""openimage('" & recDataSP.ItemUkey.ToString() & "','" & quote & "','')"" />"><img src="Images/save.png" />Save</button>