Gridview boundfield question
Posted on 2016-09-12
I have a gridview and I create the columns dynamically from a stored proc. I created an Imagefield (based on the name of the column "Status" being brought back from the sp) that will show an Image for different Statuses. My goal is to set a Session variable to the Status of the selected row. So when I click on a row in the grid Im trying to get the name of the image and then I can figure out the Status but I cannot seem to get the value of which image I have displayed in the row?
If I change it to a boundfield and check the Status column in the RowDataBound I can read it fine but if its an ImageField I cannot read the value.
The way I see it, I have 2 opitons.
I can keep the Imagefield and somehow try and figure out the image for the row and set a Session var to the rows Status. Or...I can change the imagefield to a boundfield and in the RowDataBound event somehow change the field to display an image based on the Status value in the column for the row?
I would much rather keep an ImageField and somehow be able to read the value of the ImageUrl and set my Session var based on that. But if I can find a way to create a Boundfield that holds the StatusID(1-5) and then set an image in the column value then thats fine too.
My problem is I dont know how to do either???