Scenario : I wanted to provide a GridView where the user can enter data row by row and display it(I did not bind to a database yet). I gave a footer where the user enters data and clicks add to add the data to the GridView. Finally, I gave a 'Save All' button to save the whole GridView data to the database.
What I did : I implemented it in this way where the data gets saved to an XML file when each row is added to the GridView. When the user clicks 'Save All' all the data in the file gets saved in the database. This implementation works perfectly.
My Question : My problem was that I found this implementation a bit complex and so i want to know if there are any other ways to do this(Javascript/jquery or any other). Any ideas/suggestions/links/sample codes are welcome.
Thanks a lot for your response guys. I used the Obout grid(Excel style) to achieve it. It works just as I wanted.
Related
I am binding data in a DataTable to a GridView.
The result is a simple table with 5 columns and 3 rows.
What I want to achieve is:
If an user clicks on a cell in the GridView, the selected cell should become editable (with a textbox). In that textbox the user should have to possibility to enter new value and save it to the database.
What I've achieved so far is:
I followed this tutorial: http://www.dotnetlogix.com/Article/aspnet/80/How-to-make-GridView-Individual-Cells-Selectable.html
I managed to make the cells clickable, when clicking the cell the background color becomes red:
With that tutorial I also managed to get the ColumnIndex and RowIndex.
So I was able to do: GridView.SetEditRow(RowIndex);
Then my result became:
This is almost what I want, but not 100%. The SetEditRow edits the whole row, but I need to edit the clicked cell which is based on a row and column index.
Can anyone help me further please?
I've followed some other tutorials as well, but without result.
I tried this a few years ago and ran into a few issues, I don't recall all of them off the top of my head right now. What I ended up doing was using a repeater instead of a gridview to build a table. Since I'm writing the HTML I have more control over things. The table contained both a dig tag for the static value and a text input for the edit value. I used jquery to show and hide when needed. I then used ajax to post the changes back. This was a lot of work, but it ended up working out ok. Hope this helps.
I have records that are displayed on a page and I have a small "edit" icon on the very right of each row.
So when I click the icon I want the user to edit "selected" row.
Now, I am generating the records and images behind code! so i am not using a control it generated a html code then i do something like this
output.InnerHTML = generatedCode;
Question, how can i create a function to determine which icon has been clicked and also that id of that icon?
If you are doing this with tables you must generate some unique id for each row edit link so that you can identify which row you have to edit. Apart from this there are pretty much easy way to display records in asp.net i.e GridView
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.
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.