Solved

Gridview boundfield question

Posted on 2016-09-12
4
74 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Send SMS from vb.net desktop app 30 49
asp.net mvc5 6 32
How do I "share" on social sites? 2 37
Datatable / Dates ? 4 29
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

737 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