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


Top 5 Contributors of the Month
Jean Paul
Subhransu Sekhar Jena
satyapriyanayak
SP
abhays
Post New Web Links

WPF Datagrid with multiple row selection/checkbox column template

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :WPF
 
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


View Complete Post


More Related Resource Links

Multiple Column Dropdownlist for the ASP.NET DataGrid

  
Based on my previous control "Multiple Column DropDownList for ASP.NET", I received many emails asking for the same control to be used in the DataGrid for web applications. Here we go.. This control can be used as the regular MS DropDownList in the DataGrid and also as a regular dropdownlist. It has all the properties, like DataTextField, DataValueField, DataSource, SelectedIndex etc. The download file contains the samples both in VB.NET and C#. In this sample, I have used the Northwind database of SQL Server.

wpf datagridview checkbox column selection not working fine.

  
Hi Experts,in my c#.net windows based wpf application i added  a datagridview.dynamically i added checkboxcolumn to that datagridview DataGridViewCheckBoxColumn cbCol = new DataGridViewCheckBoxColumn(); GridSource.Columns.Add(cbCol); and another column is string. to this column am hardcoding the values DataTable _datatable = new DataTable(); _datatable.Columns.Add("Name", typeof(string)); _datatable.Rows.Add("CSRs"); _datatable.Rows.Add("Customers"); GridSource.DataSource = _datatable; till here fine am getting two columns (checkbox and Name)when i am trying to check those checkboxes problem comming.am trying to get the count of the checked rows for that i used below code int cbcount = 0; foreach (DataGridViewRow _dgRow in GridSource.Rows) { if ((bool)_dgRow.Cells[0].Value) cbcount++; } cbcount will give the checked count.but the problem raising here if i check 2 rows it giving 1if i check 5 rows it giving 4if i check 1 row it giving me 0means am getting n-1 resultwhere i did wrong??

Accessing Combobox inside WPF Datagrid Template Column

  
Hi, I am creating a WPF datagrid template column with combobox. The problem that I face now is, I am not able to bind a table to the combobox inside the WPF datagrid template column. Here is the code snippet. <dg:DataGrid x:Name="Students" AutoGenerateColumns="False" Loaded="OnLoad"> <dg:DataGrid.Columns> <dg:DataGridTextColumn Binding="{Binding Path=Name}" Header="Name" Width="75"/> <dg:DataGridTemplateColumn x:Name="Dept"> <dg:DataGridTemplateColumn.CellTemplate> <DataTemplate> <ComboBox x:Name="DeptId" ItemsSource="{Binding}" SelectionChanged="Dept_SelectionChanged" DisplayMemberPath="{Binding Path=DeptName}" SelectedValuePath="{Binding Path=DeptId}" SelectedItem="{Binding Path=Belongs}"/> </DataTemplate> </dg:DataGridTemplateColumn.CellTemplate> </dg:DataGridTemplateColumn> </dg:DataGrid.Columns> </dg:DataGrid> Please help me to find out the way to assign a dynamic source to the combobox through code behind file. Thanks in Advance!!! Best Regards, Subalakshmi Vijayarajan.

iterate throw rows of Template Column in Datagrid

  

Hi

I am using WPF DataGrid (VS 2008). i am using Template column with a button in it i want to change the content of the button(Caption) when it is clicked .i am doing it in its click event ,but it  changes the content of only the button clicked(only one row). i want to change the content of button in all rows.

how can access the button instance of all rows in this template column.

Regards:

Naseer


Display "allow multiple selection" column data as multiple items

  

I have a list that contains secretary assignments. There is only 2 columns. The secretary column is person/group lookup column and the attorneys column is also a person/group lookup column but "allow multiple selections". Here is a sample of item:

Secretary: Lisa White

Attorney: Joe Smith; John Fox; Michael Wrox.

I would like to create a view that display as

Attorney            Secretary

Joe Smith          Lisa White

John Fox           Lisa While

Michael Wrox    Lisa While

I know the out of box view will not let me do that . I just wonder if there is a work-around solution. Many thanks.

  


ASP.NET Multiple Selection DropDownList with AJAX HoverMenuExtender

  
Recently, I was looking for a multiple selection dropdownlist control for my new project. After spending some time researching for it, I decided to put together all my finding in one web user control. This web user control consists of an ASP.NET AJAX HoverMenuExtender, JavaScript, StyleSheet and CheckBoxListExCtrl . The final product will work with or without a MasterPage and you can drag and drop more than one instances of the control on to the page.

DataGrid: Tailor Your DataGrid Apps Using Table Style and Custom Column Style Objects

  

One of the most enduring challenges in writing user interfaces is figuring out how to display large amounts of data efficiently and intuitively without bewildering the user. The problem becomes particularly thorny when the interface must reflect hierarchical relationships within the data that the user needs to modify. The Windows Forms DataGrid control gives developers a powerful and flexible tool to meet this challenge. This article explains its basic operations and shows how to extend the DataGrid to display columns of data in an application-appropriate manner.

Kristy Saunders

MSDN Magazine August 2003


RPC and C++: Build a Template Library for Distributed Objects Containing Multiple Interfaces

  

Building a C++ template library for developing distributed object-oriented applications using Remote Procedure Calls (RPC) allows the programmer to design RPC applications that are composed of components that implement multiple interfaces. This article demonstrates the use of techniques such as assembly-level thunks to build machine code on the fly, and C++ features such as templates, conversion operators, virtual destructors and virtual function tables. Along the way, familiar C++ interfaces and classes are transformed into a distributed application. The benefits of using distributed objects rather than raw remote procedures, which include writing fewer lines of code, is explained.

Ajai Shankar

MSDN Magazine November 2000


Checkbox will show panel based on selection without postback.. how to do

  

Hi..

I have Two Checkbox in my asp.net textbox..

First what i want is

based on two checkbox user has to be select any one only..

if checkbox1 is selected then Panel1 visible true without postback

if checkbox2 is selected then Panel2 visible true without postback


Configure BDC column to have multiple values selected

  

How do I Configure BDC column to have multiple values selected and make multiple entities data available in the same column.  Currently it supports only single value for an item.  This requirement is crucial need some solution immediately.


BDC Column with Ability to Select Multiple Values

  

Use Case:

We are creating a storage location for technical product articles. These will be SharePoint publishing pages. Each page will have metadata assigned to it to make it searchable by properties. The possible values for one of the columns (Part Number) could potentially be sourced by our ERP system. I'd like to do this to eliminate the possibility of free-text entry errors, but there are probably over 10,000 parts so a drop-down list isn't feasible.

 

Ideal Situation:

The end user enters the part number and clicks a button to verify it against a BDC entry from our ERP system. If they weren't sure on the part number they needed, they could do a lookup from that metadata entry screen. They'd need to have the option to add multiple part numbers as one technical product article could reference multiple part numbers.

 

Question:

Is BDC an option for all of this or am I looking at a custom metadata solution? I thought I heard along the way that BDC only supported one value choice, but I couldn't find a verification for that in the forums.

 

Thanks.


How to get character count in 'Multiple Text 'column using Calculated Column?

  

Hi All,

I have a multiple text box in a list

I want

  • A column which lists number of characters in multiple list column example 188, 199 etc
  • Multiple character column must not have more than 200 chars
Is this possible?

Appreciate all the help!

-saumil


validate the selection of atleast one checkbox in the gridview using javascript

  


Hi,
 i have a gridview with a checkbox in the templatefield as given  below,



<asp:GridView runat="server" ID="gvAsgnHw"  AutoGenerateColumns="False"   >
    <Columns>
        <asp:TemplateField><ItemTemplate>
        <asp:CheckBox id="cbAsgnHwGrid"   runat="server" /> </ItemTemplate></asp:TemplateField>


         <asp:BoundField DataField="Resource_id" HeaderText="Resource ID"/>
        <asp:BoundField DataField="Resource_name" HeaderText="Hardware Name" />
         
        </Columns>
    
</asp:GridView>


I want to check the selection of atleast one checkbox on a button click using javascript.
pls help


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