Click here to Skip to main content
14,826,846 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
I am using update panel and datalist to repeat data. I want to view data Emp_id, Emp_Name its display correctly but i want to use the Emp_Id generate by the datalist to view some data from another table. But i can't do that. How can i retrieve the Emp_Id generated by the datalist to use in select sql command.

Ex:-Select * from Table where Emp_Id=?
what is the parameter use.
Emp_Id only generated in <%#Eval("Emp_Id")%> but i can't use it in the command because
this command is generated the Emp_Id
Here is the original command:
SELECT * FROM empdetails,department where empdetails.emp_allow=1 and empdetails.Emp_ID="?" and department.emp_status=1

Here select * from empdetails generate EmP_id and generate Emp_Id i want to use.

Please any one can help me.....Thanks in advance
Updated 13-May-11 1:21am
sudeshchandram 13-May-11 9:35am
Do you want to display the other table on click of parent row in the datalist??
For Ex : if you select first row then some more details about that row is displayed in other place?

try this link

Insert Update Delete in DataList[^]

//Put one Link button in your DataList
<asp:LinkButton ID="lnk_Update" CssClass="button" CommandName="GetData" CommandArgument="<%#Eval("EmpId")%>" runat="server" >

//Now in row command Event fetch this value in code behind and get your Data From the DataBase 
Hope this[^] also might help you.

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