Display Image In Gridview Depending On Value Of Column?

Dec 2, 2010

I have a gridview which displays rows and columns all linked to an sql statement... and all works as normal.

I want to include a new column, that displays an image depending on what the value of the column is. If the column has a value - it will display an image. If the column value is null no image whill be displayed.

My sql is something like:

SELECT c.call_id, title, a.call_id as b_attach
FROM calls c
LEFT JOIN attachments a ON c.call_id = a.call_id
GROUP BY c.call_id,title,description, a.call_id

What's returns from this sql is:

Call_id | title | b_attach
1235 | title goes here | 1235
1382 | another title |NULL

So if there's something in b_attach - diplay image in gridview column, else display nothing in gridview column

My Gridview:

[Code]....



ADVERTISEMENT

Forms Data Controls :: Display An Icon In Gridview Whose Value Is Depending Upon Another Column Value?

Mar 13, 2007

I want to display an icon(image) in a gridview column which depends on the value of another column.I want to do that dynamically.How to change the imageurl dynamically.

View 9 Replies View Related

Forms Data Controls :: Display An Icon Image In Gridview Depending On The Returned Data

Aug 13, 2010

I have a gridview and would like to display one of 5 icons depending on the value returned from the database for that row (simply just A, B, C, D or E). Which event in my datagrid should I be looking at to check what value I'm getting? I presume once I can check a value I can simply set an image source using if statements?

View 4 Replies View Related

Web Forms :: Display Image (im1/img2) Depending Upon Db Value?

Dec 27, 2010

i have a database with a field for 'hasimage' with values true/false.

if it is true i want to display img1 and if false i want to display img2.

currently i have a single static image which takes user to the url.

code aspx:

<a runat="server" id="hlkmail">
<img src="../images/send_mail_icon.jpg" alt="" /></a>
<a>Send<br /> Mail</a>

code aspx.vb:

hlkmail.href="remail.aspx?clientname="&clientname

now, i want to use the db value and accordingly display img1 / img2, onclick of which will take the user to the url.

View 5 Replies View Related

Web Forms :: How To Display Image Depending Upon Db Field Value

Dec 29, 2010

this is my aspx page code :

<a runat="server" id="hlkmail"><img src="../images/send_mail_icon.jpg" alt="" /></a>
<a runat="server" id="hlkgallery"><img src="../images/galleryl_icon.jpg" alt="" /></a>

this is code behind (aspx.vb) :

hlkmail.HRef = "sndmail.aspx?Clientname=" & clientName
hlkgallery.HRef = "pgallery.aspx?Clientname=" & clientName

above code shows fixed images.

i want to display image dynamiccally depending upon the db value.

i have a stored proc that returns hasmail ='true/false' and hasgallery='true/false' from database.

if true i want to display send_mail_icon.jpg else send_mail_icon_watermark.jpg

and gallery_icon else gallery_icon_watermark.jpg. i want to do this in code behind using if loop.

View 7 Replies View Related

Forms Data Controls :: How To Update Row On Editable Gridview Depending On Two Column

Jun 29, 2010

Solved like this

currentID = Convert.ToInt32(GridView_ABC.DataKeys[0].Values[0]);
activityName = Convert.ToString(GridView_ABC.DataKeys[1].Values[1]);
DataRow row =
originalDataTable.Select(String.Format("EmployeeID = {0} AND ActivityName = '{1}'", currentID, activityName))[0];

View 1 Replies View Related

Change An Individual Image In A Gridview Depending On A Value?

Mar 5, 2011

i have 2 tables assignment and feedback, in a gridview it displays all the assignments, the assignments then get feedback. im then wanting to change the view feedback button in the gridview depending on if there is new feedback for example:

the feedback table has a state field in it so when its 1 i want that image button to change to the one with the +

View 1 Replies View Related

Forms Data Controls :: Gridview Column Changing Visibility Depending On A Row.text?

Oct 18, 2010

[Code]....

and im not getting the result i expected =

View 5 Replies View Related

Forms Data Controls :: Gridview Column Formatting Depending On Text In Header?

Mar 30, 2010

I want if the header of a particular column contains a word "S", the header and row turns red. I used following code to make header red and it works fine. How to make it such that the rows also turn red if condition is met ? I cannot hardcode in columns since the Gridview is autogenerate colums as data structure keeps changing.

Protected Sub GridView1_DataBound(ByVal sender
As
Object,
ByVal e
As System.EventArgs)Dim HeaderRow
As GridViewRow = GridView1.HeaderRowFor
Each c
As TableCell
In HeaderRow.CellsIf c.Text.EndsWith("S")
Then
c.BackColor = Drawing.Color.OrangeRed
End
If
Next
End
Sub

View 2 Replies View Related

Forms Data Controls :: TemplateField Change Itemtemplate Label CSS Depending On Column Value For Each Row In Gridview?

Jan 28, 2011

I was wondering if anyone could help me. I have a template field which has four itemtemplates that each hold a label in a gridview. These labels are always constant with the same strings. What I want to do is change the css formatting of these four labels depending on the value of a column. So the css formatting would have to be done for each row, not the whole column. I bind the gridview to a dataaccesslayer so there is no sqldatasource on the page. Does anyone have any idea how to do this and where it would be done. I will have the dataview with the data sorted in the correct order. The actual column that is used to alter the CSS will not be in the gridview although I could assign it to the datakeyname if that makes it easier as the data is not sensitive.

View 1 Replies View Related

Forms Data Controls :: >>>want To Display Gridview Column Heading When Mouse Over To The Particular Column In The Gridview?

Oct 12, 2010

I want to display gridview column heading when mouse over to the particular column in the gridview.I am working in VisualStudio 2005 with MS.Net2.0 framework.I don't want to use ajax.

View 4 Replies View Related

Forms Data Controls :: >>>Display Gridview Column Heading When MouseOver On Particular Column?

Oct 12, 2010

want to display gridview column heading when mouse over to the particular column in the gridview.

View 9 Replies View Related

Forms Data Controls :: Display Text In 2 Rows And Then A Gridview Column - Third Row Is Displayed As A Row Under First Column

Jul 14, 2010

I have a gridview with 3 columns. In second column I want to display some text in 2 rows and then a gridview.
Here is my code:

[Code]....

The problem is my third row is displayed as a row under first column. How do I make it a separate column in my girdview. Not sure what is going wrong.

View 11 Replies View Related

Sum The Column Values Of Gridview And Display In Footer Column?

Jun 10, 2009

I have gridview control with auto generate column.i dont have template columns.the columns will bind dynamically with gridview. i need to sum the all dynamic columns and have to display in footer column.

View 3 Replies View Related

VS 2008 Image In GridView / Display Images In The Gridview From The Image Folder

Jul 25, 2010

I have a folder named img containing some images:

I want to display images in the Gridview from the image folder in this way:

But without saving the image location in the Database (i.e;i want to do this using the System.IO)

I can fetch the names of all the images present in the "img" folder but my problem is i cant set the src of the <img> tag properly which would display the image here is what i did:

[code]....

View 6 Replies View Related

Forms Data Controls :: Display GridView Columns Data Depending On Conditions?

Nov 24, 2009

using DetailsView DataRowView i am able to get current row and based on conditions display specific column's data within DetailsView control.

Here is the source;

[Code]....

How can i achieve the same in GridView?

View 7 Replies View Related

Web Forms :: Display Popup When Clicked On Image Datagrid Column?

Nov 14, 2009

Displayed image(template column) in datagrid column from db.Now..I need a popup-LIKE window to display this image in bigger size if possible and some other info which I have in code

This is somewhat related to asp.net and javascript (I think so)

Mainly, the page should not reload when clicked on image column of datagrid.

Or it is possible through ajax also.....but dont know ajax(haven't done anything using this)

View 1 Replies View Related

Forms Data Controls :: Display Image In Gridview From Sql Image In .Net 2005

Mar 14, 2007

I need to Display the Image directly from SQL Database in the GridView as Thumnails. This i can do in .Net 2003 with Help of ItemDatabound Event and Template Column. But in the .Net 2005 there no ItemDatabound event in GridView.

View 3 Replies View Related

Forms Data Controls :: Display Default Image When Image (file) Not Found GridView - ImageField

Mar 26, 2010

I have a page which displays details and a pictures of employees. The details are stored in a SQL database and the images are on the server. How can I set a default Image to display (e.g. an Image saying "Awaiting Image") if an employee picture is missing?

I can't use NullImageUrl as the Images are not stored in the database. I can't use the solution found on [URL] as an ImageField does not accept an ID attribute.

[Code]....

View 7 Replies View Related

Forms Data Controls :: Gridview - Display A Image Button To Display Date

Sep 7, 2010

i have a gridview binded with data when i hover mouse to row i want to display a image button to display date ,and when i click the button i want to display calender control for choose date, and next step after i choose date it will be must insert into database. and mean while a hidden label control will display and date shuld be display in it

View 2 Replies View Related

Enlarge The Image In A Gridview Column?

Jul 2, 2009

anybody can help to enlarge the image in a gridview column. Please look my code given below and please help. At the moment mouseover is not working . Also where I can wrte the function to show the image. I am using a template column and its databound with 'FilePath' column in table. FilePath just stoing the location of the image.

<%
@
Page
Title=""
Language="C#"
MasterPageFile="~/MasterPage.Master"
AutoEventWireup="true"
CodeBehind="frmWhoAmI.aspx.cs"
Inherits="learn.frmWhoAmI" %>
<
</
<
asp:Content
ID="Content1"
ContentPlaceHolderID="head"
runat="server">asp:Content>asp:Content
ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<asp:GridView
ID="GridView1"
runat="server"
AutoGenerateColumns="False"
BackColor="#DEBA84"
BorderColor="#DEBA84"
DataSourceID="SqlDataSource1"
Width="1025px"
AllowPaging="True"
BorderStyle="None"
BorderWidth="1px"
CellPadding="3"
CellSpacing="2">
<RowStyle
BorderStyle="Groove"
BackColor="#FFF7E7"
ForeColor="#8C4510"
/>
<Columns>
<asp:BoundField
DataField="ObjectName"
HeaderText="Name"
SortExpression="ObjectName">
<ItemStyle
Width="600px"
/>
</asp:BoundField>
<asp:BoundField
DataField="ObjectDate"
HeaderText="Date"
SortExpression="ObjectDate">
<ItemStyle
Width="250px"
/>
</asp:BoundField>
<asp:BoundField
DataField="Description"
HeaderText="Description"
SortExpression="Description">
<ItemStyle
Width="600px"
/>
</asp:BoundField>
<asp:TemplateField
HeaderText="Picture">
<ItemTemplate>
<a
href="javascript:;"
onmouseover
=
"javascript:void(ShowDIV('<%# Eval("FilePath")%>'));"
>
<asp:Image
ID="Image1"
runat="server"
ImageUrl='<%# "ImageHandler.ashx?ImID="+ Eval("FilePath") %>'/>
</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle
BackColor="#F7DFB5"
ForeColor="#8C4510"
/>
<PagerStyle
ForeColor="#8C4510"
HorizontalAlign="Center"
/>
<SelectedRowStyle
BackColor="#738A9C"
Font-Bold="True"
ForeColor="White"
/>
<HeaderStyle
BackColor="#A55129"
Font-Bold="True"
ForeColor="White"
/>
<EditRowStyle
BorderStyle="Groove"
/>
</asp:GridView>
<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ObjectName], [ObjectDate], [Description], [FilePath], [ObjectType] FROM [LearnPlus].[WhoAmI]">
</asp:SqlDataSource>
function callFxToZoomIn(obj)
{ obj.parentNode.style.width = "100%";
obj.parentNode.style.height = "100%";
}
</
asp:Content>

View 6 Replies View Related

Displaying Image In Gridview Column?

Mar 30, 2011

I have image in the image folder and in my oracle database I have a column with the name IMG which has the name of the image like ab.jpg

I have another column with name IMG1 which is storing the whole url like images/ab.jpg

I can see all the values of my database table in my dataset as well including IMG column and IMG1 column

In my aspx file I wrote code

but it is not displaying anything, however aspx page is working fine, it is showing a field but no image and it is blank, same is the case with IMG1 column as well

Why is it so? What is wrong that I am doing?

I dont want to store image in database, so i store it in the folder

What method should i adopt to make it work?

Update

thats my code

[Code]....

If I look at design section it is giving me image sign with a cross but not showing the actual image

location of image is

I have folder A and there I have sub folder images and mywebpage so both mywebpage and images folder is in folder A

I have used paths as ~/images/ab.jpg and ~A/images/ab.jpg and in both cases it does not work

Method below does not work either

Using Oracle database, which is showing image url columns on dataset and even on grid as mentioned in my last post

View 1 Replies View Related

SQL Server :: Dynamic Nullable Columns Depending On The Value Of A Column?

Feb 11, 2011

I have a master document which is composed of other document types (some are required and some are not). While the master document's status is "Draft" I need to ignore all not nullable constraints (because the writer may decide to work on one of the children
documents that is not required and save as draft).

The closest solution I found for this problem is check constraints but I have not yet to see an example of this in check contraint and I'm not even sure if this is possible. Has anyone implemented a similar solution with check constraints (or any other methods)?

View 2 Replies View Related

Display Gridview Column As Row?

Feb 4, 2011

display gridview column as row?

[code]....

View 1 Replies View Related

Gridview Column Display Order

Mar 8, 2011

I am binding a Gridview to a custom object. But the order of fields displayed is not correct. Is there any way to set the fields display order when binding a Gridview to a custom object?

View 3 Replies View Related

How To Display A Gridview Column Only To Users In A Certain Role

Dec 2, 2010

I have an asp.net page with a gridview. I would like to make it so that certain columns in the gridview are displayed only if the user is in a certain role, that is, if HttpContext.Current.User.IsInRole(XXX) returns true.

What is the easiest way to do this?

I would prefer a solution where I can easily put this in my ASP code and not in the page code-behind.

View 2 Replies View Related

Forms Data Controls :: Gridview Contain An Image And Text In The Same Column?

Oct 5, 2010

I have a 1-column gridview (and it must remain 1-column) which contains only text. My requirement is to prefix each row with an image followed by the text. The image may or may not be indented a bit, like an expanded child node in a tree.

I know a gridview renders as a table and I know I could put an image at the beginning of each row in a table (using a repeater, for example). But this is an existing app with a couple gridviews which need to be enhanced and I don't have the time to swap out the gridviews for repeaters.

View 2 Replies View Related

Forms Data Controls :: Displaying Image In A Gridview Column?

Mar 30, 2011

I have image in the image folder and in my oracle database I have a column with the name IMG which has the name of the image like ab.jpg

I have another column with name IMG1 which is storing the whole url like images/ab.jpg

I can see all the values of my database table in my dataset as well including IMG column and IMG1 column

In my aspx file I wrote code

<asp:imagefield dataimageurlfield="IMG"
dataimageurlformatstring = "~/images/ab.jpg"/>

but it is not displaying anything, however aspx page is working fine, it is showing a field but no image and it is blank, same is the case with IMG1 column as well

View 5 Replies View Related

Forms Data Controls :: Show/Hide Edit Button Depending On Column Value?

Dec 15, 2010

Show/Hide Edit button depending on column value?

View 3 Replies View Related

Display A Gridview Using Select Statement Of Two Column In One Table?

Oct 24, 2010

I'm using asp.net and c# language.

How can i display a GridView using select statement of two column in one table?

This is my coding:

if (sdr.Read())
{
if(namaPembekal.Equals(sdr["namaPembekal"]) && tarikhRo.Equals(sdr["tarikhRo"]))
{
Session.Add("namaPembekal",sdr["namaPembekal"]);
Session.Add("tarikhRo", sdr["tarikhRo"]);
if((((String)(Session["namaPembekal"])).Equals("namaPembekal")) && ((String
(Session["tarikhRo"])).Equals("tarikhRo"))
GridView1.DataSourceID = SqlDataSource2.ID;
GridView1.DataSourceID = txtJourneyDate.Text;
}

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved