Use LinkButton to pull record from DataList
I have a DataList that is populated with a selection of records from a SQL server database. Inside each template I have a LinkButton called Update that is meant to extract the ticket number of the entry and then populate another panel with data using that number. I thought I was extracting the correct data using the following two lines of code (below); however, I discovered that this code pulls the ticket number from the first DataList item and not from the Item in which the update button was clicked. Could someone tell me how to retrieve the number from the specific row in which the update button is clicked?
Context.Items["ticketNo"] = ((Label)CdsDataList.Items.FindControl("ticketNoLabel")).Text;
string ticketLabel = Context.Items["ticketNo"].ToString();
Thanks in advance.