Getting checkbox value from DataList.HeaderTemplate for use in ServerValidate event

A

Andy B.

I have a search form that is inside the HeaderTemplate of a DataList
control. I need to get a reference to the checkbox inside the HeaderTemplate
so I can use the value in the control validation ServerValidate event. How
would I do this? I tried:

dim SearchByDateCheckBox as CheckBox =
DirectCast(DataList.Controls(0).FindControl("ByDateCheckBox"), CheckBox)

It gives me index out of range exception. I can't figure out how to do this.
I need it outside of any of the databound/datalist events like the
ServerValidate event. Any ideas how to do this?
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top