dataview

Datatables, Dataviews and distincts! (ASP.Net/VB)

Has anyone got anything better than creating a copy of the original datatable and then looping through it to create a distinct view ? From what I've read and attempted, the dataview doesn't support distinct (currently system is in Studio.NET 2003 - looking to move to 2005 shortly but 2008 isn't on the radar - so if newer versions do, pl...

How to Naturally Sort a DataView with something like IComparable

Hey Guys, My DataView is acting funny and it is sorting things alphabetically and I need it to sort things numerically. I have looked all across the web for this one and found many ideas on how to sort it with ICompare, but nothing really solid. So my questions are How do I implement ICompare on a DataView (Looking for code here). ...

Is there a reference for the SharePoint XSLT extension functions?

There are a couple of different .NET XSLT functions that I see used in the out of the box SharePoint web parts (RSS Viewer and Data View web part). <xsl:stylesheet xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:rssaggwrt="http://schemas.microsoft.com/WebParts/v3/rssagg/runtime" ...> ... ...

How to set selected row of DataGridView to newly-added row when the grid is bound to sorted DataView?

I have a DataGridView bound to a DataView. The grid can be sorted by the user on any column. I add a row to the grid by calling NewRow on the DataView's underlying DataTable, then adding it to the DataTable's Rows collection. How can I select the newly-added row in the grid? I tried doing it by creating a BindingManagerBase object boun...

What SQL query or view will show "dynamic columns"

I have a table of data, and I allow people to add meta data to that table. I give them an interface that allows them to treat it as though they're adding extra columns to the table their data is stored in, but I'm actually storing the data in another table. Data Table DataID Data Meta Table DataID MetaName MetaData So...

Viewing selected columns

Hi all, I'm doing .NET 3.5 programming in VB for a class. I have a .mdb database with 3 related tables, and a table adapter with some queries on it that look like this: SELECT PropertyID, Street, Unit, City, Zip, Type, Bedrooms, Bathrooms, Area, MonthlyRent FROM tblProperties Then in a form i have a DataGridView. What i w...

SharePoint list.items.GetDataTable column names not match field names

I am binding an SPGridView to a SPList. As code samples suggest, I am using the following code to create a dataview based on the list. dim data as DataView = myList.Items.GetDataTable.DefaultView grid.DataSource = data etc... What I am finding is that the column names in the resulting dataview do not always match the source fields de...

Handling updates to a Cached DataTable when the users session holds DataViews based on that DataTable

My website runs on a single server. I am caching a DataTable. Each session has a refernce to it's own DataView referring to that DataTable. What I am worried about is when I need to make changes to the underlying datatable will they propagate to each of the sessions references to it. Or is there a better way to handle this situation. ...

Using a DetailsView in ASP.Net when using an ObjectDataSource or a SqlDataSource

How do you use a DetailsView control in Asp.NET? How do you change the labels to something other than the database field name? How do you hide some of the fields from the user? (which you need to query for because they are the identity fields - row-id, which you dont want the user to see)? ...

How do I display default text if a Data View Web Part in Sharepoint has no data?

I am trying to use the Data View Web Part in Sharepoint. There are many articles on the web related to populating it with data. My question is, what if the data source is empty? Is there a way to display a default message in this scenario? ...

How to get a value from a column in a DataView?

I have a dataview defined as: DataView dvPricing = historicalPricing.GetAuctionData().DefaultView; This is what I have tried, but it returns the name, not the value in the column: dvPricing.ToTable().Columns["GrossPerPop"].ToString(); ...

C#: Custom sort of DataGridView

I need to sort a DataGridView with Natural Sorting (Like in Explorer) so that numbers and text (in the same column) are sorted naturally, and not alphabetically (so that "place 3" comes before "place 20", etc.). I have a DataGridView, where I have set a DataView as DataSource. The DataView contains a DataTable which is created with some ...

How to create a dataview In Sharepoint with data from a join query?

I have 3 Lists in Sharepoint. I want to create a dataview that is a join of 3 tables. Table1 is joined with Table2 on FieldA Table 2 is joined to Table3 on FieldB Table1 has duplicate values in FieldA so I need to only return one value to join with Table2. In Access my query looks like this: SELECT DISTINCT WRK_InputWorkOrders.WorkOr...

What is the .NET DataTable best usecase?

I have three Tables Customers, Jobs, Orders I Also have these tables in the a DataSet, which conforms to the same constraints as those in the Database itself. Originally, my intention was to keep the Data in the DataSet, and create various DataView objects to display this data to the user, and also to perform any required manipulations...

How to sort a DataView in a case-insensitive manner?

I have a DataTable. I'd like to sort its default view by a column name 'city'. I'd like the sort to be case-insensitive. Here is the code I have: DataTable dt = GetDataFromSource(); dt.DefaultView.Sort = "city asc"; MyReport.DataSource = dt.DefaultView; Thanks. ...

DataView.RowFilter, multiple possible values on several columns

I have a dataview where the interresting columns are length, height, color1, and color2 where color1 and color2 can be any of yellow, red, blue, black, white, or green. What is the best way to apply a filter where I get the rows with a certain length and height but with only the colors red, blue, and green? The filter below feels a bit...

SELECT DISTINCT in DataView's RowFilter

I'm trying to narrow down the rows that are in my DataView based on a relation with another table, and the RowFilter I'm using is as follows; dv = new DataView(myDS.myTable, "id IN (SELECT DISTINCT parentID FROM myOtherTable)", "name asc", DataViewRowState.CurrentRows); "myTable" and "myOther" table are related...

Predicate on DataView Constructor?

I know this may sound crazy, but I swear that on two separate ocassions via intellisense I've seen an overload for the DataView constructor that took in a DataTable and either Predicate or Func, I don't remember what T was, either DataRow or DataRowView. But now I can't find it. It also took in another parameter, I want to say it was a C...

How to validate data input on a sharepoint form?

How does one verify a text field with another list's column? I am currently populating a Drop down list with a datasource and then comparing the text field with items in the dropdown using javascript. Is there a better way? The second problem I am having is how to trigger the Validate Function. I am aware of two custom forms for addin...

Adding row to binded dataview

I am in need to add row to the dataview My code is as follows DataGridViewSelectedRowCollection row = dataGridView1.SelectedRows; for (int o = 0; o < row.Count; o++) { DataRow myRow; myRow = (row[o].DataBoundItem as DataRowView).Row; DataRowView drv = dv2.AddNew(); drv = row[o].DataBoundItem as DataRowView; } It add...