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
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 |
Answer / nagaraj
pls post a mail to below mail id answer if any knows
Is This Answer Correct ? | 2 Yes | 0 No |
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 |
Answer / deepika
Use template column and put image as control in the
itemTemplate
Is This Answer Correct ? | 2 Yes | 1 No |
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 |
Explain about Application and Session Events ?
What is session object? Describe in detail.
what is abstract class and method..
How do I open an ashx file?
What is synchronous and Asynchronous post back ?
Hi, I am developing an application (quiz engine) using C# in Dot net. My problem is I am designing the selction option using radio button. So, I want to retrive the data from the database to the radiobutton option. And also please tell me the how to compare the correct answer option with Answer selected by the users. If any body knows or have done this before please Help me out. My mail id is get_rome@yahoo.co.in. Table format: Question Id Queston Option1 Option 2 Option 3 Option 4 Correct answer 1 What is ur name? My name is ….. My name …. My name …. My name …. My name is tom
if you disable view state of a textbox will it maintain data during postbacks.if yes reason
9 Answers FactorH, Jindal, Oxi Infotech,
What is application variable?
Hi, I am working in a small software company in asp.net platform. I need to know how and what are all the task in asp.net will be assigned for the developers in mnc companies. Thanks in advance.
What are the different methods of session maintenance in asp.net?
What are the steps to follow to host a web application on a web server?
Tell me how asp.net mvc differs from asp.net web forms? : asp.net mvc