c# - how to get the column index of the gridview -



c# - how to get the column index of the gridview -

i have 2 image buttons in gridview used selection. populate textboxes. need when click imagebutton "edit" should populate textboxes gridview , when imagebutton "delete" pressed same , disbale textboxes too. point not getting logic of how column indexes programmatically. help me out condition. issue c# code. here snippet have tried:

protected void gridview1_selectedindexchanged(object sender, eventargs e) { var row = gridview1.selectedrow; if (condition) { _propertytitle.text = row.cells[1].text; _address.text = row.cells[2].text; } else { _propertytitle.text = row.cells[1].text; _propertytitle.enabled = false; _address.text = row.cells[2].text; _address.enabled = false; } } }

it not clear question trying achieve.but got want write specify both image button click separately.

for have utilize rowcommand event.

protected void gridview1_rowcommand(object sender, gridviewcommandeventargs e) { }

in row command event according commandname (of button) can manage code 2 buttons

refer link rowcommand event row command one more link

c# asp.net gridview

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -