how can i bind datatable to datagrid by using dataGrid.DataContext .
just in c#code i mean no xaml code.
View Complete Post
please i need to know if i could bind dataGrid to dataTable Programmatically using wpf V.S 2010 (without using Xaml code)???
i google it before but i saw solution using (DataSet) and this not useful for me because its huge application.
Note : data source is MySql.
Thanks a lot .
In my WPF application, I want to create an Empty Table.
I've created an empty DataTable (created columns and rows) and i want to display it using DataGrid.
I can't make the DataGrid to work together with my DataTable...
(i'm creating my DataTable via code and not via XAML).
can anyone help?
I’ve a DataGrid bound to a DataTable, and I’ve a problem deleting rows programmatically.
If I add a new row (using UI) and I mark the row with an error (using SetColumnError), and press the Delete key, the new row is deleted,
everything is ok.
If I delete the new row (with errors) programmatically, the row is deleted, but no rows appear in the grid. There isn’t way to add
a new row anymore, the grid has no items.
If I delete the new row (programmatically) and it hasn’t errors everything is ok. The row is deleted, and a new empty row appears
in the grid. I can add more rows correctly.
I looking for good artical about the DataGrid architecture, logical & visual.
I try to understand whre datagrid store the new value of cell, when user edit row in DataGrid. I realize that DataGrid not hold Copy of data. instead it Hold pointer to DataRow. But DataRow got new value only after user end the line Edit.
the code like:
return the DataRow, not the new value during line Edit.
1. Where DataGrid Hold the new value?
2. How access to Visual Element of each cell, like TextBlock inside the cell from Code?
I need a datagrid control that has following features, besides other regular stuff like paging, sorting, filtering, etc:
The user should be able to -
1. Select columns to view
2. Select column Sequence
3. Select default sort column
4. Store the setting (as a view) and use it on next visit.
5. llow multiple such views to be stored for a user for future use.
All these settings should be saved and when the user comes back he gets the same settings.
Really appreciate your time and would love to get any ideas.
I am creating a simple shopping cart using a datatable that is passed into a session object. I have a small mini cart that displays the total number of items in the cart as well as the running total - this is displayed in a web control. When the web control starts up I run a try/catch to see if the session object exists, if it doesn't I create the datatable for the cart and store it in the session. I then have a datalist control that contains all the information for my products including an "add to cart" button. When the page loads everything looks fine. If I click on an "add to cart" button nothing happens to the session information. If I click on it again, the session information updates - displaying only one item is in the cart and then counts up correctly there after. Additionally, after adding an item, if I select a different item in the list, the same issue occurs. I am not sure why this is happeing, if anyone can give me an idea I would appreciate it.
iam insert record using datable in gridivew,iam using session to hold the record,
there is any other way to hold the record in datable.
dtempty.Columns.Add("storeid"); dtempty.Columns.Add("ratetypeid"); dtempty.Columns.Add("ratedesc"); dtempty.Columns.Add("slabs"); dtempty.Columns.Add("days"); dtempty.Columns.Add("rate"); dtempty.Columns.Add("contid"); dtempty.Columns.Add("continertype"); DataRow row; row = dtempty.NewRow(); row["ratetypeid"] = ddlratetype.SelectedValue; row["ratedesc"] = ddlratetype.SelectedItem.Text; row["slabs"] = ddlslabs.SelectedValue; &n