datatable

marking existing column as primary key in datatable

I have a datatable from database on the basis of some query. I want that datatable to have a primary key for an existing column. How can I do this? ...

Update DataGrid bound to DataTable after DataTable is altered WPF

I have a combobox where the user can select a particular year (populated by the database) and view particular information for the year. That information is stored in a datatable which is bound to a datagrid. I want it to recreate the data grid when I change the year. _PropertyTenantData is a DataTable that has 14 columns Property Id, Pr...

Changing data in datatable and it does not show in Grid

Hi I have a table adapter on a dataset which is linked to a datagrid with a binding source. Now i have a column in my grid that is a checkbox which if clicked i change a value of another column in the grid. So i do it on the cellvaluechanging event of the gridview and then I get the focused datarow in the datatable and change the oth...

Null Reference Exception when binding DataTable to GridView

I've been working on this for a few days now I every time I come back to this problem I just don't see why it's not working correctly. I'm trying to bind a DataTable to a GridView control that I create Dynamically. I create the GridView control, add it to a table, and then assign the DataSource property to my DataTable. This is the cod...

In WPF, how can I bind a datagrid column to a specific column of a datatable?

I have a Datatable with many columns, and a datagrid in which I need to display only a few of those columns. I need a codesample of how to do it. I found a whole bunch of examples telling me to turn AutoGenerateColumns to true and set the table as DataContext to display all the columns in my DataTable. And I guess I could then put in a p...

calculation between two rows of DataTable in C#

Hi. I have Datatable which has tow tables together appended. I have many rows in that two of which are Total and Rate.( Note this are the Rows in my Datatable). I want to calulalte the total amount by multiplying the two rows. How shall I do that. The datatables are coming from sql Compact and I cannot do their the calculation as it's no...

Add a row to h:dataTable via AJAX with request-scoped bean without losing the row data

I think the title tells it all: I want to add a row to dataTable over AJAX. The datatable has input fields where user can put text. As simple as that, a pretty common case. With session-scoped bean this no issue, as the same bean is updated over and over again. However, I want to do this in request scope. For each request, I guess I wan...

How to return a Date value from JSON to Google Visualization API

is there a way to retrieve date value from JSON in Google Visualization API? Here is the snipplet for playground please copy the code below into it When you run the code you won't have anything in result. you should remove the quotes from the date value I marked with comment in order to retrieve result. function drawVisualization() { ...

Improving DataTable performance

I have a DataTable populated with 250,000 records with 5 columns, I am iterating over this at least 500,000 times. The difference in performance between a table with 1000 records is massive and I can understand and appreciate why - however is there is a way to improve the performance? ...

jQuery DataTables Plugin Callback

Hi I need to cache the html of the table before applying DataTable plugin. I used to do it by caching the html and after it applying the plgin: var originalTableHtml = escape($('#DataTable').parent().html()); $('#DataTable').dataTable(DataTableOpts); However, now I need to do it somehow in another to do it. Is there any way to apply ...

Why can't I display data in DataGrid after executing Lambda Expression?

I have a data table. If I set the DataSource of a DataGrid to the data table it displays all of the data just fine. However if I use a lambda expression to filter out some of the data and then reassign the datasource it does not display anything. This is what I have tried... var AllPeople = from r in CompanyDataTable.AsEnumerable()...

C#: Iterating through a data table: Rows, Select() or AsEnumerable()

foreach (DataRow row in myDataTable.Select()) foreach (DataRow row in myDataTable.AsEnumerable()) foreach (DataRow row in myDataTable.Rows) Any differences? ...

ellipsifying the text in a yui datatable

hey I'm looking for a good way to ellipsify text in a yui datatable. By that I mean, formatting the text so that it fits nicely into its cell and has an ellipse (...) trailing it if the text had to be truncated. I want to do this wihtout the use of CSS selectors, because I have a large dataset and selecting each cell by classname would...

Using rich:dataTable how do i store current sorting and current page in a managed bean variable

Using richfaces 3.3.0 we have a rich:dataTable with sortyBy's in the rich:column components and with a rich:dataScrolling component. These allow the user to sort the table in any way they want and go through the pages, all in client memory. Usually our users spend a long time looking for a certain row by sorting and browsing the pages,...

Updating DataTable bound to ASP.Net DataGrid

Hey, I am having a problem updating a datatable that is bound to a datagrid. Tried a bunch of approaches but the problem is t*he underlying datatable reverts back to its initial state* everytime u click a command. Here's the example code: On Label Click: protected void OnUserDataGridCommand(object source, DataGridCommandEventArgs e) ...

Problem with the DataTable and DataGridView objects

Hello everyone, I have the following problem In my aplication I doing some calculations and after it put them into DataTable object (6 columns, data in the latest one is most important). To view the results I put them into DataGridView object and there is my problem. Depending on the data contained in the last column I want to mark the...

What is Limit for Total Number of Records in Datatable?

Hello All What is the total no of records that can be fetched in a Ado.Net datatable? ...

How to correct deserialization errors in a DataTable Visualizer.

I am writing a Debugger Visualizer for a DataTable to display the datatable as xml instead of in a grid. I am getting an error on the line: DataTable dt = (DataTable)objectProvider.GetObject(); The exception is "Exception has been thrown by the target of an invocation." with an Inner Exception of "Failed to enable constraints. One ...

Dynamically modifying .NET DataSet DataTable

I’ve got a predefined Dataset with DataTables and DataAdapters in my applications. However, I now want to be able to modify the SP in SQL Server to add fields as needed, and have that reflected in the DataSet’s DataTable dynamically. This goes from a WebService into XML then goes to the client and gets converted back to the DataSet and...

RichFaces ExtendedTableDataModel: sorting columns retrieves all rows

We use the ExtendedTableDataModel for paging. This is done to retrieve a set of results with Hibernate and load the next set when another page is requested. All works fine, but if we sort columns by using rich:column sortBy within the rich:dataTable then RichFaces tries to load all rows. We can see this while debugging the getItemsByRa...