Search Results

Search found 117 results on 5 pages for 'dataview'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • How to filter a dataview

    - by dboarman-FissureStudios
    I have a dataview that contains a list of tables. I am reading in a list of values that I then want to apply as a filter to this dataview. The list of values is actually in the form of "table1, table2, table3". So I thought I would be able to use this as a filter on my dataview. SqlOp.CommandText = "select name from dbo.sysobjects where xtype='u'"; SqlOp.ExecuteDataReader(); DataView dv = SqlOp.GetDataAsDataView(); SqlOp.CloseConnection(); Returns a list of all the tables in a dataview. Any help on how to filter this dataview? Edit: Not sure if I was completely clear in what I seek to accomplish. To clarify, I am trying to figure out how/if .RowFilter will help me in filtering this dataview. Something like: dv.RowFilter = "name IN (table1, table2, table3)" // I know this doesn't work

    Read the article

  • Sort data using DataView

    - by Kristina Fiedalan
    I have a DataGridView with column Remarks (Passed, Failed). For example, I want to show all the records Failed in the column Remarks using DataView, how do I do that? Thank you. Here's the code I'm working on: ds.Tables["Grades"].PrimaryKey = new DataColumn[] { ds.Tables["Grades"].Columns["StudentID"] }; DataRow dRow = ds.Tables["Students"].Rows.Find(txtSearch.Text); DataView dataView = new DataView(dt); dataView.RowFilter = "Remarks = " + txtSearch.Text; dgvReport.DataSource = dataView;

    Read the article

  • Extjs DataView ArrayStore problem

    - by cvista
    Hi I have the following JS: http://monobin.com/__m1c171c4e and the following code: Code: var tpl = new Ext.XTemplate( '<tpl for=".">', '<div class="thumb-wrap" id="{Name}">', '<div class="thumb"><img src="{ImageMedium}" title="{Name}"></div>', '<span class="x-editable">{Name}</span></div>', '</tpl>', '<div class="x-clear"></div>' ); var store = new Ext.data.ArrayStore({ fields: [{ name: 'name' }, { name: 'ImageMedium'}], data: res.data.SimilarArtists }); var panel = new Ext.Panel({ frame: true, width: 535, autoHeight: true, collapsible: true, layout: 'fit', title: 'Simple DataView (0 items selected)', items: new Ext.DataView({ store: store, tpl: tpl, autoHeight: true, multiSelect: true, overClass: 'x-view-over', itemSelector: 'div.thumb-wrap', emptyText: 'No images to display', prepareData: function (data) { data.Name = Ext.util.Format.ellipsis(data.Name, 15); return data; }, plugins: [ new Ext.DataView.DragSelector(), new Ext.DataView.LabelEditor({ dataIndex: 'name' }) ], listeners: { selectionchange: { fn: function (dv, nodes) { } } } }) }); So binding the DataView to the child array of res.data.SimilarArtists But nothing seems to happen? prepareData doesnt even get called? What am i doing wrong? w://

    Read the article

  • Sort on DataView does not work if DataTable has zero rows

    - by BigBlondeViking
    We have a WPF app that has a DataGrid insode a ListView. private DataTable table_; We do a bunch or dynamic column generation ( depending on the report we are showing ) We then do the a query and fill the DataTable row by row, this query may or may not have data.( not the problem, an empty grid is expected ) We set the ListView's ItemsSource to the DefaultView of the DataTable. lv.ItemsSource = table_.DefaultView; We then (looking at the user's pass usage of the app, set the sort on the column) Sort Method below: private void Sort(string sortBy, ListSortDirection direction) { var dataView = CollectionViewSource.GetDefaultView(lv.ItemsSource); dataView.SortDescriptions.Clear(); var sd = new SortDescription(sortBy, direction); dataView.SortDescriptions.Add(sd); dataView.Refresh(); } In the Zero DataTable rows scenario, the sort does not "hold"? and if we dynamically add rows they will not be in sorted order. If the DataTable has at-least 1 row when the sort is applied, and we dynamically add rows to the DataTable, the rows com in sorted correctly. I have built a standalone app that replicate this... It is an annoyance and I can add a check to see if the DataTable was empty, and re-sort... Anyone know whats going on here, and am I doing something wrong? FYI: What we based this off if comes from the MSDN as well: http://msdn.microsoft.com/en-us/library/ms745786.aspx

    Read the article

  • DataView boolean cell

    - by Nilbert
    How would I add a cell to a DataView that was toggleable between True and False like the dataview in the Microsoft Visual C# properties window? I can only find a way to add a text box type cell to it, but I need to add a toggleable one, and also a dropdown list type. Thanks for any help.

    Read the article

  • C# DataView boolean cell

    - by Nilbert
    How would I add a cell to a DataView that was toggleable between True and False like the dataview in the Microsoft Visual C# properties window? I can only find a way to add a text box type cell to it, but I need to add a toggleable one, and also a dropdown list type. Thanks for any help.

    Read the article

  • Using Aggregate functions in DataView filters

    - by Shrewd Demon
    hi, i have a DataTable that has a column ("Profit"). What i want is to get the Sum of all the values in this table. I tried to do this in the following manner... DataTable dsTemp = new DataTable(); dsTemp.Columns.Add("Profit"); DataRow dr = null; dr = dsTemp.NewRow(); dr["Profit"] = 100; dsTemp.Rows.Add(dr); dr = dsTemp.NewRow(); dr["Profit"] = 200; dsTemp.Rows.Add(dr); DataView dvTotal = dsTemp.DefaultView; dvTotal.RowFilter = " SUM ( Profit ) "; DataTable dt = dvTotal.ToTable(); But i get an error while applying the filter... how can i get the Sum of the Profit column in a variable thank you...

    Read the article

  • How can the DataView object reference not be set?

    - by dboarman-FissureStudios
    I have the following sample where the SourceData class would represent a DataView resulting from an Sql query: class MainClass { private static SourceData Source; private static DataView View; private static DataView Destination; public static void Main (string[] args) { Source = new SourceData(); View = new DataView(Source.Table); Destination = new DataView(); Source.AddRowData("Table1", 100); Source.AddRowData("Table2", 1500); Source.AddRowData("Table3", 1300324); Source.AddRowData("Table4", 1122494); Source.AddRowData("Table5", 132545); Console.WriteLine(String.Format("Data View Records: {0}", View.Count)); foreach(DataRowView drvRow in View) { Console.WriteLine(String.Format("Source {0} has {1} records.", drvRow["table"], drvRow["records"])); DataRowView newRow = Destination.AddNew(); newRow["table"] = drvRow["table"]; newRow["records"] = drvRow["records"]; } Console.WriteLine(); Console.WriteLine(String.Format("Destination View Records: {0}", Destination.Count)); foreach(DataRowView drvRow in Destination) { Console.WriteLine(String.Format("Destination {0} has {1} records.", drvRow["table"], drvRow["records"])); } } } class SourceData { public DataTable Table { get{return dataTable;} } private DataTable dataTable; public SourceData() { dataTable = new DataTable("TestTable"); dataTable.Columns.Add("table", typeof(string)); dataTable.Columns.Add("records", typeof(int)); } public void AddRowData(string tableName, int tableRows) { dataTable.Rows.Add(tableName, tableRows); } } My output is: Data View Records: 5 Source Table1 has 100 records. Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at System.Data.DataView.AddNew () [0x0003e] in /usr/src/packages/BUILD/mono-2.4.2.3 /mcs/class/System.Data/System.Data/DataView.cs:344 at DataViewTest.MainClass.Main (System.String[] args) [0x000e8] in /home/david/Projects/DataViewTest/SourceData.cs:29 I did some reading here: DataView:AddNew Method... ...and it would appear that I am doing this the right way. How come I am getting the Object reference not set?

    Read the article

  • how can I add a custom non-DataTable column to my DataView, in a winforms ADO.net application?

    - by Greg
    Hi, How could I (/is it possible) to add a custom column to my DataView, and in this column display the result of a specific calculation. That is, I currently have a dataGridView which has a binding to a DataView, based on the DataTable from my database. I'd like to add an additional column to the dataGridView to display a number which is calculated by looking at this current row plus it's children row. In other words the info for the column isn't just derivable from the row data itself. Specific questions might be: a) where to add the column itself? to the DataView I assume? b) which method / event to trigger the re-calculation of the value of this custom column from ( / how do I control this) Thanks PS. I've also noted if I use the following code/approach I get a infinite loop... // Custom Items DataColumn dc = new DataColumn("OverallSize", typeof(long)); DT_Webfiles.Columns.Add(dc); DT_Webfiles.RowChanged += new DataRowChangeEventHandler(DT_Row_Changed); private static void DT_Row_Changed(object sender, DataRowChangeEventArgs e) { e.Row["OverallSize"] = e.Row["OverallSize"] ?? 0; e.Row["OverallSize"] = (long)e.Row["OverallSize"] + 1; } What other approach could avoid this looping. i.e. currently I'm saying update the value of the custom column when the row changes, however after then changing the row it triggers antoher 'row has changed' event...

    Read the article

  • DataView Vs DataTable.Select()

    - by Aseem Gautam
    Considering the code below: Dataview someView = new DataView(sometable) someView.RowFilter = someFilter; if(someView.count > 0) { …. } Quite a number of articles which say Datatable.Select() is better than using DataViews, but these are prior to VS2008. Solved: The Mystery of DataView's Poor Performance with Large Recordsets Array of DataRecord vs. DataView: A Dramatic Difference in Performance So in a situation where I just want a subset of datarows based on some filter criteria(single query) and what is better DataView or DataTable.Select()?

    Read the article

  • DataView.RowFilter Vs DataTable.Select() vs DataTable.Rows.Find()

    - by Aseem Gautam
    Considering the code below: Dataview someView = new DataView(sometable) someView.RowFilter = someFilter; if(someView.count > 0) { …. } Quite a number of articles which say Datatable.Select() is better than using DataViews, but these are prior to VS2008. Solved: The Mystery of DataView's Poor Performance with Large Recordsets Array of DataRecord vs. DataView: A Dramatic Difference in Performance Googling on this topic I found some articles/forum topics which mention Datatable.Select() itself is quite buggy(not sure on this) and underperforms in various scenarios. On this(Best Practices ADO.NET) topic on msdn it is suggested that if there is primary key defined on a datatable the findrows() or find() methods should be used insted of Datatable.Select(). This article here (.NET 1.1) benchmarks all the three approaches plus a couple more. But this is for version 1.1 so not sure if these are valid still now. Accroding to this DataRowCollection.Find() outperforms all approaches and Datatable.Select() outperforms DataView.RowFilter. So I am quite confused on what might be the best approach on finding rows in a datatable. Or there is no single good way to do this, multiple solutions exist depending upon the scenario?

    Read the article

  • Select TOP 5 * from SomeTable, using Dataview.RowFilter ?

    - by eugeneK
    I need to select 5 most recent rows from cached Dataview object, is there any way to do that? I've tried but Indexer DataColumn is empty. : public static DataView getLatestFourActive() { DataTable productDataTable = getAll().ToTable(); DataColumn ExpressionColumn = new DataColumn("Indexer",typeof(System.Int32)); ExpressionColumn.Unique = true; ExpressionColumn.AutoIncrement = true; ExpressionColumn.AllowDBNull = false; ExpressionColumn.AutoIncrementSeed = 0; ExpressionColumn.AutoIncrementStep = 1; productDataTable.Columns.Add(ExpressionColumn); DataView productFilteredView = productDataTable.DefaultView; productFilteredView.RowFilter = "isActive=1 and Indexer<4"; return productFilteredView; } getAll() returns cached DataView thanks

    Read the article

  • Phone number mask in a DataView WebPart (DVWP)

    - by PeterBrunone
    This came up today on the [sharepointdiscussions] list.  A user needed to display a read-only field in a phone number format; it's pretty simple, but it may be just what you need.Assuming your list item contains a field called "Phone Number" (with a space), the following XPath will give you a number in the classic US telephone format: <xsl:value-of select="concat('(',substring(@Phone_x0020_Number,1,3),')',substring(@Phone_x0020_Number,4,3),'-',substring(@Phone_x0020_Number,7,4))" /> If you need to mask an input, try this jQuery solution.

    Read the article

  • How to use associated Model as datasource for DataView

    - by Chris Gilbert
    I have a Model structure as shown below and I want to know how to use the Bookings array as the datasource of my DataView. Model Structure: Client ClientId Name Bookings (HasManyAssociation) Contacts (HasManyAssociation) AjaxProxy JsonReader (ImplicitIncludes is set to true so child models are created with one call) Booking BookingNodeId BookingDetails Contact ContactNodeId ContactDetails The above gives me a data structure as follows: Client Bookings[ Booking Booking ] Contacts[ Contact Contact ] What I want to be able to do is either, create a Store from my Bookings array and then use that store as the datasource for my DataView OR directly use the Bookings array as the datasource (I don't really care how I do it to be honest). If I setup the AjaxProxy on my Booking model it works fine but then obviously I cannot automatically create my Client and Contacts when I load my JSON. It seems to me to make sense that the Client model, being the top level model hierarchically, is the one to load the data. EDIT: I figured it out as follows (with special thanks to handet87 below for his dataview.setStore() pointer). The key in this case is to know that creating the relationship actually sets up another store called, in this case BookingsStore and ContactsStore. All I needed to do was dataview.setStore("BookingsStore")

    Read the article

  • ComboBox WPF Databinding to a DataView

    - by Oleg
    Hello Everyone! Lets say I have one ComboBox and 2 TextBox items on my GUI. And I have one DataView with data (City, PostalCode, Street, ID). While initializing the whole thing I fill my DataView with some data :) City 1, 11111, Street 1, 1 City 1, 22222, Street 2, 2 City 1, 33333, Street 3, 3 Now I want to bind this to my ComboBox. DataView is a Class Member called "m_dvAdresses", but this code doesnt help: ItemsSource="{Binding Source=m_dvAdresses}" SelectedValuePath="ID" DisplayMemberPath="Street" Also I want to have my 2 ComboBox items to show PostalCode and City, depending on what to i pick in my ComboBox. Like if I pick "Street 2", TextBox1 show me "City 1" and TexBox2 show me "22222"... How can I bind all of them ONLY in the WPF code? Thanks for help!!!!!!!!!!! :)

    Read the article

  • ASP.NET MVC2: Client-side validation not working with Start.js

    - by Shaggy13spe
    Ok, this is strange. I would hope it's something I'm doing wrong and not that MS has two technologies that simply don't work together. (UPDATE: See bottom of post for Script tag order in HEAD section) I'm trying to use the dataView template and client-side validation. If I include a reference to: <script src="http://ajax.microsoft.com/ajax/beta/0911/Start.js" type="text/javascript"></script> by itself, the dataview template works fine. but if I put in the following references: <script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js" type="text/javascript"></script> <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script> <script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script> <script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script> then I get the following error: > Error: Type._registerScript is not a > function Source File: > http://ajax.microsoft.com/ajax/beta/0911/MicrosoftAjaxTemplates.js > Line: 1 and: > Error: Sys.get("$listings") is null > Source File: > http://localhost:12370/Listings Line: > 76 Here's the code calling the dataview: $(document).ready(function () { LoadMap(); Sys.require([Sys.components.dataView, Sys.scripts.jQuery], function() { $("#listings").dataView(); Sys.get("$listings").set_data(listings.Data); updateMap(listings.Data); }); }); I would really appreciate any help with this one. Thanks! UPDATE: I've tried moving around the order of the last 4 script tags, but to no avail.

    Read the article

  • Asp.net ajax library preview 6 (Ajax toolkits inside a dataview)

    - by Thurein
    Hi, I was using the sys.ui.dataview, ado.net data services and a html page to provide an edit page. It was working fine, but when I wanted to apply some ACT features, for instance watermark or autocomplete on a textbox (input) within the dataview div, its not applied. However, when I move that text box, out of the div, it is working fine and the watermark effect was applied. Am I doing something wrong or any advice ? Thanks

    Read the article

  • Ext.data.JsonStore + Ext.DataView = not loading records

    - by Mulone
    Hi guys, I'm trying to make a DataView work (on Ext JS 2.3). Here is the jsonStore, which seems to be working (it calls the server and gets a valid response). Ext.onReady(function(){ var prefStore = new Ext.data.JsonStore({ autoLoad: true, //autoload the data url: 'getHighestUserPreferences', baseParams:{ userId: 'andreab', max: '50' }, root: 'preferences', fields: [ {name:'prefId', type: 'int'}, {name:'absInteractionScore', type:'float'} ] }); Then the xtemplate: var tpl = new Ext.XTemplate( '<tpl for=".">', '<div class="thumb-wrap" id="{name}">', '<div class="thumb"><img src="{url}" title="{name}"></div>', '<span class="x-editable">{shortName}</span></div>', '</tpl>', '<div class="x-clear"></div>' ); The panel: var panel = new Ext.Panel({ id:'geoPreferencesView', frame:true, width:600, autoHeight:true, collapsible:false, layout:'fit', title:'Geo Preferences', And the DataView items: new Ext.DataView({ store: prefStore, tpl: tpl, autoHeight:true, multiSelect: true, overClass:'x-view-over', itemSelector:'div.thumb-wrap', emptyText: 'No images to display' }) }); panel.render('extOutput'); }); What I get in the page is a blue frame with the title, but nothing in it. How can I debug this and see why it is not working? Cheers, Mulone

    Read the article

  • Problem in filtering records using Dataview (C#3.0)

    - by Newbie
    I have a data table . The data table is basically getting populated from excel sheet. And there are many excel sheets. Henceforth, I have written a utility method for accomplishing the same. Now in some of the excel sheets, there are date columns and in some it is not(only text/string). My function is populating the values properly into the datatable from the excell sheet. But there are many blank rows in the excel sheets some are filled with NULL , some with " ". So I need to filter those records (which are NULL or " " ) first before further processing. What I am after is to use a dataview and apply the filter over there. DataView dv = dataTable.DefaultView; dv.RowFilter = ColumnName + " <> ''"; Well by using metedata (GetOleDbSchemaTable(OleDbSchemaGuid.Columns, restrection)) I was able to get the column names from the excel sheet , so getting the column names is not an issue. But the problem is as I said in some Excel sheet there are date fileds some are not. So the Filter condition of the Dataview needs to be proper. If I apply the above logic, and if it encounters a Datafield, it is throwing error Cannot perform '<' operation on System.DateTime and System.String. Could you people please help me out? I need to filter columns(not known at compile time + their data types) which can have NULL and " " I am using C#3.0 Thanks

    Read the article

  • Sorting in dataview not happening properly(C#3.0)

    - by Newbie
    I have the following DataTable dt = new DataTable(); dt.Columns.Add("col1", typeof(string)); dt.Columns.Add("col2", typeof(string)); dt.Rows.Add("1", "r1"); dt.Rows.Add("1", "r2"); dt.Rows.Add("1", "r3"); dt.Rows.Add("1", "r4"); dt.Rows.Add("2", "r1"); dt.Rows.Add("2", "r2"); dt.Rows.Add("2", "r3"); dt.Rows.Add("2", "r4"); dt.Rows.Add("3", "r1"); dt.Rows.Add("3", "r2"); dt.Rows.Add("3", "r3"); dt.Rows.Add("3", "r4"); dt.Rows.Add("1", "r1"); dt.Rows.Add("1", "r2"); DataView dv = new DataView(dt); dv.Sort = "col1"; DataTable dResult = dv.Table; I am trying to sort the datatable with the help of dataview so that the result will be 1 r1 1 r2 ... 2 r1 2 r2 ... 3 r1 3 r2 ...... Means all 1's first followed by 2's and 3r's Even I tried with dt.DefaultView.Sort = "col1"; but no luck. But it is not happening. Only the result i am able to view in dv.Sort and not the datatable (dResult) I am using C#3.0. Please help Thanks

    Read the article

  • MS AJAX Library 4.0 Sys.create.dataView

    - by azamsharp
    One again Microsoft poor documentation has left me confused. I am trying to use the new features of the .NET 4.0 framework. I am using the following code to populate the Title and Director but it keeps getting blank. <script language="javascript" type="text/javascript"> Sys.require([Sys.components.dataView, Sys.components.dataContext,Sys.scripts.WebServices], function () { Sys.create.dataView("#moviesView", { dataProvider: "MovieService.svc", fetchOperation: "GetMovies", autoFetch: true }); }); </script> And here it the HTML code: <ul id="moviesView"> <li> {{Title}} - {{Director}} </li> </ul> IS THIS THE LATEST URL TO Start.js file. Here is the Ajax-Enabled WCF Service: [ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class MovieService { [OperationContract] public Movie GetMovies() { return new Movie() { Title = "SS", Director = "SSSSS" }; } } [DataContract] public class Movie { [DataMember] public string Title { get; set; } [DataMember] public string Director { get; set; } }

    Read the article

  • How to select top n rows from a datatable/dataview in asp.net

    - by skamale
    How to select top n rows from a datatable/dataview in asp.net.currently I am using the following code by passing the table and number of rows to get the records but is there a better way. public DataTable SelectTopDataRow(DataTable dt, int count) { DataTable dtn = dt.Clone(); for (int i = 0; i < count; i++) { dtn.ImportRow(dt.Rows[i]); } return dtn; }

    Read the article

1 2 3 4 5  | Next Page >