I am making a windows form application, a billing software. I want to make a interface like this on one of the forms:
There is a row of textboxes with about 5-7 textboxes, i fill the first textbox with a product ID which automatically populates the rest of the textboxes fetching data from appropriate tables and automatically generate a new row of textboxes, the first textbox from the new row being focussed for entering product ID. It should continue until i click a certain button which finalizes the bill. On clicking this button all these values should be updated to database in respective tables. How can I achieve this?
Can using datagrid help?
Google "C# write to database" and click on one of the links, like these that came up when I did it:
http://www.codeproject.com/Articles/3554/Simple-Database-Application-Part-1
http://www.codeproject.com/Articles/1155/Simple-ADO-NET-Database-Read-Insert-Update-and-Del
Or go to amazon.com and search "c# database" and buy one of those books.
Related
I have a table named "Rezervare" with the field id, id_hotel, data_inceput, data_sfarsit, pret.
My task is to display all the records without using databound controllers . Afterwards I need to update and delete them so I need to select specific id's to do those operations.
Since I am new to C# and ASP I don't know how to display and make buttons that would take the right id on press in order to delete or update a record in the table.
To sum things up I have 2 questions:
How do I display the data in the table without using listview,detailsview,formview etc.?
How do I make buttons for each of the item that on press take the right id(just like in listview would)?
(I don't know the answer to the 1st question so that answer might just answer my 2nd)
I understand that the Gridview of asp.net and windows forms are different, but my requirement is that I have a registration form where in a user registers his vehicles.
A single user can have many vehicles, so I want to provide a Gridview with the column names specified and allow users to enter the values in the rows. Depending on the number of vehicles, the user keeps adding them. This task is actually easy in the Windows forms since the grid is in such a way that an empty row is provided by default and we can type in the cells. Finally we can read the DataGridview by each row and save the results to database.
I am looking for this feature in the Asp.net either with the Gridview or any other data control. This looks pretty complex with the asp.net gridview since ill need to work with the edit button, update button for doing this every time and also a add new row button every time.
Is there any other way I can do this task without complexity. I am fairly new to asp.net.
If you want to add a new row then what you can do it add a footer row to the gridview. and everytime the user enter information in the footer row you can bind it to gridview and when the page is reloaded you will always have the footer row. This way user can register as many cars they want.
I think it would be easier for you to understand my problem if I explain the scenario a bit.
What I am doing is developing a system to a doctor using asp.net c#. For the creation of the prescription, I add a check box list for the list of medicines and submit button below it. When the submit button clicked selected check box list items added to the sql server database and show a data grid with the selected medicines in the same page.
In the data grid there are two columns for medicine name and dosage.Medicine name is taken from the database.I need to give the user the ability to enter the dosage through that grid view. I need to use update command because the record is already there in the sql server.But empty value in the dosage column.I tried to use update command in the data source control. But I can't figure out how to give the WHERE clause because I can't specify the database row which the updating record relate to.
I would be glad to hear some help from you. All the comments are welcome.
You need to set a parameter(s), please check this example to understand how it works. I guess, that you've added in the database some column that is unique identifier.. some autoincrement int or guid.
Dear sir,
I m developing one application on c# windows forms by using OLEDB connection.On that one form i placed one datagridview and bind to one table.That table contains some fields....., here my problem is i want to edit table on runtime.On that table i need two links as edit,unmask.In runtime data in datagridview is seems to plain text on paper.if we click edit that row changed to text boxes and combo boxes.Sometext boxes contain passwords also.those are in ** formate.while picking unmask button those passwords are changed to actual text.while picking edit button that exploted to update, cancel.Then we change the data and pick update then data stored to database table.(i need datagridview as gridview in ASP.Net).Is there any properties for datagridview as gridview(ASP).Could you please suggest me how to resolve my prob.
Thanks in advance.
Can you, at the time of the hang, hit pause in Visual Studio to see where your code hangs?
I'm trying to create an ASP.NET/C# page that allows the user to edit a table of data, add rows to it, and save the data back to the database. For the table of data, I'm using a DataGrid whose cells contain TextBoxes or CheckBoxes. I have a button for adding rows (which works) and a button for saving the data. However, I'm quite stuck on two things:
The TextBoxes and CheckBoxes should retain their values on postback. So if the user edits a TextBox and clicks the button to add more rows, the edits should be retained when the page reloads. However, the edits should not be saved to the database at this point.
When the user clicks the save button, or anytime before, the DataTable underlying the DataGrid needs to be updated with the values of the TextBoxes and CheckBoxes so that the DataTable can be sent to the database. I have a method that does this, but I can't figure out when to call it.
Any help getting this to work, or suggestions of alternative user interfaces that would behave similarly, would be appreciated.
Take a look at the ASP.NET GridView control. It's newer than the DataGrid and has editing features, editing events, etc built in.
Check out the following website:
http://highoncoding.com/Categories/7_GridView_Control.aspx
There are tons of articles on the above link about the GridView control.