Click here to Skip to main content
15,616,232 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have datalist that display image with its columns

how can i get rows data for selected datalist item into code

If your itemtemplate looks as
<asp:LinkButton id="lnkSelect" Text="Select"
CommandName="Select" runat="server" CommandArgument='<%# Eval("ID") %>'/>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

In your datalist item command
//find control for the textbox
TextBox TextBox1 =  (TextBox)e.Item.FindControl("TextBox1");
  //code to get the textbox value based on the ID in command argument. 
Share this answer
Check out this tutorial: ASP.NET QuickStart Tutorials - DataList[^]

It also explains how to select rows in a DataList.
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