Question

My repeater code looks like below,

<asp:Repeater ID="rep_test" runat="server" onitemcommand="rep_test_ItemCommand">
<ItemTemplate>
<div runat="server" CommandName="abc" CommandArgument='123'>
</div>

What I want is, when I click on div it should fire onitemcommand event,

Is it possible?

Was it helpful?

Solution

The only way you can do it to add a javascript and a link button. On click of a div click that link button.

You can follow the example in the following link

http://forums.asp.net/t/1379603.aspx

OTHER TIPS

I know this is a bit old, but I just searched it myself. The answer I used was Ashwini Verma's, but I don't know if the answer is clear enough, or maybe I went beyond what was intended, so...

I had a need for several image buttons providing a CommandName. However, I also needed to have text on the buttons, and I didn't really want to make new images with the current image and the text. This is how I solved the problem using a LinkButton as my "Refresh":

<asp:Linkbutton ID="Something" runat="server" CommandName="Refresh" Text="<div class='topbutton'><div align='center'><img height='21px' width='21px' src='imagepath/toggle.png' alt='Refresh'/></div>Refresh</div>"></asp:LinkButton>

I'm a new member to the site and cannot yet post images of the button, but I hope you get the idea.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top