Add new row to gridview - sql

I'm using a gridview to display and access a sql database and using databinding. I'm also using autogenerate columns as one gridview has multiple sources and toggles between them. What would be the best way to allow the user to insert a new row?
Would a listview be better?

Easiest way to to add a detailsview, set it to the datasource of the gridview and done.

What about changing the DataGridView.EditMode property to something other than EditProgramatically?

FormView on the page, DefaultMode = Insert, and provide an Insert Template.
Add buttons / visibility toggles / datahookup etc. as needed.

Related

Remove columns in dgrid dynamically

I am creating a dgrid using columnHider. I was able to hide/show columns using this.dgridTable.toggleColumnHiddenState(columnId, hidden);
However, I want to altogether remove specific columns from view(including the column hider menu). Is there a way to do this without re-creating the grid with a new set of columns?
You should be able to use this.dgridTable.set('columns', newColumnsDescription);. It does update the column hider menu as well.
You will have to build newColumnsDescription to reflect the addition / removal of columns as per your needs.

VBA access and forms

I created a database in Access and there are some type of records in some tables that requires a particular inserting, so I decided to use VBA to handle this.
The problem is that if i create a form with some controls which i want to refer and use their values as criteria for queries, the form is still a way to insert data. So the query works but the data i inserted are added directly from the form too, creating duplicates.
The question is, is there a way to create a form that has controls only for text input but does nothing to record , leaving inserting, deleting , updating all to queries in VBA?
I tried to put "no" on propriety "add records" in the form but it gets totally blank with no controls.
Your form must be unbound, i.e. its RecordSource must be empty.
Your form can be bound or not bound to a table / query.
This means that the controls on your form may be bound to a field of that table / query.
But you can also have controls in the same form which are not bound.
Example:
You can make a form in which the body has a list view of the records of the table. In this section the controls would be bound to a field.
In the header of the table instead you may have controls that are not bound and that could be used either to filter the records shown or to add new records. You may want to add records this way rather than let users insert data directly in order to add checks or do any other kind of processing before actually adding the data in a new record.

Extending Kendo Grid default grouping

How can I implement some operations after kendo finishes grouping? For example, I am displaying some values based on countries, states, cities, etc. After grouping by those columns I would like to sum the values and display the total after each grouping group.
Also, how can I persist the columns state after grouping? For example, if I hide columns and then I decide to group by another column, the state gets refreshed (All columns will be displayed again). Is there a way to maintain the hidden columns after kendo finishes grouping by another column?
Thanks a lot!
1.After grouping the dataSource change event and grid dataBound are fired. In it you can use dataSource.group() method to get grouping infromation and use it like so:
function onDataBound(e) {
var gr = e.sender.dataSource.group();
//some operations on the gr variable.
}
Unfortunately it is not possible to check what exacly change in dataSource it was (grouping, filtering etc).
Better option is to use kendo aggregating mechanism to it. I recommed to try it first. Check this demo to see how it works.
2.Here is another demo I've prepared for you in which you can hide column using column menu and then group it. Hided columns remain hided after it. Can you reproduce your issue in that example if you still have problem with it?

How to insert multiple records into database table using gridview in asp.net using vb.net?

I wish to develope an asp page using vb.net, using which one can insert more than one records
at a time for example "Item Order Placing form" in which one can place more than one order and can see its whole order also so how can it be possible using gridview with vb.net ?
You should really try first... and then post code you have a problem with. One possible solution would be to have a listview or gridview and an area below where the person enters each order item one at a time. When order complete click button. This fill fire code which you need to write that will go through each row and add to db.

What are different ways in VB Dot Net to populate DataGridView Grid using SQL Query?

I want to populate a DataGridView Grid in my Form with Data from SQL Query or from some Table form Database. I want to know various possible ways to populate the DataGridView Grid.
Thanks in advance.
There are basically 3 ways to display data in a DataGridView
Create the rows manually in a loop: it's very inefficient if you have a lot of data
Use the DataGridView's virtual mode: the DGV only creates as many rows as can be displayed, and
dynamically changes their contents when the user scrolls. You need
to handle the CellValueNeeded event to provide the required data to
the DGV
Use databinding: that's by far the easiest way. You just fill a
DataTable with the data from the database using a DbDataAdapter, and
you assign this DataTable to the DGV's DataSource property. The DGV
can automatically create the columns (AutoGenerateColumns = true),
or you can create them manually (you must set the DataPropertyName
of the column to the name of the field you want to display). In
databound mode, the DGV works like in virtual mode except that it
takes care of fetching the data from the datasource, so you don't
have anything to do. It's very efficient even for a large number of
rows
Link.