I have no idea how to accomplish something like this, so here goes.
I have a datatable
that has the following data:
Room Cook Waiter Input
201 Joe Jim Green.png
202 Jack Mary Red.png
203 Jet Mark Yellow.png
204 Nick Jill Green.png
I have 3 PNG files: Green.png, Red.png, Yellow.png. Each PNG is 100x100px.
The data control that I've been using is a datalist
. Each datalist
item has the following: a 100x100px div
for displaying the PNG according to the Input
column and 3 labels, for columns Room
, Cook
, and Waiter
.
This is not an issue and it's already being displayed correctly: each datalist item is 100x100px in size and within this space I have 3 labels
displaying the other columns.
The bigger issue, which is where I'm stuck at, is being able to click on each datalist item and running server-side code. And when the server-side code runs, the codebehind will have the Room
, Cook
. and Waiter
in that datalist
item. This is where I'm really stuck at.
Most of the partial solutions I've seen have been with jquery, but I do not want to use that. Ideally, it would be to add a label over an image button, but that's not possible. Worse-case scenario would be to display the text outside the button, but that would ruin the design.
I'm including the aspx markup:
<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") %>)'>
<div style="width: 195px; height: 22px; padding-top: 5px; overflow: hidden;">
<div style="box-sizing: border-box; width:97px; float:left;">
<asp:Label ID="Label1" runat="server" Text='<%# Eval("RoomNum")%>' ></asp:Label>
</div>
</div>
<div style="width: 195px; height: 22px; box-sizing: border-box">
<asp:Label ID="Label2" runat="server" Text='<%# Eval("CookName")%>' ></asp:Label>
</div>
<div style="width: 195px; height: 22px; box-sizing: border-box">
<asp:Label ID="Label3" runat="server" Text='<%# Eval("WaiterName")%>' ></asp:Label>
</div>
</div>
</div>
</ItemTemplate>
</asp:DataList>
Any help is appreciated.