Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Charles #1
How Do I : Add a Click event to a checkbox in a DataGrid
Hello,
I need to know when a user clicks a checkbox, in a
datagrid, so I can then update the database. I.E. I need
to know which row has been clicked and which column.
Charles
Charles Guest
-
stumped...table - row - click event, cancel checkbox event
I have a html table and mutliple rows. On each row i put an onclick event that opesn a modal window and prompts the user for some information. I... -
how to use click event on a checkbox in cfgrid
I am using checkboxes in a cfgrid by putting type="boolean" in my cfgridcolumn tag The problem is, I need a click event to be fired when any of the... -
Checkbox in Datagrid doesn't fire event
I've added a Checkbox control to a Datagrid and would like to Enable/Disable a button based on whether the checkbox is checked. However, I'm trying... -
Click anywhere in a datagrid row to change checkbox column state
Yes. In ItemDataBound event filter out non-data items (header, footer) and for data items loop through Cells collection to set... -
Capture CheckBox Click Event
I have a datagrid with a checkbox column. The column is bound to adatabase, and I have no problem capturing a click event on the checkbox using the... -
Sonali.NET[MVP] #2
Re: How Do I : Add a Click event to a checkbox in a DataGrid
Check out
[url]http://www.c-sharpcorner.com/Code/2003/June/DataGridAndCheckBoxes.asp[/url]
Regards
Sushila
..NET MVP
"Charles" <CWildner@Bellsouth.net> wrote in message news:068d01c347c5$bb3c81a0$a001280a@phx.gbl...> Hello,
> I need to know when a user clicks a checkbox, in a
> datagrid, so I can then update the database. I.E. I need
> to know which row has been clicked and which column.
> Charles
>Sonali.NET[MVP] Guest
-
Charles Wildner #3
Re: How Do I : Add a Click event to a checkbox in a DataGrid
Miss Sushila,
Can this be "compressed" some more step? I was hoping for a one click
solution. And your example is a two click solution.
Thank you for responding.
Charles
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Charles Wildner Guest
-
Luke Zhang [MSFT] #4
RE: How Do I : Add a Click event to a checkbox in a DataGrid
You may need to set the CheckBox's AutoPostBack to true, see following
sample
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 45px; POSITION:
absolute; TOP: 28px" runat="server" Height="194px" Width="369px"
DataSource="<%# DataSet11 %>" DataMember="Table1"
AutoGenerateColumns="False">
<HeaderStyle BackColor="#aaaadd">
</HeaderStyle>
<Columns>
<asp:TemplateColumn >
<ItemTemplate >
<asp:CheckBox id="CheckBox1" AutoPostBack="True" Runat ="server"
OnCheckedChanged ="CheckBox1_CheckedChanged">
</asp:CheckBox>
...
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
Public Sub CheckBox1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs)
Dim cbox As CheckBox
cbox = sender
Response.Write(cbox.ClientID)
End Sub
The clientID should be like:
DataGrid1__ctl4_CheckBox1
And you get the row and column inforamtion form the string, for example,
current row is 4 (from "ctl4")
Luke
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Luke Zhang [MSFT] Guest



Reply With Quote

