ThatRickGuy
Programmer
Hey Guys, I'm having a problem with an ASP.Net page, but it sounds like the issue is in the JavaScript.
Here is a super stripped down sample:
In the code behind page:
HTML:
It appears that the JavaScript object.Click() method is not actually causing a PostBack, it is just calling what ever JavaScript is associated with the client side click event.
Anyone know how to get around that?
-Rick
VB.Net Forum forum796 forum855 ASP.NET Forum
I believe in killer coding ninja monkeys.![[monkey] [monkey] [monkey]](/data/assets/smilies/monkey.gif)
Here is a super stripped down sample:
In the code behind page:
Code:
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
'I'm running this local on my dev box, so I see this
'messagebox when I click on the image button directly
MsgBox("Button Clicked, backend")
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Button1.Attributes.Add("onclick", "alert('button1 clicked'); document.getElementById('ImageButton1').click;")
End Sub
HTML:
Code:
<form id="Form1" runat="server" >
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="Images/btn_Upload.PNG" />
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
It appears that the JavaScript object.Click() method is not actually causing a PostBack, it is just calling what ever JavaScript is associated with the client side click event.
Anyone know how to get around that?
-Rick
VB.Net Forum forum796 forum855 ASP.NET Forum
![[monkey] [monkey] [monkey]](/data/assets/smilies/monkey.gif)
![[monkey] [monkey] [monkey]](/data/assets/smilies/monkey.gif)