question

sabari avatar image
sabari asked

select query results showing on gridview in asp.net???

I'm new to asp .net. I've created one application in asp .net and using backend as sql server 2005. I've connected backend with asp.net and select query result showing in gridview is my current task. consider "available" is one of the field in a table(char(1) datatype). my task is **If *available="1"*, gridview have to display *green image*. else *available=NULL* gridview have to display *red image* on that column databound. and green and red images have *clickable*. if i click that green image, its have to change as yellow image. if i click red image, its have to change as orange image.** How to do its on gridview...?? anybody say with code. thanking you
asp.net
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dave_Green avatar image
Dave_Green answered
Hi sabari, I'd look at doing something similar to the method explained at [ http://deepak-sharma.net/2012/01/27/how-to-change-the-background-color-of-rows-in-a-gridview-based-on-the-value-of-a-column-in-asp-net-3-5/][1] but instead using the grdProduct_RowDataBound (step 5) to show the appropriate image. You could also read [ http://stackoverflow.com/questions/5679158/how-to-color-code-rows-conditionally-in-vb-and-sql][2] for a VB based solution (you don't say what language you are using in asp.net). You could then use the onclick event to change the colour again. Hope that starts you on the right path. Regards, Dave. [1]: http://deepak-sharma.net/2012/01/27/how-to-change-the-background-color-of-rows-in-a-gridview-based-on-the-value-of-a-column-in-asp-net-3-5/ [2]: http://stackoverflow.com/questions/5679158/how-to-color-code-rows-conditionally-in-vb-and-sql
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

xiaoyuandlg avatar image
xiaoyuandlg Suspended answered
I don't have any good solutions but I conceive that you can apply some [C# UI gridview control][1]. [1]: http://www.kettic.com/winforms_ui/gridview.shtml
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.