Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET Gridview
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 1-Jun-12 1:52am
Edited 4-Jun-12 20:20pm
v2
Comments
Sandeep Mewara at 1-Jun-12 8:41am
   
Homework!

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
VJ Reddy at 3-Jun-12 2:30am
   
Good references. 5!
Prasad_Kulkarni at 3-Jun-12 5:00am
   
Thank you VJ!
sameerbhag at 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 at 5-Jun-12 10:58am
   
And? You want exact code without making any effort. Not good.
sameerbhag at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 568
1 OriginalGriff 384
2 George Jonsson 258
3 Abdul Samad KP 135
4 Animesh Datta 130
0 OriginalGriff 6,099
1 Sergey Alexandrovich Kryukov 5,411
2 CPallini 4,770
3 George Jonsson 3,400
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 5 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100