Solved

Gridview boundfield question

Posted on 2016-09-12
4
77 Views
Last Modified: 2016-09-14
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???
0
Comment
Question by:jknj72
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 43

Expert Comment

by:zephyr_hex (Megan)
ID: 41796238
Can you please show us the code where you're attempting to to get the ImageUrl value from the ImageField?
0
 
LVL 12

Accepted Solution

by:
Ramkisan Jagtap earned 500 total points
ID: 41796392
You can create two fields.
Boundfield to hold the statusid and  imagefield for the image.
From stored procedure you can add one more column with statusid to datasource and bind it to gridview.
On click of the row you can get the status id  and set it to session variable.
0
 

Author Comment

by:jknj72
ID: 41798387
thats a great idea and I will use it. I guess I was overthinking it...Thanks so much
0
 

Author Closing Comment

by:jknj72
ID: 41798390
thanks for your help
0

Featured Post

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question