Forms Data Controls :: Display Image In Gridview According To Condition?

May 8, 2010

I have a gridview bound to object data source & in its item template i have some labels and one image control and I have a [Status] column in database that store either true or false in bit format . now what i want is if value in status column is true then image control's ImageUrl property should use image ~/images/Show.jpg and if it have false value then it should show ~/images/Hide.jpg.

currently i am using this code it works fine but i think there must be some good better way to achieve this goal. here is the code that i m using

if (e.Row.RowType == DataControlRowType.DataRow)
{
Image img = (Image)e.Row.FindControl("ImgCatStatus");
if (img.AlternateText == "True")
{
img.ImageUrl = "~/images/Show.jpg";
}
else
{
img.ImageUrl = "~/images/Hide.jpg";
}

i have bound the alertenateurl to <%#Bind('Status')%> and performing evaluation based on value it contain

View 7 Replies


Similar Messages:

Forms Data Controls :: Image Display In Gridview Based On Condition?

Mar 7, 2011

i m displaying an image in gridview based on condition from sql table. That is if the colum named "availabillity" is A the image will be red n if the value is "NA" the image will be green. i am using RowDataBound event.

but i am getting error as "Cannot implicitly convert type 'System.Web.UI.WebControls.DataControlRowType' to 'bool'".

View 7 Replies

Forms Data Controls :: How To Display The Images In GridView Based On Certain Condition

Jun 29, 2010

if i give the 10 number,10 number of same images should be diplayd in the Grid View.

how can i do that.

View 7 Replies

Data Controls :: How To Display Different Row Colors Based On Condition In Gridview

Jul 19, 2013

how to display row values based on condition in grid view control and how to display different row colors based on condition in grid view.

View 1 Replies

Data Controls :: Show Or Hide Image Control In GridView Based On Condition From Database

Dec 19, 2012

i am using template field display image based on condition in table field. i have field name  verify i used to store yes or no value if it is yes then display image else noting to display in gridview

View 1 Replies

Data Controls :: Display Count Of Specific Records Of GridView Based On Condition

May 7, 2015

I have to add the total no of present in grid view.

E.g.

id name status1 s Present1 s Present1 s Present total 3

I need to show the present days as total.

View 1 Replies

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

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

Data Controls :: Display Default Image (NotFound) When Image Does Not Exist In GridView?

Aug 30, 2012

i have gridview in my page

<asp:TemplateField ItemStyle-Width = "25px" HeaderText = "" ItemStyle-Height="18px" HeaderStyle-Height="18px" ItemStyle-HorizontalAlign="left">
<ItemTemplate>
<asp:Label ID="lblType" runat="server" Text='<%# Eval("price") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>

i want if there wasn't any data in database, I want to display not found message

View 1 Replies

Data Controls :: Display Alternate Image If Image Is Not Present In GridView

Mar 15, 2013

How can i but alternate Image if No image retrieve  in image Control  ? 

View 1 Replies

Data Controls :: Display GridView Selected Row Image In Image Control

Dec 3, 2013

My file path in which I have stored image will be like this "C:Documents and SettingssureshDesktopRegIR_NEWRegIRinDebug....Images8-Q-IMG.jpg".

This file path will be diaplayed in Gridview and I have made "Auto Generate Select Button - True" in Gridview.

Is it possible to get the image in image control by using this file path on the click of "SELECT" option in gridview.

My running this application on a remote server.

View 1 Replies

Data Controls :: Display Image In Image Control When LinkButton Inside GridView Is Clicked?

Aug 18, 2015

i have added a hyperlink in the gridview and i am displaying the image names in the grid as hyperlinks

when i click on the hyperlink in the grid, the related image has to be displayed in the same page but in another div which is next to gridview

but for me ,image is displaying in another page

View 1 Replies

Data Controls :: Display Image In GridView With Path In Database With Image Enlarge Option?

Jan 12, 2013

<asp:ImageField DataImageUrlField="photo" > <ItemStyle Width="50px" Height ="50px"
HorizontalAlign="Center" VerticalAlign="Middle" ></ItemStyle>
</asp:ImageField>

i need to display image from database in gridview.  i have the above html and a select query executed from code behind which displays the image.

i am storing the image path in the database table and image in a folder.

Queries related to above

1. image size not able to set

2. the gridview image column will display image if the column data is not blank. but if its blank i have 2 default images  male image and female image

so if the field is blank i need to display one of the default images depending on the gender selected
 
3. if the image is clicked it should show enlarged image as popup 

View 1 Replies

Display Folder Or File Image Based On A Condition

May 21, 2010

Am displaying the contents of a folder(folders n files) in a gridview.In the gridview,file/foldername ,type ,size ,Last modified date columns are displayed.the datasource for this gridview is supplied manually through a datatable.

I need to display folder/file images beside folder/filename.if the datasource is from a database we can give a if condition in the following way.

[code]....

But here in itemtemplate I am binding the data using bind expression instead of Eval .So I could not give if condition here.

How can I display folder or file image based on a condition ?the datasource is provided manually to the gridview not from a database.

View 5 Replies

Forms Data Controls :: How To Display Image In Gridview

Mar 15, 2011

I m trying to display image in gridview using following code with ADO.NET. What changes are require?

[Code]....

View 2 Replies

Forms Data Controls :: Image Is Not Display In The GridView

Mar 22, 2010

------------------------------ASPX CODE---------------------------------------------------

---------------------------------CS CODE--------------------------------------------------- protected void Page_Load(object sender, EventArgs e) { Page.DataBind(); } It will not seen the Images in the GridView.

View 3 Replies

Forms Data Controls :: Display Image In Gridview?

Jan 15, 2011

I want to display in image in gridview .

this is gridview

<asp:GridView ID="gvDetails" runat="server" AllowPaging="True" >
<Columns>
<asp:TemplateField HeaderText="Cover">
<ItemTemplate>
<asp:Image Height="200px" Width="150px" ID="imgSaved" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem, "cover") %>'
AlternateText='<%#DataBinder.Eval(Container.DataItem,"BookName") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="BookID" HeaderText="Book ID" SortExpression="BookID" />
here is the problem
<asp:Image Height="200px" Width="150px" ID="imgSaved" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem, "cover") %>'
AlternateText='<%#DataBinder.Eval(Container.DataItem,"BookName") %>' />
</Columns>
</asp:GridView>

i want to display cover in gridview. datattype of cover is varbinary(Max).my image is stored in database as varbinary. but image is not display.all other fields are displaying fine.this is the code

DataSet ds = new DataSet();
SqlDataAdapter adp;
adp = new SqlDataAdapter("SELECT * FROM BooksDetails", conn);
ds.Clear();
adp.Fill(ds, "BooksDetails");
gvDetails.DataSource = ds;
gvDetails.DataBind();

View 5 Replies

Data Controls :: Display Image Thumbnail From Database In GridView And Display Enlarged Popup

May 7, 2015

After saving image in db how can we retrieve it in gridview like thumbnail size image and by clicking on image in gridview its open as preview. How can we do this in asp.net using c#.

View 1 Replies

Forms Data Controls :: Display A Hyperlink In The Gridview With An Image?

Aug 9, 2010

[Code]....

I am trying to display a hyperlink in the gridview with an image. I want the url to redirect to the id variable from the id field in the database.

View 4 Replies

Forms Data Controls :: Image Display AnyControl Gridview?

Jun 3, 2010

I need to display images that way it is displayed in windows XP. Lets say if you open any images folder in XP all the images will be displayed in thumbnail format at the bottom and on selection of any images a bigger size pic is displayed at top.All of this would be displayed on click of link button inside gridview

View 5 Replies

Forms Data Controls :: Display Image Icon In HyperLinkField Of Gridview?

Aug 30, 2010

how to display an image in a HyperLinkField of a gridview? Instead of words, I just want to show a simple little icon that can be clicked on and pass a query string to the next page. The first hyperlink field I have set up works perfectly and passes the querystring to the next page. The second hyperlinkfield is my attempt at showing the image but it's giving me a squiggly and telling me "the element img cannot be nested within the element hyperlinkfield" I got this technique from this brief article - I would like to accomplish exactly what it says it is suppose to do.

[Code]....

View 5 Replies

Forms Data Controls :: Using Gridview To Display Image ,stored In Database?

Mar 8, 2010

I'm new in storing and displaying image to database.I have learn how to store image into my database from a site and seems like it work, and the image is store as binary data.Now i try to retrieve and store it, using a site as a reference

My problem is i follow everything but in the end it seems the gridview do work as it shown some data from the database but for the image, only show a small red cross "unable to show image" sign there.

My storing data and uploading image to database code (Just in case)

[Code]....

My image handler
[Code]....

My gridview that display information
[Code]....

View 1 Replies

Forms Data Controls :: Display Image Datatype In Gridview Or Any Control?

Jun 3, 2010

how to display image datatype from sql server (stored in binary format) in gridview or any control.

View 5 Replies

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

Forms Data Controls :: How To Change The Color Of The Value In Gridview Using Condition

Jun 17, 2010

[URL]

if the ABOVE pic is not visible CLICK HERE to view

I want to change the colors of the values from the table SALARY

if the salary is > 20,000 i want to change it to GREEN color

if < 20,000 then it should show RED color

View 4 Replies







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