![]() |
|
|
|
#1 |
|
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. =?Utf-8?B?QW5kcmV3?= |
|
|
|
|
#2 |
|
Posts: n/a
|
Use RepeaterItem r in MyRepeater.Items.Controls(0)
Regards, Sachin Saki ..NET Developer - Capgemini, INDIA "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 > > "Andrew" <> wrote in message > news:FCDB6DC6-0AE7-4FE6-9856-... > > 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. > > > =?Utf-8?B?U2FjaGluIFNha2k=?= |
|
|
|
#3 |
|
Posts: n/a
|
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 "Andrew" <> wrote in message news:FCDB6DC6-0AE7-4FE6-9856-... > 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. Eliyahu Goldin |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ASP.Net - Data Repeater | vbnetman | General Help Related Topics | 0 | 01-07-2008 11:34 AM |
| Aironet 1130 Transparent Bridge & Repeater | gman | Hardware | 3 | 09-21-2007 03:33 AM |
| cisco 1200 repeater mode | danielb | Hardware | 1 | 11-03-2006 01:39 AM |
| Are there receivers that could correctly detect Dolby Digital EX? | chromallly@yahoo.com | DVD Video | 15 | 08-01-2005 02:47 PM |
| need app to detect ntsc or pal | free2002 | DVD Video | 4 | 03-06-2004 09:41 AM |