cannot detect the repeater

G

Guest

Hi,

I display a repeater in a web page, when i click on the next button, I want
to loop thru the repeater to detect the checkbox controls. Previously this
code works, but now .... I used the debugger n found that the program cannot
even detect the repeater control coz it just skips past this line. I have
listed a abbrev. version of my code below:

private void btnNext_Click(object sender, System.EventArgs e)
{
tstdAnswer = "";
try
{
foreach(RepeaterItem r in MyRepeater.Items) <----
{ for (int i=1; i<=6; i++) { //6 checkboxes
CheckBox chk = (CheckBox)r.FindControl("chkbox"+ i);
if(chk.Checked == true)
{
tstdAnswer += "1";
}
else
tstdAnswer += "0";
}
}
}
}

TIA.
Andrew.
 
G

Guest

Use RepeaterItem r in MyRepeater.Items.Controls(0)

Regards,
Sachin Saki
..NET Developer - Capgemini, INDIA
"Eliyahu Goldin" ने लिखा:
 
E

Eliyahu Goldin

Andrew,

Probably you mean MyRepeater.Items is empty rather than there is no
repeater, otherwise you would get an exception.

Anyway, check EnableViewState properties for the page and for the repeater
and check the data populating logic in Page_Load .

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top