VS 2010 - Editable Grid That Does Not Save On Every Edit
Aug 7, 2011
I am in need of a very simple grid which the user should be able to edit very quickly. The grid will display a list of food items (name and price) that make up a menu.
My usual approach here is just a GridView bound to a collection of the food items with an Edit button to the left of every row. When the Edit button is clicked I navigate to an Edit page where the user can edit that item and click OK to save it to the database and then go back to the grid page, where the grid is reloaded and shows the edited item.
This approach however is much to slow, the user should be able to edit the grid much more quickly, ideally without posting back (either fully, partially or via ajax).
What I'm thinking is really simple, but I don't have the necessary javascript skill to create this...:
A UserControl that simply creates a new row of TextBoxes for every food item (along with maybe a Delete button). The 'grid' is thus always in 'edit mode' (it always shows the textboxes in every row) and the user can type in any textbox to change the name or price. When this change is made, nothing happens server side, yet. When the user presses Save, I finally run a save method that just checks all rows and saves the new values to the database.
Since the grid is so simple (just Name and Price and the underlying data has a unique Id as well obviously) I think this should be possible, but I wouldn't know how to create this...
I did try, I had a UserControl 'MenuGrid' that was nothing but a PlaceHolder (and two labels for the 'Name' and 'Price' menu headers). It has a DataSource property that I set to a collection of food items in the menu, and then for each of those food items I add a MenuGridRow (another UserControl) to the Placeholder. This MenuGridRow contains two TextBoxes and the Delete button. It also contains a HiddenField control that gets the Id of the food item.
Loading works fine, I can get all the data in this 'grid', but I don't see any way to save it back. Once I changed the items and want to Save on the server, I don't see any way to access the MenuGridRows from the MenuGrid (let alone accessing the TextBoxes on that in turn). I think the problem is that it's all just rendered to html and during runtime there is no such thing as a MenuGrid or MenuGridRow anymore. So all I have is a couple of TextBoxes with seemingly random names and there's no way for me to determine which Textbox belongs to which HiddenField (which contains the Id).
Also, I don't see any way to handle the deleting of a row; I was thinking to just run some javascript that deletes the MenuGridRow from the MenuGrid, but again same problem, there's no such thing as a MenuGridRow at that point and I'd have to figure out which TextBoxes and HiddenField belong to that row and then delete them via javascript.
I tried looking for an editable ajax enabled grid as well, so I don't have to do it all by myself, but I didn't really find anything useful. Most of the grids I found don't even work properly, some work but are still very slow (there's still a postback, they just put the grid in an UpdatePanel but that doesn't make it any faster).
I have created 3 tabs in first and second tab DIV I have Asp.net FormView, on Second tabs I have Asp.net GridView. On GridView we have edit link on each row of grid. Now issue is that when i click on edit link of grid Template of grid will change to edit template but tab automatically goes to first tab. I need it should remain on second tab where grid is there I try to use select on clientclick My code as followsThis is under document ready
[Code]....
This is under another script
[Code]....
This is grid in aspx page Where you can see on line 18,19,22 and 23 I am calling onclientclick select()
I need to save the marks in database for each student...I have one drop down list..In this drop down contain 2 std 3 std 4 std, etc..if the user click 2 std ,2 std subjects are display in the grid with textbox for marks upload...If the user click 3 std, 3 std subjects are display in the grid with textbox...and also save the entered marks into database..and i need to edit the marks.
Is there any sample shows the best way to create an editable grid with textboxes, so when user clicks on the save button, the entire grid's textboxes are posted back to controller and bind to its model? I prefer not using any 3rd party grid such the one comes with MvcContrib.
I've seening quite a few posts on here regarding grids, but nothing specifically asking for a free grid component that supports editing. Has any body come across such a thing? Is there a JQuery pluggin that I could use? If not has anybody got any pointers on a good approach to writing my own (using asp.net mvc2 and/or jquery)?
a customer asked me for a web app, written in ASPNET, that can use an editable grid (that works with a SqlServer DB) in the similar manner as Excel works; i can use gridView with Edit link in every row but i wanted to know if there are better solutions (possibly free..) that i can use.
I have a gridview with "Edit Update Cancel" command field. When I click Edit, all the columns in the particular row becomes editable. I just need to have 2 specific columns editable. How is that made possible ? (Screen Shot Attached) [In the screen shot all 3 columns are editable, I just need the second and third to be editable]
I am currently working on a new data application that is a vb.net web based application using visual studio. I have a form with a datagrid view that I have customized to have all rows editable at all times. I need to get this form to show a blank row for inserting data if there is no data returned from the sql server table. I also need to get this form to prompt you to save your changes when you navigate away from the screen by any method. My asp and vb.net code is shown below.
I have a page with one dropdownlist and one grid. when dropdownlist's selected index is changed i generate a BindingList with some data based on the dropdownlist's selected value. this BindingList is binded to the GridView with one readonly column (eg: Item) and one column for entering data (eg: qty).
i need the Qty column to directly editable (without pressing edit, then goes to edit mode). and update this values back to BindingList's corresponding Item when the qty cell's focus is changed.
I have an editable gridview with blank cells. User enters some numeric data in cells and also user can clicks a button to add new row to gridview. My problem is that, as soon as button click event is fired, the page refreshes & the gridview becomes empty. Can anybody tell me, how can I save values in gridview until the user saves all changes to the server in the end
I am using Gridview and on that data is binded conditionally.the problem is that at the time of editing whole row of the grid is in editable mode and i want only few of the columns editable. my code is as follows
I have a grid view that does add, edit update and delete. ( I draged the grid to the aspx page ) it is working. I would like to have the following : once I lick on edit, I open a form inside the grid view to edit the fields. How can I do that.
I am using asp.net 3.5 and in a page i want to make 3 coulmns editable. I don't want to add Edit button. I have Save Button, which i want to use save all the record.
[Code]....
When I am running the page coulmns are not editable. How can we make editable coulmn.
I am using a telerik radgrid so there are around 5 columns each column edittemplate contains a control along with a required field validator and also a property called AllowMultiRowEdit is set to true so i am able to multiple rows in edit mode.
If any of the values are cleared the for multiple rows I want only those to be validated on update of that particular row.
So i implemented the Grids item data bound event find each and every validator along with the update button and set a unique validation group.
The above implementation most times but fails at some time. Is there any other way of going about this ?
Note: Code is taken from this tutorial [URL] I currently have an editable gridview with only some columns editable by the user. In the background I want to record the time/date they have saved the data to the grid. This column 'Time' is not bound to the grid. Is there anyway I can still include this update when rebinding the newly edited data?
I'm also having a problem saving the updated data of my column ActivityTotal. I've been debugging that and following the variable, and it holds the correct value, but just doesnt seem to update. I am providing the codes below for both my gridview and the cs behind and would be grateful if someone could take a look, I assume it's a sort of minor sql issue on my part.
code
protected void UpdateButton_Click(object sender, EventArgs e) { originalDataTable = (DataTable)ViewState["originalValuesDataTable"]; foreach (GridViewRow r in GridView_ABC.Rows) if (IsRowModified(r)) { GridView_ABC.UpdateRow(r.RowIndex, false); } // Rebind the Grid to repopulate the original values table. tableCopied = false; GridView_ABC.DataBind(); }
i have a grid view with some coulmns like Name,Phone no etc with Edit,Delete column in grid view. I click a row in grid view to Edit,it goes another page where i can edit all fields .Once i update i redirect the page to gridview. I want the grid view to remain in that particular page say 4 of the grid view
protected void gvProducts_RowEditing(object sender, GridViewEditEventArgs e) { gvProducts.EditIndex = e.NewEditIndex; } protected void gvProducts_RowUpdating(object sender, GridViewUpdateEventArgs e) { int i = e.RowIndex; object control = gvProducts.Rows[i].FindControl("txtProdID"); //i want to access the new value from the object "control" but i m getting the previous value only }
I want to get a word document from data base by ASP.Net and show it on Internet Explorer, then I want to edit some text and replace this document with the original one, exactly same as Sharepoint. I couldn't find any tutorial or example for this situation.
I get this while trying to save an edit in a Gridview. I removed the @albumUID whivh it automaticlly gerneated when a new record is enteredinto the database. BanUID is the only other uniqueidentifier but in this table it is not set to auto generate,I get the same response if I make a Detialviews and unsert.Here's the code
<asp:SqlDataSource ID="SqlDSAddAlbum" runat="server" ConnectionString="<%$ ConnectionStrings:MyCDsConnectionStringHome %>" DeleteCommand="DELETE FROM [Album] WHERE [AlbumUID] = @AlbumUID"
im trying to edit my gridview row in other page where i have controls like textboxes and buttons,radiobuttons.
the requirement is like i need to keep image for my button its not possible with autogenerate edit so im using one normal button and i want to take these values using querystring not in session.
becoz i have a primary key using that i want to edit record. the below code is working fine for autogenerate edit.