Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have a datalist i want to find out index value of the cell in which book_id==73
and want to show some labels text in dt cell
this is my datalist
ASP.NET
<asp:DataList ID="dl_cartitems" runat="server" 
                        onitemcommand="dl_cartitems_ItemCommand">
                  <ItemTemplate>
                  <tr bgcolor="#FFFFFF" class=" product-detail" >
                    <td width="14%" valign="top"> <img src='<%#"book_image/"+ Eval("Image") %>' width="128px" style="margin-top:10px;margin-right:10px;margin-left:10px;margin-bottom:10px" /></td>
                    <td width="43%"  valign="top" style="padding-removed10px">The Kite Runner by Khalid Hosseini <br /> <asp:Label ID="discount_message" runat="server"></asp:Label> </td>
                    <td  width="6%" align="center" valign="top" style="padding-removed10px"><a href="#">Edit</a></td>
                    <td   width="10%" align="center" valign="top" style="padding-removed10px"> $<asp:Label ID="lbl_parprice" runat="server" Text='<%#Eval("Price") %>'></asp:Label></td>
                    <td width="10%" align="center" valign="top" style="padding-removed10px">
                     <asp:DropDownList ID="ddl_quantity" runat="server" Width="60px" OnSelectedIndexChanged="ddl_quantity_selectedindexchanged" AutoPostBack="true" >
                    <asp:ListItem> 1 </asp:ListItem>
                    <asp:ListItem> 2 </asp:ListItem>
                    </asp:DropDownList> </td>
                    <td width="12%" align="center" valign="top" style="padding-removed10px">$<asp:Label ID="lbl_subtoprice" runat="server" Text='<%#Eval("Price") %>' ></asp:Label> </td>
                    <td width="5%" align="center" valign="top" style="padding-removed10px" ><asp:ImageButton ID="imgbtn_del"  ImageUrl="~/images/del.jpg" runat="server" CommandName="Delete" CommandArgument='<%#Eval("id") %>' ></asp:ImageButton></td>
                  </tr>
                  </ItemTemplate>
                  </asp:DataList>

this is my datalist now i want to find cell in which book_id is 73 and want to show some text in that cell's label
below code
ASP.NET
<asp:Label ID="discount_message" runat="server"></asp:Label>

thanks
Posted
Updated 23-Oct-13 1:17am
v4

try using data row bound event. It is fired after each row is bound and then you can use a variable to store index number.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900