Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello,

I have a following problem in coding a particular requirment:

There is a single gridview to which I need to bind different tables at runtime. Moreover, the gridview should have update, edit, delete operations possible.

However, The conditions are:

1. The editing of row should happen on Double Clicking the particular row (this also means, there should not be any link for Edit) in gridview.

2. The Delete Link Should be there in Gridview, but the on clicking that, the value in rows should not get deleted from database/ from gridview. However, It should just turn that particular row Red in color and as well as disabled. (There should not be any change in database like creating a status column or so to store the status of record in a row.)

3. The Update link is not there, so we need to have seperate button at the bootom of gridview to update the record depending on selected table.

4. The Cancel Editing Function should be achieved by using the Single Click of mouse anywhere in gridview.

Note: I want that the deleted item to be "shown" in red color only. However, no new field should be created in database to store the status or so. So, it is possible using javascript/ Client side scripting but on postback i.e. after page load it again gives problem. Now, I want such thing which will store row ID or record in any datatype/storage type from where I can derive the present values avoiding the postback problem.

Please Help.

Thank You.
Posted
Updated 4-Jun-12 20:20pm
v2
Comments
Sandeep Mewara 1-Jun-12 8:41am    
Homework!

1 solution

 
Share this answer
 
Comments
VJ Reddy 3-Jun-12 2:30am    
Good references. 5!
Prasad_Kulkarni 3-Jun-12 5:00am    
Thank you VJ!
Adwaitam 5-Jun-12 2:18am    
Hey thanks for your reply. but I want that the deleted item to be "shown" in red color only. However, no new field should be created in database to store the status or so. So, it is possible using javascript/ Client side scripting but on postback i.e. after page load it again gives problem. Now, I want such thing which will store row ID or record in any datatype/storage type from where I can derive the present values avoiding the postback problem.
Sandeep Mewara 5-Jun-12 10:58am    
And? You want exact code without making any effort. Not good.
Adwaitam 12-Jun-12 7:21am    
This is the code that I used after creating a template field delete link button in the ASPX file.

public void lnkbtnDelete_OnClick(object sender, EventArgs e)
{
LinkButton lnkbtnDelete = (LinkButton)sender;
GridViewRow row = (GridViewRow)lnkbtnDelete.NamingContainer;
row.BackColor = Color.Red;
row.Enabled = false;
}

but I want to do the same for edit also.
Means all edited rows should be shown in yellow color....which are edited in particular session. But I am unable to achieve this since object for RowEditing event are different than that in RowDataBound Event...plz help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900