Click here to Skip to main content
15,884,388 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Custom Validation Pin
fjdiewornncalwe22-Dec-10 10:43
professionalfjdiewornncalwe22-Dec-10 10:43 
QuestionProblem with Security Information Message Pop Up Box Pin
AndyASPVB21-Dec-10 22:32
AndyASPVB21-Dec-10 22:32 
AnswerRe: Problem with Security Information Message Pop Up Box Pin
Brij22-Dec-10 0:34
mentorBrij22-Dec-10 0:34 
GeneralRe: Problem with Security Information Message Pop Up Box Pin
AndyASPVB23-Dec-10 0:01
AndyASPVB23-Dec-10 0:01 
Questionhow to put picture from dtatabase to pictureBox in asp.net ? Pin
Gali197821-Dec-10 9:38
Gali197821-Dec-10 9:38 
AnswerRe: how to put picture from dtatabase to pictureBox in asp.net ? Pin
Not Active21-Dec-10 9:56
mentorNot Active21-Dec-10 9:56 
AnswerRe: how to put picture from dtatabase to pictureBox in asp.net ? Pin
saman padidar22-Dec-10 0:51
saman padidar22-Dec-10 0:51 
GeneralRe: how to put picture from dtatabase to pictureBox in asp.net ? Pin
goldsoft22-Dec-10 3:19
goldsoft22-Dec-10 3:19 
i have this code to insert picture from database to image control:

string strQuery = "select Pic from MEN where id='1'";
SqlCommand cmd = new SqlCommand(strQuery);
Convert.ToInt32(Request.QueryString["ImageID"]);
cmd.Parameters.Add("1", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["ImageID"]);
DataTable dt = GetData(cmd);

if (dt != null)
{
   Byte[] bytes = (Byte[])dt.Rows[0]["Pic"];
   Response.Buffer = true;
   Response.Charset = "";
   Response.Cache.SetCacheability(HttpCacheability.NoCache);
   //Response.ContentType = dt.Rows[0]["ContentType"].ToString();
   Response.ContentType = dt.Rows[0]["PIC"].ToString();
   Response.AddHeader("content-disposition", "attachment;filename=" + dt.Rows[0]["PIC"].ToString());
   Response.BinaryWrite(bytes);
   Response.Flush();
   Response.End();
}
and this:

private DataTable GetData(SqlCommand cmd)
{
   DataTable dt = new DataTable();
   String strConnString = "server=" + Server + ";database=" + DataBase + ";UID=" + UID + ";password=" + PASS + ";";

   SqlConnection con = new SqlConnection(strConnString);
   SqlDataAdapter sda = new SqlDataAdapter();
   cmd.CommandType = CommandType.Text;
   cmd.Connection = con;

   try
   {
      con.Open();
      sda.SelectCommand = cmd;
      sda.Fill(dt);
      return dt;
   }
   catch
   {
      return null;
   }
   finally
   {
      con.Close();
      sda.Dispose();
      con.Dispose();
   }
}

and this image:

<asp:image ID="Image2" runat="server" ImageUrl ="PhoneBook.aspx?ImageID=1"/>

but when I run this code I get "save picture on disk" and not insert to the image control

How to fix it ?

thanks
GeneralRe: how to put picture from dtatabase to pictureBox in asp.net ? Pin
Not Active22-Dec-10 3:43
mentorNot Active22-Dec-10 3:43 
QuestionBulk updating values from GridView bound to a datatable [moved] Pin
6,921,364 and growing21-Dec-10 2:47
6,921,364 and growing21-Dec-10 2:47 
AnswerRe: Bulk updating values from GridView bound to a datatable [moved] Pin
6,921,364 and growing23-Dec-10 1:33
6,921,364 and growing23-Dec-10 1:33 
QuestionExport DataGrid to Excel Problem with Code. Pin
Asif Rehman21-Dec-10 1:08
Asif Rehman21-Dec-10 1:08 
AnswerRe: Export DataGrid to Excel Problem with Code. Pin
thatraja23-Dec-10 7:26
professionalthatraja23-Dec-10 7:26 
AnswerRe: Export DataGrid to Excel Problem with Code. Pin
Srinivas_Kotra24-Dec-10 3:32
Srinivas_Kotra24-Dec-10 3:32 
QuestionDynamically Add Tabs in Tabcontainer Ajaxtoolkit3.0 Pin
idreesbadshah20-Dec-10 21:19
idreesbadshah20-Dec-10 21:19 
AnswerRe: Dynamically Add Tabs in Tabcontainer Ajaxtoolkit3.0 Pin
Tej Aj21-Dec-10 6:02
Tej Aj21-Dec-10 6:02 
Questionscan a photo by asp.net Pin
mehrnoosh20-Dec-10 20:49
mehrnoosh20-Dec-10 20:49 
AnswerRe: scan a photo by asp.net Pin
Pete O'Hanlon20-Dec-10 21:41
mvePete O'Hanlon20-Dec-10 21:41 
AnswerRe: scan a photo by asp.net Pin
Sajjan Kr Mishra21-Dec-10 4:30
Sajjan Kr Mishra21-Dec-10 4:30 
GeneralRe: scan a photo by asp.net Pin
mehrnoosh21-Dec-10 18:24
mehrnoosh21-Dec-10 18:24 
QuestionMessage Removed Pin
20-Dec-10 19:44
Ravi Mori20-Dec-10 19:44 
AnswerRe: IIS hosting Pin
RaviRanjanKr20-Dec-10 20:57
professionalRaviRanjanKr20-Dec-10 20:57 
GeneralMessage Removed Pin
20-Dec-10 22:55
Ravi Mori20-Dec-10 22:55 
GeneralRe: IIS hosting Pin
RaviRanjanKr21-Dec-10 1:31
professionalRaviRanjanKr21-Dec-10 1:31 
GeneralRe: IIS hosting Pin
thatraja21-Dec-10 2:40
professionalthatraja21-Dec-10 2:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.