html - Change color of selected cell in a gridview _RowCommand() -


i have gridview of 10 rows , 3 columns. want change color of cell when clicked. if user clicks again, remove color.

by code have row number stored in index.

protected sub gridview6_rowcommand(byval sender object, byval e system.web.ui.webcontrols.gridviewcommandeventargs) handles gridview6.rowcommand         dim index integer = convert.toint32(e.commandargument)                     // here want change selected cell color 

finally found trick. not sure if right way yeah worked me.

protected sub gridview6_rowcommand(byval sender object, byval e system.web.ui.webcontrols.gridviewcommandeventargs) handles gridview6.rowcommand     dim index integer = convert.toint32(e.commandargument)     dim r gridviewrow = gridview6.rows(index)     dim cell1 button = r.cells(0).controls(0)     dim c1 string = rtrim(cell1.text)     dim cell2 button = r.cells(1).controls(0)     dim c2 string = rtrim(cell2.text)     dim cell3 button = r.cells(2).controls(0)     dim c3 string = rtrim(cell3.text)      dim cellname string = rtrim(e.commandname)       if c1 = cellname         if cell1.backcolor = drawing.color.olivedrab             cell1.backcolor = drawing.color.linen          else             cell1.backcolor = drawing.color.olivedrab          end if     end if     // , same c2 , c3 

it worked both way color , discolor ;)


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -