Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends , here i am using literal control using repeater in my web pages

but i got error while build
here is my code

code behind
-----------
Scheme.Text = Convert.ToString(dtPOADetails.Rows(0)("SCHEME"))
Scheme_Number.Text = Convert.ToString(dtPOADetails.Rows(0)("SCHEME_NUMBER"))
person_id.Text = Convert.ToString(dtPOADetails.Rows(0)("PERSON_ID"))


aspx
----
ASP.NET
<asp:Repeater ID="Repeater1" runat="server" >
<HeaderTemplate>
<table border="0" cellpadding="2" cellspacing="6" class="gridStyle" align="center" width="100%">
 <tr>
<th nowrap="noWrap" style="font-weight: bold"> SCHEME</th>
<th nowrap="noWrap" style="font-weight: bold"> SCHEME_NUMBER</th>
<th nowrap="noWrap" style="font-weight: bold"> PERSON_ID</th>
</tr>
</Headertemplate>
<itemtemplate>
<table><tbody><tr>
<td> <asp:Literal runat="server" ID="Scheme" Text='<%#Eval("Scheme") %>'></td>

<td> <asp:Literal runat="server" ID="Scheme_Number" Text='<%#Eval("Scheme_Number") %>'></td>

<td> <asp:Literal runat="server" ID="person_id" Text='<%#Eval("person_id") %>'></td>
</tr></tbody></table>


i am getting error like this :
1.Scheme is not declared. It may be inaccessible due to its protection level.
2.Scheme_Number is not declared. It may be inaccessible due to its protection level.
3.person_id is not declared. It may be inaccessible due to its protection level.


Reply me as soon as possible

thanks in advance

Velsamy
Posted
Updated 8-Apr-14 21:41pm
v3

To Get the control within repeater you need to user find control property like

C#
Literal Scheme= (Literal )(Repeater1.FindControl("Scheme"));


Now, if you want to get each row data, then you have to loop on this repeater and get literal one by one in each row.
 
Share this answer
 
v3
Comments
avelsamy 9-Apr-14 6:30am    
hi Mr.Puneet,

i have done myself, thank you... then i should display only 13 of records in one page another 13 should be in next page wt i have to do...
Er. Puneet Goel 9-Apr-14 6:42am    
ok, all the best :)

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