CheckBox in a datagrid control

Discussion in 'ASP .Net Web Controls' started by E-Cube, Dec 18, 2004.

  1. E-Cube

    E-Cube Guest

    Hello All,

    I have a datagrid that will retrieve data from my sql database, on the data
    grid once the data has been loaded is a checkbox per datagrid row.
    I would like to know what is the eventhandler should I be using to pick up a
    checked event from a checkbox in a datagrid control?

    Thank you in advance for any help.
    E-Cube
     
    E-Cube, Dec 18, 2004
    #1
    1. Advertising

  2. Hello,
    The eventhandler would be using the OnCheckedChanged event.
    You should put the checkbox as
    <asp:CheckBox ID="rrr" Runat="server" OnCheckedChanged="test"
    AutoPostBack="true"></asp:CheckBox>
    in the itemtemplate of a template column

    In the code behind you need to create a method test as follows:
    Public Sub test(ByVal sender As Object, ByVal e As System.EventArgs)
    Response.Write("Checked")
    End Sub


    This should work as normal.
    P.S. Please check that you don't re-bing the grid at postbacks as this
    would remove the event so the event handler won't work
    Regards
    Mohamed El Ashmawy
    MEA Developer Support Center
    ITWorx on behalf of Microsoft EMEA GTSC
     
    Mohamed El Ashmawy, Dec 19, 2004
    #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. tshad
    Replies:
    0
    Views:
    590
    tshad
    Apr 15, 2005
  2. Vikram

    disable checkbox list checkbox

    Vikram, Jan 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,433
    ThunderMusic
    Jan 25, 2006
  3. =?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:
    870
    David Wier
    Oct 6, 2006
  4. Joey Pang
    Replies:
    4
    Views:
    570
    Joey Pang
    Jun 13, 2005
  5. Imran Aziz

    checkbox value attribute in checkbox control ?

    Imran Aziz, Aug 6, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    243
    Imran Aziz
    Aug 8, 2005
Loading...

Share This Page