datatable

How to filter out similar rows (equal on certain columns) based on other column data.

How would I select all rows distinct on Forename and Surname and where there's a duplicate select the one with the higher SomeDate, then Id if still duplicates e.g. For: | Id | Forename | Surname | SomeDate | ---------------------------------------- | 1 | Bill | Power | 2011-01-01 | | 2 | James | Joyce | 2011-02-01 | | ...

GridView Converting Current Page into DataSet/DatTable

I have a GridView ,I enabled Paging. I want to convert the current page of gridview into DataTable.Is there any extension method or techniques available to convert the current page contents of a gridview into DataTable? Thanks in advance. ...

datatable columns not accessible C# ASP.NET

I have this datatable public partial class class1 { private DataTable dt; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { dt.Columns.Add("Col1", System.Type.GetType("System.String")); dt.Columns.Add("Col2", System.Type.GetType("System.String")); bind(); ...

Sum selected rows in datatable only ?

Hi I have a datatable which has an amount column & a status column. I want to sum only those rows who have status '1'. How to do this ? I am summing the column via datatable Compute method. Please advice. ...

How to check whether datatable contains any matched rows ?

Hi fellows, I am using Compute for summing up a datatable which has a condition. Sometimes, there are no rows inside the datatable matching my criteria so I get an exception on Compute Object cannot be cast from DBNull to other types. Is there a way to check/filter the datatable to see if it has the desired rows, if yes only then I appl...

datatable styleing css

I want to style my datatable using ThemeRoller . already enabled jQuery UI ThemeRoller support in my datatable. I have only one row on the top and the Pagination numbers are styled fine. but i dont see any style on the rows, they are all the same. Is that the default setting or i am missing something. $(document).ready(function(){ $("...

Get table values in a collection for the same value in any one row using LINQ

I have a table with column having multiple identical values which associates with other row values. ID HValue Limit 0005 0 350.00 0005 1 0.00 0005 2 350.00 0005 3 350.00 0025 0 20.00 0025 1 0.00 I executed the stored proc and stored t...

Is there a JavaScript data table component that displays columns as rows?

I want to display a "flipped" (transposed) data table. E.g. given some data: [{col1: "abc", col2: 123}, {col1: "xxx", col2: 321}] It's displayed as +------+-----+-----+ | col1 | abc | xxx | +------+-----+-----+ | col2 | 123 | 321 | +------+-----+-----+ The rows should act the same as columns in a standard table. Is there some J...

Output DataTable XML in UTF8 rather than UTF16

Hi, I have a DataTable that I'm creating an XML file from using .WriteXML(..), although I have a problem with it exporting in UTF-16 encoding and there seems to be no apparent way of changing this. I understand that .NET uses UTF-16 internally within strings, is this correct? I'm then running the XML that DataTable.WriteXML() produces...

StackOverFlow on Application start point

I built a program, and i press a button, the program crashes. Here is the button's code: _alRecord.WriteXml(@".\alRecord.xml", XmlWriteMode.WriteSchema); Debuging returned StackoverFlow(location is marked in a comment), Here is the whole code: private string alFile = @".\alRecord.xml"; public DataTable alReco...

Remove row from gridview with datatable datasource

Hello. I am using VB.net. I have a gridview with a datatable datasource. What is the best option to update the datatable when i delete a row in the gridview and then show the gridview without that row? Thanks. ...

Updating a DataTable ?

Hey guys, I have an ASP.NET GridView bound to a DataView that contains a DataTable. I'm not using a DataAdapter. I want to update a row in my DataTable, so I do this: protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { DataView dv = (DataView)Session["My_DataTable"]; DataTable dt = dv.Table; i...

How to alias fields from a DataTable in LINQ?

How can I give an alias name to fields selected from a DataTable using LINQ? ...

How to Convert a LINQ result to DATATABLE?

Is there any way to convert the result of a LINQ to DATATABlE without stepping through each element? ...

C# SqlDataAdapter.Fill giving error about data conversion when passed datatable parameter

I'm trying to fill a datatable using a SqlDataAdapter in C#. I'm not very familiar with the objects, and am basically working off a template of someone else's code to try to figure out how it works. Here's the basic form. SqlCommand command = new SqlCommand(@"SELECT * FROM tblEmployees WHERE Name = " + firstSSN,connection); ...

Problem using streams and DataTable.WriteXmlSchema

I'm loading a datatable from the cache and I need to read it's schema, and then load that schema into another datatable. Here's the code I'm using: using (var ms = new MemoryStream()) { using (var xmlWriter = XmlWriter.Create(ms)) { tableWithSchema.WriteXmlSchema(xmlWriter); xmlWriter.Flus...

Exception was thrown when adding new rows to datatable

listA is list of integer dtListB is DataTable I'm checking that if StudentId of ListA doesn't exist in dtListB, then add it to the dtListB. Dim stidListA, stIdListB As Integer For Each la In listA stidListA = la.StudentId For n = 0 To dtListB.Rows.Count - 1 Step 1 stIdListB = dtListB.Rows(n)...

radio button default checked problem using jquery datatable aoColumns in chrome and Firefox

I am using jquery datatable in my asp.net mvc (C#) application Radio button is not selected by default when using aoColumns of jquery datatable in google chrome and Firefox. Html: <td> <%=Html.RadioButton("Password" + item.PasswordRequestId, RequestStatus.GRANT, true, new { @id = "RequestGt" + +item.PasswordRequestId })%> </td>...

Display datatable in ListView control (WPF)

How to display a DataTable in a ListView control in WPF? ...

Losing data when editing editable datatable (JSF2)

Hi there, I'm starting to code a little cookbook. Therefor i've created a page to add some menusteps, a menustep should describe how to cook the menu step by step. I have a datatable containing a list of MenuSteps. The user can click a commandLink to add/delete a new step. The Bean adds or removes a MenuStep of the list and rerender the...