Click here to Skip to main content
16,016,391 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am Yash and i need to use the functionality of datalist in repeater..
I am directly giving an example...to clarify...
i have a table in sql (Employee)... Rows and columns are as follows..
emp_id    name    salary
1         yash    20000
2         tejas   10000
3         rahul   10000
4         keyur   15000

Now i have to display the above data as follows...But Using Repeater...
emp_id  name

1      yash
2      tejas
3      rahul
4      keyur

salary
 
20000
10000
10000
15000

This means i need to to display first two columns..After which i have to display the
third column below the first two columns...
Please Help Me... i have tried Many logics including literal coltrol.. but still i cant got this...
Also i have to use table,tr and td in this task...
So Please Provide me solution with example using Repeater and not a Datalist Control
Please help...
Thanks in Advance
Posted
Updated 20-Feb-12 19:44pm
v2
Comments
Anuja Pawar Indore 21-Feb-12 1:45am    
Added pre tag

Use table in the Repeater
<table>
<tr>
<td> <%#Eval("emp_id")%></td><td> <%#Eval("name")%></td>
</tr>
<tr><td colspan="2"> <%#Eval("salary")%></td>
</tr>
</table>
 
Share this answer
 
v2
Comments
yogesh a sharma 21-Feb-12 0:23am    
THANKS but it gives result as..
1 yogesh
15000
2 rahul
10000
2 tejas
10000
but i need as..
1 yogesh
2 rahul
3 tejas
15000
10000
10000
..... thats what i need.. please tell something
C#
<headertemplate> <table><thead>
<table><tbody><tr>
<th>
EMP-ID</th>
</tr></tbody></table></thead></table> </headertemplate>

Take heading's
then
C#
<itemtemplate>
<![CDATA[<%#Eval("Emp-ID")
</ItemTemplate>

make pass that as command argument and whichever elements u want to show in repeater put them inside itemtemplate as Eval it wil work as your requirement..


try this...
C#
%></itemtemplate>
 
Share this answer
 
v2
Comments
Anuja Pawar Indore 21-Feb-12 1:41am    
Added pre tag

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