Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


in database table is thier . in that table fields are
photoid , photoname,photo... i want display image in the
gridview

Answers were Sorted based on User's Feedback



in database table is thier . in that table fields are photoid , photoname,photo... i want display ..

Answer / .....

initially while inserting image into database take the
database field in oracle as BLOB in sql as image

during insertion convert the image file into bytes and
insert it into the database

during the display of image in datagrid take a image
template and display the converted values
sample code to get the image:
public byte[] spic(string cm,int id)
{
con = new OracleConnection(cm);
OracleCommand cmd = new OracleCommand("select
photo from kir_image where eid= "+id +" ", con);
con.Open();
byte[] img = (byte[])cmd.ExecuteScalar();
con.Close();
return img;
}

use Response.BinaryWrite to display the image

Is This Answer Correct ?    3 Yes 0 No

in database table is thier . in that table fields are photoid , photoname,photo... i want display ..

Answer / nagaraj

pls post a mail to below mail id answer if any knows

Is This Answer Correct ?    2 Yes 0 No

in database table is thier . in that table fields are photoid , photoname,photo... i want display ..

Answer / krishnasamy2008

Using C#(Asp.net)
-------------
<asp:TemplateColumn HeaderText ="Photo" >
<ItemTemplate>
<asp:image

</ItemTemplate>
<asp:Image ID="udphoto" ImageUrl='<%#Eval("Photo")%>'
runat="server" />
<HeaderStyle ForeColor ="blue" />
</asp:TemplateColumn>

Using Vb.Net(Asp.net)
-------------
<asp:TemplateColumn HeaderText ="Photo" >
<ItemTemplate>
<asp:image

</ItemTemplate>
<asp:Image ID="udphoto"
ImageUrl='<%#DataBinder.Eval(Container.DataItem,"Photo")%>'
runat="server" />
<HeaderStyle ForeColor ="blue" />
</asp:TemplateColumn>

Is This Answer Correct ?    2 Yes 0 No

in database table is thier . in that table fields are photoid , photoname,photo... i want display ..

Answer / deepika

Use template column and put image as control in the
itemTemplate

Is This Answer Correct ?    2 Yes 1 No

in database table is thier . in that table fields are photoid , photoname,photo... i want display ..

Answer / appu

<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="ID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID"
InsertVisible="False" ReadOnly="True"
SortExpression="ID" />
<asp:BoundField DataField="ImageName" HeaderText="ImageName"
SortExpression="ImageName" />
<asp:TemplateField HeaderText="Image">
<ItemTemplate>
<asp:Image ID="Image1" runat="server"
ImageUrl='<%# "Handler.ashx?ID=" + Eval("ID")%>'/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ID], [ImageName], [Image]
FROM [Images]"></asp:SqlDataSource>
Handler.ashx


<%@ WebHandler Language="C#" Class="Handler" %>

using System;
using System.Web;
using System.Configuration;
using System.Data.SqlClient;

public class Handler : IHttpHandler {

public void ProcessRequest (HttpContext context)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = ConfigurationManager.ConnectionStrings
["ConnectionString"].ConnectionString;

// Create SQL Command
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "Select ImageName,Image from Images" +
" where ID =@ID";
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = con;

SqlParameter ImageID = new SqlParameter
("@ID", System.Data.SqlDbType.Int);
ImageID.Value = context.Request.QueryString["ID"];
cmd.Parameters.Add(ImageID);
con.Open();
SqlDataReader dReader = cmd.ExecuteReader();
dReader.Read();
context.Response.BinaryWrite((byte[])dReader["Image"]);
dReader.Close();
con.Close();
}

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

Which protocol is used in a web api?

0 Answers  


What are Sticky Sessions?

2 Answers   Infosys,


What is web.config. How many web.config files can be allowed to use in an application?

6 Answers   Accenture, HCL, InterGraph, iSoft,


Is there any property names “isnavigating”?

0 Answers  


what is shared assembly?

2 Answers   Microsoft,


WHAT IS BOXING? HOW WE CAN USE IT?

4 Answers   Seion Infotech,


How many types of session in ASP.NET

0 Answers   MCN Solutions,


Interface have Default Modifier Is 'Public'.Where We Will Use The KeyWord In Interface?

3 Answers   Phoenix Technologies,


Can a .net web application consume java web service?

0 Answers  


Is it possible to use two versions of assembly at the same time?If possible explain with code?

3 Answers   Tech Mahindra,


What is difference between Lambda Expression and LINQ in ASP.NET?

0 Answers   Viscus Infotech,


Where the assembly is stored in asp.net?

0 Answers  


Categories