Through this code i am getting the images from database and bind it with datalist.
but i want to put radio button ahead of each image how can i do that please help me this is my college project and i have to submit it in a week.
This is my webform :
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="diseaseid.aspx.cs" Inherits="project007.diseaseid" %>
This is my codebehind:
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Conn"].ToString());
SqlCommand command = new SqlCommand("SELECT diseaseid,image from [disease_details]", con);
SqlDataAdapter ada = new SqlDataAdapter(command);
DataTable dt = new DataTable();
ada.Fill(dt);
DataList1.DataSource = dt;
DataList1.DataBind();
}
This is my handler for fetch image stored in database as image datatype:
public class Handler5 : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
try
{
string diseaseid = context.Request.QueryString["diseaseid"];
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ToString());
con.Open();
SqlCommand command = new SqlCommand("select * from disease_details where diseaseid=" + diseaseid, con);
SqlDataReader dr = command.ExecuteReader();
dr.Read();
context.Response.BinaryWrite((byte[])dr["image"]);
con.Close();
context.Response.End();
}
catch (Exception ex)
{
ex.ToString();
}
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Joginder BangerPosted Mar 20, 2016, 4:31 PM