Heh. This isn't really testing what you were asking about (i just noticed).
Let me try again ... yes it still works:
<asp:TemplateColumn>
<ItemTemplate>
<asp:Image id="Image1" runat="server"
ImageUrl="../Images/Completed.gif"
onclick="test(this)"></asp:Image>
</ItemTemplate>
</asp:TemplateColumn>
The word "onclick" has the red squiggly underline, but it can safely be
ignored.
Bob Barrows
Bob Barrows [MVP] wrote:
Ok, I found the time to test it (I was curious). This works fine:
<script type=text/javascript>
function test(obj)
{
alert(obj.parentElement.parentElement.rowIndex)
}
</script>
...
<asp:TemplateColumn>
<ItemTemplate>
<IMG src="../Images/Completed.gif" onclick="test(this)">
</ItemTemplate>
</asp:TemplateColumn>
Bob Barrows
Tim::.. wrote: The ASP:Image tag is in a templatecolumn within a datagrid!
I don't think this would work???
Any Ideas!
Thanks
"Bob Barrows [MVP]" wrote:
Tim::.. wrote:
Can someone please tell me how i execute an onClick event in an
asp:Image tag!
I want to do the following!
Thanks!
<asp:Image runat="server" ID="ibtnExpandResource"
ImageUrl="../images/user.gif" onClick="javascript:
OnPlusClick(this);" style="cursor:hand;"></asp:Image>
In Page_Load, do this:
ibtnExpandResource.Attributes.Add("onclick","Javas cript:
OnPlusClick(this);")
HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.