Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I have table with the following fields

Item ID, Item Name, Price, Active.

Here Active column contains only 0 or 1 ie.
1-Available
0-not available

Here I binded this table with Gridview with Active/Deactive link button in it.
with addition of it Edit & Delete also

Now my requirement is I need to show available items & unavailable items also in Gridview but unavailable items will be with some light color.. when i click Active/Deactive button it will be in unavailable format & Edit & Delete buttons will be in Disable mode, When user clicks again Active/Deactive button which will be in normal view & Edit & Delete buttons will be Enabled.

How can i do this?
Posted

Use RowDatabound event to control visibility or appearance of the controls and RowCommand event to perform any action.

Regards
Praveen
 
Share this answer
 
Hi ,
First for change Row Color

C#
GridView1.Rows[1].BackColor = Color.Red;


and For prevent form Editing
//put your condition like you will check on some value on the Gridview and if it true it has to be not update
C#
if (GridView1.Rows[index].Cells[0].Text =="0")
{
    GridView1.EditIndex = -1;
}

Best Regards
M.Mitwalli
 
Share this answer
 
v2

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