Search Results

Search found 1403 results on 57 pages for 'yui datatable'.

Page 6/57 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Get the corresponding row in the datatable from the selection in datagridview

    - by The King
    Hi All, I have a DataTable which is bound to datagridview (Winforms)... I use the following two lines to get the DataRow that is selected in the datagridview... int l_intSelectedRow = DataGridView1.SelectedRows[0].Index; DataRow l_drwSelectedRow = ControlGroupPostedItems.Tables["PostedItems"].Rows[l_intSelectedRow]; This works fine until the DataGridView is Sorted... When the gridview is sorted by the, I get the incorrect values (1st selection of the sorted view return 1st row of unsorted Table). How could I solve this... Is looping through the datatable the only way... Thank you.

    Read the article

  • How can I transform a DataTable in a group-by date DataTable with LINQ?

    - by alex
    I have a untyped DataTable that looks like this (srcTbl): date col_1 col_2 ... col_n 1.3.2010 00:00 12.5 0 ... 100 1.3.2010 01:00 0 0 ... 100 1.3.2010 22:00 0 0 ... 100 1.3.2010 23:00 12.5 0 ... 100 ... 31.3.2010 00:00 2 0 ... 100 31.3.2010 01:00 2 0 ... 200 I need to sum up the rows grouped by dates to get a DataTable like that (dstTbl): date, col_1 col_2 ... col_n 1.3.2010 15 0 ... 400 ... 31.3.2010 4 0 ... 300 Is this possible by using LINQ and if then how?

    Read the article

  • Storing the records in csv file from datatable.

    - by Harikrishna
    I have datatable and I am displaying those values in the datagridview with the helping of code : dataGridView1.ColumnCount = TableWithOnlyFixedColumns.Columns.Count; dataGridView1.RowCount = TableWithOnlyFixedColumns.Rows.Count; for (int i = 0; i < dataGridView1.RowCount; i++) { for (int j = 0; j < dataGridView1.ColumnCount; j++) { dataGridView1[j, i].Value = TableWithOnlyFixedColumns.Rows[i][j].ToString(); } } TableExtractedFromFile.Clear(); TableWithOnlyFixedColumns.Clear(); Now I want to save the records in the datatable in csv file.How can I do that ?

    Read the article

  • DataTable from TextFile?

    - by Craig
    I have taken over an application written by another developer, which reads data from a database, and exports it. The developer used DataTables and DataAdaptors. So, _dataAdapter = new SqlDataAdapter("Select * From C....", myConnection); and then ExtractedData = new DataTable("CreditCards"); _dataAdapter.Fill(ExtractedData); ExtractedData is then passed around to do different functions. I have now been told that I need to, in addition to this, get the same format of data from some comma separated text files. The application does the same processing - it's just getting the data from two sources. So, I am wondering if I can get the data read into a DataTable, as above, and then ADD more records from a CSV file. Is this possible?

    Read the article

  • Show/hide glossary page in YUI

    - by QLiu
    Hello All, I am trying to develop a toggle function like http://www.lutsr.nl/yui/toggle/ But it works a little different as them. When user enters the glossary page, he sees a full list of Alphabet with all the techical terms explaination All — A | B | C | E | G | H | M | P | Q | R | S | T | U | Z | ActiveSync® Microsoft® ActiveSync est l’ application permettant à un pocket pc d’ échanger des informations avec un ordinateur . Le Pocket PC doit utiliser Microsoft Windows Mobile™ ou Windows CE. Bluetooth® Le Bluetooth permet aux informations d’ être transmises entre les appareils électroniques qui ont le Bluetooth. Si vous utilisez le Bluetooth, vous n'avez pas besoin de connecter les périphériques à l'aide de câbles. ............................. If the user clicks B Alphabet, the rest of content will hide, except B. and B will be move to top of the section. If the user clicks All aplphabet, the whole list will be reset. What I have now, it is able to show/hide and listen to click event. Here is my source code: <a href="#A" class ="toggle" rel="A_section,fade,20"> A</a> | <a href="#B" class ="toggle" rel="B_section,fade,20"> B</a> | Script: //Load JavaScript Ready event. this.toggleLinks=YAHOO.util.Dom.getElementsByClassName("toggle"); for(var i=0; i<this.toggleLinks.length; i++) { YAHOO.util.Event.addListener(this.toggleLinks[i], "click", this.animateElements,this); } toggleElements : function(e,controlNode,refEl) { if(controlNode && refEl) { if(YAHOO.util.Dom.hasClass(refEl,"show")) { YAHOO.util.Dom.removeClass(controlNode,"selected"); YAHOO.util.Dom.removeClass(refEl,"show"); } else { YAHOO.util.Dom.addClass(controlNode,"selected"); YAHOO.util.Dom.addClass(refEl,"show"); } } // to disable control node's default behaviour return false; }, animateElements : function(e,obj) { // obj = javascript toggle object // this = link clicked YAHOO.util.Event.preventDefault(e); if(this.rel) { controlNode = this; } if(typeof(controlNode) == "string") { controlNode = YAHOO.util.Dom.get(controlNode); } // objParameters // [0] = object id // [1] = animation type (fade, slide) // [2] = animation duration (seconds) var linkClicked = this; var objParameters = controlNode.rel.split(","); var refEl = YAHOO.util.Dom.get(objParameters[0]); var objStatus = YAHOO.util.Dom.hasClass(refEl,"show"); // if true, object is shown switchClasses = function() { obj.toggleOtherElements(e,linkClicked,refEl); obj.toggleElements(e,linkClicked,refEl); } if(objParameters[1] == "fade") { if(objStatus == true) { var attributes = { opacity: {from: .999, to: 0} } var objAnim = new YAHOO.util.Anim(objParameters[0],attributes); objAnim.useSeconds = false; objAnim.duration = objParameters[2]; objAnim.onComplete.subscribe(switchClasses); objAnim.animate(); } else { YAHOO.util.Dom.setStyle(objParameters[0],"opacity",0); switchClasses(); var attributes = { opacity: {from: 0, to: .999} } var objAnim = new YAHOO.util.Anim(objParameters[0],attributes); objAnim.useSeconds = false; objAnim.duration = objParameters[2]; objAnim.animate(); } } else if (objParameters[1] == "slide") { // not implemented yet } else { // NO ANIMATION - switch classes switchClasses(); } }, toggleOtherElements : function(e,linkClicked,refEl) { // toggle selected state of other elements pointing to the same source for(var i=0; i<this.toggleLinks.length; i++) { var objParameters = this.toggleLinks[i].rel.split(","); var linkClickedParameters = linkClicked.rel.split(","); if(objParameters[0] == linkClickedParameters[0]) { if(YAHOO.util.Dom.hasClass(this.toggleLinks[i],"selected")) { YAHOO.util.Dom.removeClass(this.toggleLinks[i],"selected"); } else { YAHOO.util.Dom.addClass(this.toggleLinks[i],"selected"); } } } }

    Read the article

  • How do I set YUI2 paginator to select a page other than the first page?

    - by Jeremy Weathers
    I have a YUI DataTable (YUI 2.8.0r4) with AJAX pagination. Each row in the table links to a details/editing page and I want to link from that details page back to the list page that includes the record from the details page. So I have to a) offset the AJAX data correctly and b) tell YAHOO.widget.Paginator which page to select. According to my reading of the YUI API docs, I have to pass in the initialPage configuration option. I've attempted this, but it doesn't take (the data from AJAX is correctly offset, but the paginator thinks I'm on page 1, so clicking "next" takes me from e.g. page 6 to page 2. What am I not doing (or doing wrong)? Here's my DataTable building code: (function() { var columns = [ {key: "retailer", label: "Retailer", sortable: false, width: 80}, {key: "publisher", label: "Publisher", sortable: false, width: 300}, {key: "description", label: "Description", sortable: false, width: 300} ]; var source = new YAHOO.util.DataSource("/sales_data.json?"); source.responseType = YAHOO.util.DataSource.TYPE_JSON; source.responseSchema = { resultsList: "records", fields: [ {key: "url"}, {key: "retailer"}, {key: "publisher"}, {key: "description"} ], metaFields: { totalRecords: "totalRecords" } }; var LoadingDT = function(div, cols, src, opts) { LoadingDT.superclass.constructor.call( this, div, cols, src, opts); // hide the message tbody this._elMsgTbody.style.display = "none"; }; YAHOO.extend(LoadingDT, YAHOO.widget.DataTable, { showTableMessage: function(msg) { $('sales_table_overlay').clonePosition($('sales_table').down('table')). show(); }, hideTableMessage: function() { $('sales_table_overlay').hide(); } }); var table = new LoadingDT("sales_table", columns, source, { initialRequest: "startIndex=125&results=25", dynamicData: true, paginator: new YAHOO.widget.Paginator({rowsPerPage: 25, initialPage: 6}) }); table.handleDataReturnPayload = function(oRequest, oResponse, oPayload) { oPayload.totalRecords = oResponse.meta.totalRecords; return oPayload; }; })();

    Read the article

  • bind a WPF datagrid to a datatable

    - by Jim Thomas
    I have used the marvelous example posted at: http://www.codeproject.com/KB/WPF/WPFDataGridExamples.aspx to bind a WPF datagrid to a datatable. The source code below compiles fine; it even runs and displays the contents of the InfoWork datatable in the wpf datagrid. Hooray! But the WPF page with the datagrid will not display in the designer. I get an incomprehensible error instead on my design page which is shown at the end of this posting. I assume the designer is having some difficulty instantiating the dataview for display in the grid. How can I fix that? XAML Code: xmlns:local="clr-namespace:InfoSeeker" <Window.Resources> <ObjectDataProvider x:Key="InfoWorkData" ObjectType="{x:Type local:InfoWorkData}" /> <ObjectDataProvider x:Key="InfoWork" ObjectInstance="{StaticResource InfoWorkData}" MethodName="GetInfoWork" /> </Window.Resources> <my:DataGrid DataContext="{Binding Source={StaticResource InfoWork}}" AutoGenerateColumns="True" ItemsSource="{Binding}" Name="dataGrid1" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" /> C# Code: namespace InfoSeeker { public class InfoWorkData { private InfoTableAdapters.InfoWorkTableAdapter infoAdapter; private Info infoDS; public InfoWorkData() { infoDS = new Info(); infoAdapter = new InfoTableAdapters.InfoWorkTableAdapter(); infoAdapter.Fill(infoDS.InfoWork); } public DataView GetInfoWork() { return infoDS.InfoWork.DefaultView; } } } Error shown in place of the designer page which has the grid on it: An unhandled exception has occurred: Type 'MS.Internal.Permissions.UserInitiatedNavigationPermission' in Assembly 'PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable. at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) ...At:Ms.Internal.Designer.DesignerPane.LoadDesignerView()

    Read the article

  • C# - Fill a combo box with a DataTable

    - by MrG
    I'm used to work with Java where large amounts of examples are available. For various reasons I had to switch to C# and trying to do the following in SharpDevelop: // Form has a menu containing a combobox added via SharpDevelop's GUI // --- Variables languages = new string[2]; languages[0] = "English"; languages[1] = "German"; DataSet myDataSet = new DataSet(); // --- Preparation DataTable lTable = new DataTable("Lang"); DataColumn lName = new DataColumn("Language", typeof(string)); lTable.Columns.Add( lName ); for( int i=0; i<languages.Length; i++ ) { DataRow lLang = lTable.NewRow(); lLang["Language"] = languages[i]; lTable.Rows.Add(lLang); } myDataSet.Tables.Add(lTable); // --- Handling the combobox mnuActionLanguage.ComboBox.DataSource = myDataSet.Tables["Lang"].DefaultView; mnuActionLanguage.ComboBox.DisplayMember = "Language"; One would assume to see some values in the dropdown, but it's empty. Please tell me what I'm doing wrong ;( EDIT: mnuActionLanguage.ComboBox.DataBind() is what I also found on the net, but it doesn't work in my case. SOLUTION mnuActionLanguage.ComboBox.BindingContext = this.BindingContext; at the end solved the problem!

    Read the article

  • DataTable.Select Behaves Strangely Using ISNULL Operator on NULL DateTime Column

    - by Paul Williams
    I have a DataTable with a DateTime column, "DateCol", that can be DBNull. The DataTable has one row in it with a NULL value in this column. I am trying to query rows that have either DBNull value in this column or a date that is greater than today's date. Today's date is 5/11/2010. I built a query to select the rows I want, but it did not work as expected. The query was: string query = "ISNULL(DateCol, '" + DateTime.MaxValue + "'") > "' + DateTime.Today "'" This results in the following query: "ISNULL(DateCol, '12/31/9999 11:59:59 PM') > '5/11/2010'" When I run this query, I get no results. It took me a while to figure out why. What follows is my investigation in the Visual Studio immediate window: > dt.Rows.Count 1 > dt.Rows[0]["DateCol"] {} > dt.Rows[0]["DateCol"] == DBNull.Value true > dt.Select("ISNULL(DateCol,'12/31/9999 11:59:59 PM') > '5/11/2010'").Length 0 <-- I expected 1 Trial and error showed a difference in the date checks at the following boundary: > dt.Select("ISNULL(DateCol, '12/31/9999 11:59:59 PM') > '2/1/2000'").Length 0 > dt.Select("ISNULL(DateCol, '12/31/9999 11:59:59 PM') > '1/31/2000'").Length 1 <-- this was the expected answer The query works fine if I wrap the DateTime field in # instead of quotes. > dt.Select("ISNULL(DateCol, #12/31/9999#) > #5/11/2010#").Length 1 My machine's regional settings is currently set to EN-US, and the short date format is M/d/yyyy. Why did the original query return the wrong results? Why would it work fine if the date was compared against 1/31/2000 but not against 2/1/2000?

    Read the article

  • Rich faces and dataTable

    - by ortho
    Hi all :) I have the question regarding rich faces and beans. I have a jsp page that is using richfaces and inside it I have the: rich:extendedDatatable component, that takes data from my MainBean as ArrayList (this bean queries the mySQL and puts results to the ArrayList that populates the dataTable later on). There are 4 columns in datatable, first 3 are h:outputLabels and the last one is checkbox. Now I have a question: how can I get information from selected row ? I mean, when user clicks checkbox, I want to take the id/name or whatever that is associated to this particular row, then when user clicks on Apply changed a4j: button I will update the database and when user logs in back again he will see updated info: e.g. checkbox is selected/not selected now because the user checked that. I believe that is a simple query for someone who worked with it. For me ex. flash developer it would be easy in as3, but here I didnt find the solution yet, please help. Thank you in advance, Kindest regards

    Read the article

  • Conditionally display row using JSF Datatable

    - by Elie
    I have some JSF code that currently works (as shown below), and I need to modify it to conditionally suppress the display of certain rows of the table. I know how to conditionally suppress the display of a particular cell, but that seems to create an empty cell, while what I'm trying to do is to not display the row at all. Any suggestions? <h:dataTable styleClass="resultsTable" id="t1" value="#{r.common}" var="com" headerClass="headerBackgrnd" rowClasses="rowOdd, rowEven" columnClasses="leftAlign, rightAlign, leftAlign"> <h:column> <h:outputText rendered="#{com.rendered}" styleClass="inputText" value="#{com.description}: " /> </h:column> <h:column> <h:outputText styleClass="outputText" value="#{com.v1}" /> </h:column> <h:column> <h:inputText styleClass="inputText" value="#{com.v2}" /> </h:column> </h:dataTable> Basically, the line that says #{com.rendered} will conditionally display the contents of a single cell, producing an empty cell when com.rendered is false. But I want to skip an entire row of the display under certain conditions - how would I go about doing that?

    Read the article

  • Strange behaviour of DataTable with DataGridView

    - by Paul
    Please explain me what is happening. I have created a WinForms .NET application which has DataGridView on a form and should update database when DataGridView inline editing is used. Form has SqlDataAdapter _da with four SqlCommands bound to it. DataGridView is bound directly to DataTable _names. Such a CellValueChanged handler: private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { _da.Update(_names); } does not update database state although _names DataTable is updated. All the rows of _names have RowState == DataRowState.Unchanged Ok, I modified the handler: private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { DataRow row = _names.Rows[e.RowIndex]; row.BeginEdit(); row.EndEdit(); _da.Update(_names); } this variant really writes modified cell to database, but when I attempt to insert new row into grid, I get an error about an absence of row with index e.RowIndex So, I decided to improve the handler further: private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (_names.Rows.Count<e.RowIndex) { DataRow row = _names.Rows[e.RowIndex]; row.BeginEdit(); row.EndEdit(); } else { DataRow row = _names.NewRow(); row["NameText"] = dataGridView1["NameText", e.RowIndex].Value; _names.Rows.Add(row); } _da.Update(_names); } Now the really strange things happen when I insert new row to grid: the grid remains what it was until _names.Rows.Add(row); After this line THREE rows are inserted into table - two rows with the same value and one with Null value. The slightly modified code: DataRow row = _names.NewRow(); row["NameText"] = "--------------" _names.Rows.Add(row); inserts three rows with three different values: one as entered into the grid, the second with "--------------" value and third - with Null value. I really got stuck in guessing what is happening.

    Read the article

  • How I can export a datatable to MS word 2007, excel 2007,csv from asp.net?

    - by bala3569
    Hi, I am using the below code to Export DataTable to MS Word,Excel,CSV format & it's working fine. But problem is that this code export to MS Word 2003,Excel 2003 version. I need to Export my DataTable to Word 2007,Excel 2007,CSV because I am supposed to handle more than 100,000 records at a time and as we know Excel 2003 supports for only 65,000 records. Please help me out if you know that how to export DataTable or DataSet to MS Word 2007,Excel 2007. public static void Convertword(DataTable dt, HttpResponse Response,string filename) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=" + filename + ".doc"); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.word"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite); System.Web.UI.WebControls.GridView dg = new System.Web.UI.WebControls.GridView(); dg.DataSource = dt; dg.DataBind(); dg.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); //HttpContext.Current.ApplicationInstance.CompleteRequest(); } public static void Convertexcel(DataTable dt, HttpResponse Response, string filename) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=" + filename + ".xls"); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.ms-excel"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite); System.Web.UI.WebControls.DataGrid dg = new System.Web.UI.WebControls.DataGrid(); dg.DataSource = dt; dg.DataBind(); dg.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); //HttpContext.Current.ApplicationInstance.CompleteRequest(); } public static void ConvertCSV(DataTable dataTable, HttpResponse Response, string filename) { Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=" + filename + ".csv"); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "Application/x-msexcel"; StringBuilder sb = new StringBuilder(); if (dataTable.Columns.Count != 0) { foreach (DataColumn column in dataTable.Columns) { sb.Append(column.ColumnName + ','); } sb.Append("\r\n"); foreach (DataRow row in dataTable.Rows) { foreach (DataColumn column in dataTable.Columns) { if(row[column].ToString().Contains(',')==true) { row[column] = row[column].ToString().Replace(",", ""); } sb.Append(row[column].ToString() + ','); } sb.Append("\r\n"); } } Response.Write(sb.ToString()); Response.End(); //HttpContext.Current.ApplicationInstance.CompleteRequest(); }

    Read the article

  • npoi export from datatable

    - by Iulian
    I have an asp.net website that will generate some excel files with 7-8 sheets of data. The best solution so far seems to be NPOI, this can create excel files without installing excel on the server, and has a nice API simillar to the excel interop. However i can't find a way to dump an entire datatable in excel similar to CopyFromRecordset Any tips on how to do that , or a better solution than NPOI ?

    Read the article

  • Linq to DataTable without enumerating fields

    - by Luciano
    Hi, i´m trying to query a DataTable object without specifying the fields, like this : var linqdata = from ItemA in ItemData.AsEnumerable() select ItemA but the returning type is System.Data.EnumerableRowCollection<System.Data.DataRow> and I need the following returning type System.Data.EnumerableRowCollection<<object,object>> (like the standard anonymous type) Any idea? Thanks

    Read the article

  • Converting a list of an Structure into datatable

    - by strakastroukas
    I saw a lot of examples regarding conversion of a list to data-table. I would like to convert a list of structure into a data-table. How can i do that? My structure is like ... Structure MainStruct Dim Ans1 As String Dim Ans2 As String Dim Ans3 As String Dim Skipped As Boolean End Structure and... Dim St As New MainStruct Dim Build As New List(Of MainStruct) I would like to convert the Build to a datatable

    Read the article

  • Store Image in DataTable

    - by Aizaz
    I want to store image into my datatable and while adding colum I want to set its default value, sending you code doing with checkboxes.. public void addCheckBoxesRuntime(){ for (int i = 0; i < InformationOne.Length; i++) { dt = new DataColumn(InformationOne[i][1] + " (" + InformationOne[i][0] + " )"); dt.DataType = typeof(Boolean); viewDataTable.Columns.Add(dt); dt.DefaultValue = false; } }

    Read the article

  • Sorting datatable column by day name

    - by Eli
    Hi, I have a datatable with day name column. I want to sort this column by day name e.g. if I have [Friday, Monday,Sunday] sorting should return [Monday ,Friday, Sunday] (ascending) and [Sunday,Friday, Monday] (descending). I tried to use custom sorting but I wasn't able to represent my custom order. Do you have ideas ? Thanks

    Read the article

  • Passing a JavaScript variable to a helper method

    - by Brendan Vogt
    I am using ASP.NET MVC 3 and the YUI library. I created my own helper method to redirect to an edit view by passing in the item's ID from the Model as such: window.location = '@Url.RouteUrl(Url.NewsEdit(@Model.NewsId))'; Now I am busy populating my YUI data table and would like to call my helper method like above, not sure if it is possible because I get the item's ID by JavaScript like: var formatActionLinks = function (oCell, oRecord, oColumn, oData) { var newsId = oRecord.getData('NewsId'); oCell.innerHTML = '<a href="/News/Edit/' + newsId + '">Edit</a>'; };

    Read the article

  • Records fetch for DataTable

    - by Ravi
    Hi, I have added 1000 records into DataTable using C#.Net. This data table contains TimeStamp column for specified data stored time. Data stored into 10.00AM to 11.00AM every 10 seconds once. Here i want to fetch only 10.15AM to 10.30AM records using C#. Thanks

    Read the article

  • Records featch for DataTable

    - by Ravi
    Hi, I have added 1000 records into DataTable using C#.Net. This data table contains TimeStamp column for specified data stored time. Data stored into 10.00AM to 11.00AM every 10 seconds once. Here i want to featch only 10.15AM to 10.30AM records using C#. Thanks

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >