Access CheckBox in DataGrid ItemTemplate

Discussion in 'ASP .Net' started by =?Utf-8?B?TWlsYW5C?=, Jul 19, 2005.

  1. I wish to access CheckBox control in ItemTemplate, to set or get value.
    I use next code on event: ItemDataBound(...)
    //-------------
    e.Item.Cells[0].FindControl("CheckBox1")
    //-------------
    to access desired checkbox.

    Is there exist some faster way to access this control then method
    FindControl().
    Maybe something like: e.Item.Cells[0].Controls[0], to access control
    directly from index.

    Thanks
     
    =?Utf-8?B?TWlsYW5C?=, Jul 19, 2005
    #1
    1. Advertising

  2. Yes, if you know the index you can use e.Item.Cells[0].Controls. I am not
    sure if it will affect the application performance in any way though.

    Eliyahu

    "MilanB" <> wrote in message
    news:...
    > I wish to access CheckBox control in ItemTemplate, to set or get value.
    > I use next code on event: ItemDataBound(...)
    > //-------------
    > e.Item.Cells[0].FindControl("CheckBox1")
    > //-------------
    > to access desired checkbox.
    >
    > Is there exist some faster way to access this control then method
    > FindControl().
    > Maybe something like: e.Item.Cells[0].Controls[0], to access control
    > directly from index.
    >
    > Thanks
    >
    >
     
    Eliyahu Goldin, Jul 19, 2005
    #2
    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. Bennett Haselton
    Replies:
    1
    Views:
    5,407
    Joe Fallon
    Sep 24, 2004
  2. keerts23
    Replies:
    0
    Views:
    476
    keerts23
    Jul 29, 2009
  3. David C

    Checkbox in ItemTemplate

    David C, Nov 30, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    714
    Alexey Smirnov
    Nov 30, 2009
  4. Sung

    CheckBox in Datalist ItemTemplate

    Sung, Sep 20, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    182
  5. dean wilson

    Loading Itemtemplate with CheckBox dynamically in Gridview

    dean wilson, Jul 20, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    193
    dean wilson
    Jul 20, 2005
Loading...

Share This Page