I have a problem with an Image Button and its onmouseover
action.
In my ASPX file I have something like:
<script type="text/javascript">
function dosth() {
document.getElementById("btnload").click();
}
</script>
...
<asp:Panel ID="pnUp" Height="200px" runat="server"></asp:Panel>
...
<asp:Button ID="btnload" runat="server" OnClick="btnload_Click"
Visible="false" />
...
And in my ASPX .cs file something like:
ImageButton btnImg = new ImageButton();
protected void Page_Load(object sender, EventArgs e)
{
btnImg.ID = "btnImg";
btnImg.ImageUrl = "images/imgbutton.png";
btnImg.CssClass = rblSize.SelectedValue.ToString();
btnImg.Attributes.Add("OnMouseOver", "dosth();");
pnUp.Controls.Add(btnImg);
}
protected void btnload_Click(object sender, EventArgs e)
{
// stuff to do
}
But this doesn't work.
Do you know how to run C# function in onmouseover
action. The JavaScript function dosth()
is executing, but still it doesn't run the click function.