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. Advertisements

  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. Advertisements

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,630
    Joe Fallon
    Sep 24, 2004
  2. =?Utf-8?B?RG90TmV0RGV2?=

    DataGrid and embeded Checkbox..How to find if checkbox clicked

    =?Utf-8?B?RG90TmV0RGV2?=, Oct 6, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,039
    David Wier
    Oct 6, 2006
  3. keerts23
    Replies:
    0
    Views:
    574
    keerts23
    Jul 29, 2009
  4. David C

    Checkbox in ItemTemplate

    David C, Nov 30, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    790
    Alexey Smirnov
    Nov 30, 2009
  5. Gregory Rampton

    Convert an MS Access Yes/No column to a checkbox column in C# datagrid

    Gregory Rampton, Aug 6, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    439
    Gregory Rampton
    Aug 6, 2003
  6. Joey Pang
    Replies:
    4
    Views:
    861
    Joey Pang
    Jun 13, 2005
  7. Sung

    CheckBox in Datalist ItemTemplate

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

    Loading Itemtemplate with CheckBox dynamically in Gridview

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