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

Discussion in 'ASP .Net' started by Andy B., Feb 20, 2009.

  1. Andy B.

    Andy B. Guest

    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?
    Andy B., Feb 20, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. headware
    Replies:
    2
    Views:
    590
    headware
    Mar 9, 2005
  2. =?Utf-8?B?RGF2ZQ==?=

    attaching an event to ServerValidate

    =?Utf-8?B?RGF2ZQ==?=, May 15, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    408
    =?Utf-8?B?S2VpdGg=?=
    May 15, 2007
  3. Aamir Ghanchi
    Replies:
    1
    Views:
    487
    Aamir Ghanchi
    Oct 2, 2007
  4. Andy B
    Replies:
    0
    Views:
    982
    Andy B
    Jan 23, 2009
  5. Antoine Oulevay

    ServerValidate event in DropDownList objects.

    Antoine Oulevay, Nov 17, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    193
    Mike Moore [MSFT]
    Nov 18, 2003
Loading...

Share This Page