.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
satyapriyanayak
SP
abhays
Clintonzz
mattyclown
Post New Web Links

Which Row from DataGrid CheckBox

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :WPF
 
I have got as far as creating an Event handler from a DatGrid CheckBox click event and can have a MessageBox pop up to confirm this is working. I am trying to unravel how to identify which row of my Bound ObservableCollection has been selected. can anyone help please? <DataGridCheckBoxColumn Width="50" Header="Select" x:Name="chkSelection"> <DataGridCheckBoxColumn.ElementStyle> <Style TargetType="CheckBox"> <EventSetter Event="CheckBox.Click" Handler="OnCheckBoxClick" /> </Style> </DataGridCheckBoxColumn.ElementStyle> </DataGridCheckBoxColumn> Private Sub OnCheckBoxClick(ByVal sender As Object, ByVal e As RoutedEventArgs) Dim test As String test = e.Source.ToString() MsgBox("CheckBox " & test) End Sub   Miswod?  


View Complete Post


More Related Resource Links

WPF Datagrid with multiple row selection/checkbox column template

  
Hello, I am using the WPF Toolkit Datagrid with a checkbox defined in a template column/template cell. We are using the checkbox template so that selecting the checkbox will also highlight the row in the datagrid. Here is the template definition: <dg:DataGridTemplateColumn MinWidth="50" Width="Auto" Header="" CanUserReorder="False"> <dg:DataGridTemplateColumn.CellTemplate> <DataTemplate> <CheckBox IsChecked="{Binding Path=IsCheckedm, Mode=TwoWay}" /> </DataTemplate> </dg:DataGridTemplateColumn.CellTemplate> </dg:DataGridTemplateColumn> We are allowing multiple row selection in the datagrid and using MVVM (using MVVM Light). We would like to keep a list in the View Model of selected rows as they are selected/unselected. Any suggestions on how we can leverage MVVM to keep the list of selected/unselected elements current. Many Thanks --Sam

Datagrid checkbox check uncheck in single click

  
Hi, I have a datagrid colums of checkbox type. Users have to click twice on the checkbox to check or uncheck. Is there a way to do this in one click. Thanks Vijay

Getting a Checkbox in a datagrid to check before RowDetails expand the row.

  

Hello,

I am having trouble getting a checkbox in my datagrid to check in certain situations. The row details in my grid cause the row to expand when the row is selected. When no row is selected, or a row below the row just clicked was the selected row prior to the click, things work fine (the checkbox I clicked on gets toggled and the row expands to show its rowdetails). If a row above the row I am clicking was selected (and therefore expanded, showing its rowdetails) when that row collapses, my current row moves up (because the row above collapsed) and the current row expands. However, the checkbox in that row (in the column that I clicked on) does not get checked in this case. I suspect it's because it is no longer in the space where the click occurred (because it works if clicking this checkbox/row doesn't cause it to move up before expanding). Is there a way to get the checkbox click to happen before the row selection? I seem to recall properties on controls in the past that indicated whether they answered before or after their child controls (maybe that was forms) but I cannot find any such property to set on the WPF DataGrid. Any suggestions? Thanks.

-Joe


How do I change a DataGrid checkbox without clicking twice?

  

I have a DataGrid with a checkbox column.  When I click on a checkbox, the DataGrid selects the appropriate row but doesn't change the checkbox, so I have to click the checkbox again to change it.

How do I make it so I only have to click once on the checkbox?

Thanks in advance,

rgames


create a checkbox programmatically in VB.NET for a datagrid view

  

My goal is to  that contains a splitter

and 2 DataGridview controls .  The first datagridview is used as a header only and the second datagridview

contains the rows and cell that will be populated with data.  This composite usercontrol replicates a datagrid

because I needed a caption property.

 

Although the datagridview has a checkbox column, I was not able to figured out how can I change the location of

How to check if at least one checkbox is checked in a DataGrid

  

Hi...

I was trying to find out if there are any check boxes checked in the datagrid, if non of them is checked it should show me an alert to select atleast one.

My problem starts when there is paging in datagrid...

not able to check the entire datagrid at a time in itemDataBound event for the checked check boxes !!!!!

 


Selecting One Checkbox Control In DataGrid Control Using MVVM Using Silverlight

  
In this post I will show you how to select single check-box control when you have single check-box control in each row of the datagrid control. As you all know that check-box controls are normally used for the multiple selection and radio buttons are used for single selection. But there are sometimes requirement that control should be check-box and selection should be single. Mean if user view data in the datagrid control then he/she should only select one check-box at a time not more then one. Main page is shown in the Image 1. Here you can see that I have placed check-box control in the first column of the datagrid control which I have also highlighted.

AJAX GridView Checkbox Select All in ASP.Net

  
In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

jQuery: Highlight Gridview Rows with Checkbox

  
Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

Gridview setup:

jQuery: Highlight Gridview Rows with Checkbox

  
Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

How to format and update GridView and DataGrid rows using JQuery

  
The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

Use Jquery with repeater, gridview, datagrid

  
Before we talk about jquery inside any itemtemplate (repeater, gridview, datagrid), we need to understand the basic use of jquery functions

ListBox tricky to set in a DataGrid/GridView

  
Listboxes are very tricky to set selected items in grid - there is no real nice way to do it. It would have been great if Microsoft included a property that accepts an array or comma separated values - or anything! But they only allow each item in the list to be selected individually. The way to do this in a grid is a bit messy, but it is fairly simple to implement. When a row is created (as per the event), select the items of the listbox as per the datagrid source data:

How to highlight datagrid or GridView row on mouse over?

  
This article will show how you can Ajax with GridView to display popup messages when mouse moves over certain column. In the demo project I have added first column as an image column with a help icon in it. This kind of implements a feature that if you want more information about the row you can move mouse over this icon, a asynchronous request is sent to server for data about that row and when call returns the returned message is show as a popup message.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend