I have a DataList
that looks like this:
<div>
<asp:DataList ID="DataListDiv" runat="server" RepeatColumns="5">
<ItemTemplate>
<div style="padding: 8px">
<div style='width:195px;height:162px; background-image:url(<%# Eval("image_path","Styles/Images/{0}") %>)'>
<div style="width: 195px; height: 22px;">
<asp:Label ID="Label2" runat="server" Text='<%# Eval("CookName")%>'></asp:Label>
</div>
<div style="width: 195px; height: 22px;">
<asp:Label ID="Label3" runat="server" Text='<%# Eval("WaiterName")%>' ></asp:Label>
</div>
</div>
</div>
</ItemTemplate>
</asp:DataList>
</div>
This looks great. But now, I need to be able to click on the div
so that an event occurs (ie. a Click) and server-side code is invoked. All without altering the look of the div
. Essentially, clicking inside the div
will call some event handler, and this event-handler would have the information on the div that I clicked on.
So, for example, the datalist
shows that one div
has CookName
as Joe and WaiterName
as Mark. When that div is clicked, the server-side code will run and I will at that point that Joe & Mark are the two employees from that div.
Is this possible? I've searched, but I haven't found anything that may help.
Any help is appreciated.
Thanks.