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
Related
I have a web form which is basically a search form where user should be able to search records based on ID, Date and some other criteria. The search result will be then display on gridview. I have Edit functionality for each records on the gridview.
When user click on Edit of any record it will navigate to the edit page where user should be able to edit and update.
Everything works fine upto here.
But i have a back button on the Edit page once i click on the back page it will come back to the search page.
I want to keep the previously searched value on the textbox and the search result on the gridview too but i am not able to.
I tried both session variable and cookies but it is not working.
So please help me how can i do this??
Thanks for your suggestion.
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.
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.
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.