How do I set the value of a checkbox on my repeater control?

A

aaa

Hi,

I have a repeater that is assign an object and cranks out a bunch of
checkboxes.
That part works fine. In the object I am also passing over the values to
switch the checkboxes on and off.

How do I do that after the fact? I have tried looping thu after the
datasource is assigned but that doen't work.
And also how do I access each of the textbox controls by name if I don't
know what the name of the control is?

rptr.DataSource = _myobject;
rptr.DataBind();


foreach (RepeaterItem ri in rptr.Items)
{
CheckBox cbx = (CheckBox)ri.FindControl("ctl14_Checkbox_1");

if (cbx !=null)
{
cbx.Checked = true;
}

}
 
A

aaa

That's one piece of the puzzle thnx.
But how do I reference an individual checkbox when I do not know what it's
name is yet?
 
A

aaa

nevermind... thanks for all of your help!


aaa said:
That's one piece of the puzzle thnx.
But how do I reference an individual checkbox when I do not know what it's
name is yet?
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top