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


Post New Web Links

WPF get selected cells on sorted datagrid

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :WPF
 
hello, how can i get the selected rows - and then each (visible) cell separately on a sorted datagrid? something like datagrid.SelectedCells[i][j], but with sorting taken onto account. Thanks


View Complete Post


More Related Resource Links

DataGrid cells ImageUrl properties problem

  
At the outset i would like to welcome all as this is my first post on this forum :) probably i've got a simple problem for most of you, namly:   I want to dynamically replace ImageUrl into DadaGrid cell. I've already prepare a right type of field (Image Field) and this is my code:   Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.Cells(3).Text = "1" Then e.Row.Cells(3).Text = "Online" DirectCast(e.Row.Cells(4).Controls(0), Image).ImageUrl = "~/Css/green.png" 'e.Row.Cells(9).ForeColor = System.Drawing.ColorTranslator.FromHtml("#489A38") 'e.Row.ForeColor = System.Drawing.Color.LightGray Else e.Row.Cells(3).Text = "Offline" DirectCast(e.Row.Cells(4).Controls(1), Image).ImageUrl = "~/Css/red.png" End If End If End Sub And i.ve got this error: Specified argument was out of the range of valid values.Parameter name: index Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and whe

How to loop on controls in cells of WPF DataGrid?

  

How to loop on controls in cells of WPF DataGrid to read values from and append events to?

 


"The selected cells are read-only" error on Custom Field when trying to insert in Datasheet mode

  
I have a custom field that works completely fine. Yesterday our QA team found out that when trying to insert in Datasheet format, the error "The selected cells are read-only" was thrown. Any ideas? I tried passing the following property to my fldtypes_field.xml file:

    <Field Name="ReadOnly">FALSE</Field>


No luck.
Victor Palma

WPF Selected xml node from treeview, I want to populate a datagrid with that node and all child node

  
I have populated a tree view from a xml.  I know want to take the node and all children that has been selected by double clicking on the tree node and populate a data grid.

Nested DataGrid - Accessing parent selected row from child in MVVM

  
Hi All,

I have a nested datagrid. The child datagrid is inside the RowDetailsTemplate.
I have expander and collapse button to open the child datagrid. When i select the expander/collapse button, the row of the parent datgrid gets selected and the child datagrid is loaded with data. Next, i select the child datagrid row. So the problem is when i am selecting the child datagridrow, the parent datagrid row selection should be deselected.

This needs to be achieved in MVVM

Please help.

DataGridComboBox - pouplated combobox with values but can't get selected value from the datagrid da

  

I'm still learning WPF so doing something that I thought would be fairly straight forward. <Slap forehead> ... looks like I need to take more time with this.
Hoping that someone can help me with this:

I'm populating a combobox in a datagrid and this works.
I'm populating the datagrid using another dataset.  The combobox is not taking the stored value this dataset and setting it in the combobox as selected.

Here's the xaml:

  <DataGrid x:Name="dgNoteDetail" AutoGenerateColumns="False" Grid.Column="1" Grid.Row="6" Grid.ColumnSpan="10" ItemsSource="{Binding}">
            <DataGrid.Columns>
                <DataGridTextColumn Header="ID" Visibility="Hidden" Binding="{Binding Path=ID}"/>
                <DataGridTextColumn Header="Notes" Width="*" Binding="{Binding Path=Notes}"/>
                <DataGridComboBoxColumn Width="90" Header="Importance" SelectedItemBi

Datagrid selected row does not update database

  

I have a datagrid that has a text column and a checkbox,on a tab control. If I add a row, the last cell selected will not update in the database unless I tab to the next row before I save, or I can tab back a row. It is clear that any selected cell will not be updated in the database on exit or save ever though I am using EndEdit(). 

   private void saveToolStripMenuItem_Click(object sender, EventArgs e)

        {

            carrierBindingSource.EndEdit(); 

            coatClassBindingSource.EndEdit();

            passivationBindingSource.EndEdit();

            freightTermBindingSource.EndEdit();

            gaugeTypeBindingSource.EndEdit();

            gradeBindingSource.EndEdit();

            packTypeBindingSource.EndEdit();

            try

            {

                _context.SaveChanges();

            }


Edit GridView Individual Cells in ASP.NET

  
The ASP.NET GridView allows for a row of data to be edited by setting the EditIndex property of the GridView, placing the entire row in edit mode.

You may not want the entire row in edit mode if you are using DropDownList controls for several columns in the EditItemTemplate. If each DropDownList has many options then loading them all at once may result in a sluggish page. Also, if your data structure is more like a 2 dimensional array rather than a set of rows, you may want to edit each cell individually.

Here I will demonstrate how to achieve this and also how to deal with event validation without disabling it.

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

Edit Individual GridView Cells in ASP.NET

  
The ASP.NET GridView allows for a row of data to be edited by setting the EditIndex property of the GridView, placing the entire row in edit mode.

You may not want the entire row in edit mode if you are using DropDownList controls for several columns in the EditItemTemplate. If each DropDownList has many options, then loading them all at once may result in a sluggish page. Also, if your data structure is more like a 2 dimensional array rather than a set of rows, you may want to edit each cell individually.

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.

Dropdown list in ASP.NET - How to get value selected

  
am sure this must be very simple, but unforunately I can't figure it out.
I have the following code which populates the dropdown lists from the database. This works fine. Now, when the user selects a particular employee name from the list, I want to get the Employee Id of the selected employee. i.e. I need to get the "Eid" value. I can do this if the EId is loaded in the dropdown list, but in this case only the employee name is displayed. Please let me know howI can get the Eid value even though it is not loaded in the dropdown list.
I would really appreciate your help

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.

Gridview that exports selected rows to Excel

  
his seems like a messy workaround, but I ended up using two Gridviews - one to display my data and show my checkboxes, and the other which was invisible amd would eventually end up as my Excel spreadsheet.

Using the WPF Toolkit DataGrid

  
WPF comes with a large number of built in controls, but from the beginning it has lacked something that many application developers find extremely important - a DataGrid. You can use the ListView to create something approximating a DataGrid
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