Selecting All records From Kendo Grid - c#

I'm using Kendo grid in Visual Studio 2010 Asp.net & C#. Im new to this platform. I have more than 100 records in that grid.. i want to select all the records in an array.. Am using the following code.. It selects only the first page records. (PageSize: 5 )..
var entityGrid = $("#grdReport").data("kendoGrid");
var d = entityGrid.dataSource.data();
for(var i = 0; i<d.length; i++)
{
var currentDataItem = d[i];
a.push(currentDataItem);
}
appnt = a;
appnt has only 5 records.. So please Help me in this issue... Thanks in Advance.. :-) Be happy..

You should use ServerOperation of the dataSource sorce set to false if using the MVC wrappers.
If using the regular JavaScript declaration you should set the serverPaging of the dataSource to false.

How do you load them? Are they actually loaded in the browser or are you using Server Paging?
If you have actually the data loaded what you do is correct BUT if the data is actually still in the server, you should check the total using:
var entityGrid = $("#grdReport").data("kendoGrid");
console.log("Total length: ", entityGrid.dataSource.total());
BUT you cannot get the data since it is actually not in the browser, you will get it when moving to a different page.
So the question is: how are you defining the DataSource?
Check it here: http://jsfiddle.net/td8Ww/

Related

Nonfactors mvcgrid paging problems

Ive just started using NonFactors.Grid.Mvc6 -Version 6.2.4. Ive got its basic functionality working and Im able to retrieve data from my serverside code (.net core 5). I want to implement paging but Im only able to get it to page through the dataset ive received on the clientside. For example, Ive returned 5 rows from the database, the grid only allows me to page through those 5 items. I cant find any documentation (or examples) of using ajax calls to retrieve the data in pages (specifying the current page and number of rows). This is of no use in the real world so the grid must be capable of this somehow (hopefully), but there is nothing documented. Has anyone managed to do this ? Id really appreciate some examples, the documentation is pretty poor
I have the same problem, if I want to use the paging from the backend
Code example
.Pageable(pager =>
{
pager.ShowPageSizes = true;
pager.PageSizes = Model.Paging.PageSizes;
pager.PagesToDisplay = Model.Paging.PagesToDisplay;
pager.CurrentPage = Model.Paging.CurrentPage;
pager.RowsPerPage = Model.Paging.RowsPerPage;
pager.TotalRows = Model.Paging.TotalRows;
})
You can set the TotalRows value, but it will be recalculated for the _Pager.cshtml view based on the Rows.
public virtual IQueryable<T> Process(IQueryable<T> items)
{
TotalRows = items.Count();
My workaround, add/modify the following line to the _Grid.cshtml file:
#if (Model.Pager != null)
{
Model.Pager.TotalRows = Model.Pager.PagesToDisplay * Model.Pager.RowsPerPage;
#await Html.PartialAsync(Model.Pager.PartialViewName, Model.Pager)
}

Get Value from EditText in ListView in Xamarin Android

I am using Xamarin Studio with C#.
Actually, I create one custom listView and in this listview I'm using one EditText field for getting information from user. And this listview dynamically generate base response of WCF.
This WCF connect with our DB use for getting and retrieve data.
Currently, I'm using below line of code.
for(int i=0 ; i< listAdapter.Count ; i++)
{
View view = listAdapter.GetView(i, null, null);
EditText edittext= (EditText) view.FindViewById(Resource.Id.lbltdApproveQuantity);
string str = edittext.Text;
}
Problem is: I'm getting Old Value not getting latest Value which user entered.
Advance thanks for all experts. Waiting your response.

Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported. Load not there

I am using EF and I have the following code in which I am trying to get rows from a view called interface5toSSHIP. The SQL Explorer reveals that the database view has one row right now. The following query doesn't seem to return it. What am I doing wrong?
IEnumerable<interface5toSSHIP> i5;
using (RREM_GilbaneEntities3 entities3 = new RREM_GilbaneEntities3())
{
i5 = from i in entities3.interface5toSSHIP
select i;
}
Then I get the title error when I attempt to DataBind it:
grdvwInterface5ReadyToSend.DataSource = i5;
grdvwInterface5ReadyToSend.AllowPaging = true;
grdvwInterface5ReadyToSend.AllowSorting = true;
grdvwInterface5ReadyToSend.DataBind();
The problem is I can't find how to do the Load. I looked up an example like this:
IntranetModelContainer db = new IntranetModelContainer();
db.Entities.OfType<Employee>().Load();
return db.Entities.Local.OfType<Employee>();
I added a reference to System.Data.Entity and I can't find a .Entities off my entities3 or a LOad method. How do I do this?
I solved it by calling the ToList() method on it.
ToList() can be too slow, because it will try to get all properties (get{}) and resolve another objects related to it. A fast way can be:
yourLinq.AsQueryable()

DataGridView to MS Access Database

I'm trying to update a database after the changes in a DataGridView.
After changing the code several times, I've come to this one-liner:
primeTableAdapter.Update((PrimeDataSet.PrimeDataTable)(primeDataSet.Tables["Prime"]));
The method returns the correct number of rows added / edited and entering the form again without closing the entire application everything seems fine. The new rows are kept in the DataGridView. However, the Access file is not changed one bit, so when I relaunch the application they disappear.
I've bound the DataGridView to the table using the "Add New Data Source" wizard and I'm using Visual Studio 2010.
I've also found the code at: Inserting data from a DataGridView to a database and it seems similar to what I have to do, but I wasn't able to translate the vb.net code to something that would compile. However, I'm fairly sure it is really, really close to what I have to do.
Later Edit: I had added the database to the project. By setting the Copy to Output Directory property to Copy if Newer the changes were persistent between sessions.
if you want to pay,you can use a third party (Spire dataExport ) it make things more easier : to save datagrid into msAccess :
private void btnExportToAccess_Click(object sender, EventArgs e)
{
Spire.DataExport.Access.AccessExport accessExport = new
Spire.DataExport.Access.AccessExport();
accessExport.DataSource = Spire.DataExport.Common.ExportSource.DataTable;
accessExport.DataTable = this.dataGridView1.DataSource as DataTable;
accessExport.DatabaseName = #"..\..\ToMdb.mdb";
accessExport.TableName = "ExportFromDatatable";
accessExport.SaveToFile();
}
and Here a link where you can find more clarification

ADO.NET Entity Data Model problem with inserting data to database (Baza.mdf) / Visual Studio / C#

Helo. Firts of all i'm sorry for my eanglish.
I'm writing Windows Form application in Visual Studio 2008 in C#. I created database (Baza.mdf) or rather "Service-based Database" this is only option to create .mdf in WindowsForm App. Then i create ADO.NET Entity Data Model. I Add New Data Source and Drag and Drop "BazaDataSet" to my form. I create other form with textboxes to adding new values. When i Add new record it is onlu visible in "BazaDataSet" - its adding succesfully but when i click "show table data" in Baza.mdf there's nothing changed. Please help.
There is my code:
BazaEntities gg = new BazaEntities();
//var cos = (from u in jj select u);
// jj.id = int.Parse(idAutaBox.Text);
jj.marka = MarkaBox.Text;
jj.model = ModelBox.Text;
gg.AddToAutasSet(jj);
gg.SaveChanges();
MessageBox.Show("dodano");
Take a look here:
http://msdn.microsoft.com/en-us/library/bb738695.aspx
And just make sure that you have are doing similar to their example.

Categories

Resources