creating input fields row automatically in wpf - c#

i am making the form for sales system so that user write data in one row and automatically row adds to add data for other products, i have a datagrid in wpf and i have input fields in datagrid, there are 6 fields in one row, what i need when i write in first field then automatically inputs fields row adds under the current row for new data.

Set CanUserAddRows="True" on datagrid, it will give you the functionality of automatically adding an empty row once the user is done editing the current row.
Thanks

Related

DevExpress GridControl : Adding a new row "in-control" as in Windows.Forms GridView

When I try to add a new row by clicking the NewItemRow placed in bottom of the grid, it allows me to edit the cell, but when I press enter it simply doesn't add it to the list, instead takes me to the next column; Editing properties are set to True. When I run the Designer, in the Feature Browser section the Sample View allows me to add new rows as I want, but in my grid don't.
Allows me to type in the cell:
http://s28.postimg.org/3ybb5tq65/Problem.jpg
Takes me to the next column, doesn't adding what I already typed:
http://s10.postimg.org/k4cq73m5l/Problem2.jpg
Forcing me to use another Form and using code to add a new row based on text fields, what is non-convenient for the target user of my application.
In a standard DataGridView it automatically adds rows with the typed content by pressing Enter or selecting other cell.

How do I start the program off with multiple rows on a DataGridView?

I don't know think I wrote any code for this since the properties are all default. I don't want the user to have to add those by themselves when it is in the middle of the run.
It lets me add in columns but not rows in the designer.
Is there any property that can start the program with more than 1 row in the data grid view?
Populating the grid with data must be done with code. If you populate the grid in the Load event handler then the user will see that data when the form is displayed. You can add data directly to the grid or you can populate a DataTable or some other list and bind that to the grid.
If you're saying that you actually want multiple blank rows in the grid then you need to add those rows. The row you see by default is not actually part of the data of the grid. It's just there to indicate to the user that they can enter data.

wpf grid control for adding dynamic data

What is the WPF control I need if I want the user to be able to input Cross Ccy amounts, ie the data needed for each row is
Ccy One, Ccy Two, Amount
I want a grid-like control where the User can enter data for each cell in the row and once you begin to enter data in the cells, a new row gets added underneath, so the control keeps growing with every entry the user inputs and has no upper limit but grows to fit, using a scrollbar when it goes outside the bounds of the grid container.
Is there a built in control to do this? Or do I have to add functionality to listview/datagrid?
If you want the user to be able to add new rows just set the CanUserAddRows property on the DataGrid to true.
<DataGrid CanUserAddRows="True" ..../>
If you want rows the be added when the user edits a data in a cell in an existing row, you can register to one of the cell edit events (depending when you want the new row to be added) and add rows to the grid or items to the collection it is binded to.
datagrid.CellEditEnding += (grid, args) =>
{
datagrid.Items.Add( ....);
};
this is the standard behavior of a datagrid, if the property CanUserAddRows is set to True

GridView How to update a value of current editing row with a new one?

-Simple gridview and sql data source to bind the data info to gridview.
On row updating how can I update a certain cell of current editing row with a new value set by me?
Thanks
If you are doing this in visual studio you can use the graphical interface to change properities to both gridview and sql datasource and configure this without writing code.
Take a look at this if you want to see how it's done in asp:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.updatecommand.aspx
What really happens is that it updates the whole row in database, and displays the new values. This means that you don't need to change value in just one cell, but rather the whole row

How to add a new row into datagridview using grid only. i.e by showing textboxes and add button in WinForm

I want to add a new row to a datagridview such that when a user clicks on new button , a new is is generated with few textboxes and combo boxes and after filling up all the details he save the info by clicking on save button.
EDIT
I want to do it like it is seen in gridview(Template Fields) in asp.net
I am looking for same kind of functionality.
Since I'm not sure exactly how you want to achieve this.. I would have a hidden panel with your text boxes, ...etc, show the panel when the new button is clicked. After all information is entered into the fields, click the save button. Assuming that you will be inserting this information into a table, after the row is inserted, call the stored procedure to get the desired records from the table being displayed in the grid.
Assuming your _dataGridView.Columns collection is not null and contains a template of the rows you wish to add, it is as simple as something like this:
foreach(var item in _collection)
{
_dataGridView.Rows.Add(item.Foo, item.Bar);
}
In order for this to work, you will have had to design your Columns collection in the VisualStudio designer or programatically add DataGridViewTextBoxColumn objects to the Columns collection.
In the example above, I added two DataGridViewTextBoxColumn objects to the _dataGridView.Columns collection and then populated the datagrid from a List of my object that contained a 'Foo' and a 'Bar'.
EDIT
Have you checked out the DataGridView FAQ? The information about using the DataGridView in unbound mode may help you.
HTH

Categories

Resources