Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > CheckBox in a datagrid control

Reply
Thread Tools

CheckBox in a datagrid control

 
 
E-Cube
Guest
Posts: n/a
 
      12-18-2004
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
 
Reply With Quote
 
 
 
 
Mohamed El Ashmawy
Guest
Posts: n/a
 
      12-19-2004
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid and embeded Checkbox..How to find if checkbox clicked =?Utf-8?B?RG90TmV0RGV2?= ASP .Net 1 10-06-2006 04:11 PM
checkbox value attribute in checkbox control ? Imran Aziz ASP .Net Web Controls 2 08-08-2005 11:12 AM
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked. Joey Pang ASP .Net Datagrid Control 4 06-13-2005 02:29 AM
Added CheckBox to a DataGrid Doesn't work with DataGrid.Enabled=False Amar ASP .Net 0 04-06-2004 10:14 AM
Added CheckBox to a DataGrid Doesn't work with DataGrid.Enabled=False Amar ASP .Net Building Controls 0 04-06-2004 10:14 AM



Advertisments