Click here to Skip to main content
15,887,267 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: how tp set port number for web site Pin
Abhijit Jana31-Mar-09 19:42
professionalAbhijit Jana31-Mar-09 19:42 
GeneralRe: how tp set port number for web site Pin
Karthick_gc31-Mar-09 20:23
Karthick_gc31-Mar-09 20:23 
GeneralRe: how tp set port number for web site Pin
Abhijit Jana31-Mar-09 20:36
professionalAbhijit Jana31-Mar-09 20:36 
Questionwebrequest POST not creating the right response Pin
Exeter331-Mar-09 19:33
Exeter331-Mar-09 19:33 
QuestionSuggestion Required Pin
Mogaambo31-Mar-09 19:08
Mogaambo31-Mar-09 19:08 
AnswerRe: Suggestion Required Pin
Padmanabh Ganorkar31-Mar-09 19:30
Padmanabh Ganorkar31-Mar-09 19:30 
AnswerRe: Suggestion Required Pin
Christian Graus31-Mar-09 19:30
protectorChristian Graus31-Mar-09 19:30 
Questionhow to save images in sqlserver again retrive from sqlserver using asp.net control Pin
Ch.Gayatri Subudhi31-Mar-09 19:06
Ch.Gayatri Subudhi31-Mar-09 19:06 
Hi I am trying to store the images using asp.net browser control ie, fileupload. .Its with store the images in to the databse where i used as sqlserver as backend. It store but, after that i am trying to retrive those images through listview from backend. But here i am getting no error but no images are there in images.I need the names of the images in the listview from backend while clicking a particular image it should be enlarge in image control.Thanks in advance.Please help me.

In default.aspx.cs page:
public partial class _Default : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DigitalSignageConnectionString2"].ConnectionString.ToString());
protected void Page_Load(object sender, EventArgs e)
{
}
protected void BthSnd_Click(object sender, EventArgs e)
{
con.open();
SqlCommand mycommand = new SqlCommand("INSERT INTO Image_DiSig([image], [text],[path],[image1]) VALUES (@image, @text,@imgpath) ", con);
string apppath = Request.PhysicalApplicationPath;
FileUpload1.SaveAs(apppath + "images\\" + FileUpload1.FileName);
string imgpath = apppath + "images\\" + FileUpload1.FileName;
FileStream fs = File.OpenRead(imgpath);
byte[] imagedata = new byte[fs.Length];
mycommand.Parameters.AddWithValue("@image", imagedata);
mycommand.Parameters.AddWithValue("@text", TextBox1.Text);
mycommand.Parameters.AddWithValue("@imgpath", apppath);
mycommand.ExecuteNonQuery();
con.Close();
}

public string FormatURL2(object strArgument) //used to get that image bytes(while tracing its picking that bytes but not converting into image)
{
return ("Default2.aspx?id=" + strArgument);
}

protected void LinkButton1_Click(object sender, EventArgs e)
{
SqlDataAdapter da = new SqlDataAdapter("select * from Image_DiSig",con);
DataSet ds = new DataSet();
da.Fill(ds);
ListView1.DataSource = ds;
ListView1.DataBind();
}

protected void ListView1_SelectedIndexChanged(object sender, EventArgs e)
{

Image1.ImageUrl = ListView1.SelectedValue.ToString();
}

in default.aspx source page:

<asp:ListView ID="ListView1" runat="server"
onselectedindexchanged="ListView1_SelectedIndexChanged" SelectedIndex="0" >
<LayoutTemplate>
<div style="border:dotted 1px black;">
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</div>
</LayoutTemplate>
<ItemTemplate>
<img alt="name" align="middle" height="50px" width="100px" name="Image1" src='<%# FormatURL2(DataBinder.Eval(Container.DataItem, "id")) %>' />
</ItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:DigitalSignageConnectionString2 %>"
SelectCommand="SELECT * FROM [Image_DiSig]"></asp:SqlDataSource>

in default2.aspx.cs:

public partial class Default2 : System.Web.UI.Page
{
SqlCommand cmdd = new SqlCommand();
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DigitalSignageConnectionString2"].ConnectionString.ToString());

protected void Page_Load(object sender, EventArgs e)
{
string strImageID = Request.QueryString["id"];
try
{
conn.Open();
SqlDataReader dr = null;
cmdd = new SqlCommand("select image from Image_DiSig where id=" + strImageID,conn);
dr = cmdd.ExecuteReader();

while (dr.Read())
{

if (dr["image"].ToString() == "")
{
Response.Write("no image");
}
else
{
byte[] img = (byte[])(dr["image"]);
Response.BinaryWrite(img);
}
}
}
catch (Exception ee)
{
Response.Write(ee.Message);
}
finally
{
conn.Close();
}
}
}

With Regards
Ch.Gayatri Subudhi
AnswerRe: how to save images in sqlserver again retrive from sqlserver using asp.net control Pin
Christian Graus31-Mar-09 19:14
protectorChristian Graus31-Mar-09 19:14 
GeneralRe: how to save images in sqlserver again retrive from sqlserver using asp.net control Pin
Ch.Gayatri Subudhi31-Mar-09 19:45
Ch.Gayatri Subudhi31-Mar-09 19:45 
QuestionError for file upload Pin
saravanan0531-Mar-09 18:10
saravanan0531-Mar-09 18:10 
AnswerRe: Error for file upload Pin
Christian Graus31-Mar-09 18:18
protectorChristian Graus31-Mar-09 18:18 
AnswerRe: Error for file upload Pin
Rajeesh MP31-Mar-09 18:18
Rajeesh MP31-Mar-09 18:18 
AnswerRe: Error for file upload Pin
Abhijit Jana31-Mar-09 18:50
professionalAbhijit Jana31-Mar-09 18:50 
QuestionASP.net with vb: Insert data into specific cell in excel file Pin
nicholasng31-Mar-09 13:47
nicholasng31-Mar-09 13:47 
AnswerRe: ASP.net with vb: Insert data into specific cell in excel file Pin
Christian Graus31-Mar-09 15:01
protectorChristian Graus31-Mar-09 15:01 
GeneralRe: ASP.net with vb: Insert data into specific cell in excel file Pin
Rajeesh MP31-Mar-09 18:16
Rajeesh MP31-Mar-09 18:16 
GeneralRe: ASP.net with vb: Insert data into specific cell in excel file Pin
nicholasng1-Apr-09 2:36
nicholasng1-Apr-09 2:36 
QuestionType or namespace not found for user control. Pin
Brady Kelly31-Mar-09 9:53
Brady Kelly31-Mar-09 9:53 
QuestionPassing data through hyperlink Pin
yorockk31-Mar-09 9:28
yorockk31-Mar-09 9:28 
AnswerRe: Passing data through hyperlink Pin
Yusuf31-Mar-09 12:23
Yusuf31-Mar-09 12:23 
GeneralRe: Passing data through hyperlink Pin
zy5187593931-Mar-09 17:43
zy5187593931-Mar-09 17:43 
GeneralRe: Passing data through hyperlink Pin
yorockk31-Mar-09 18:49
yorockk31-Mar-09 18:49 
AnswerRe: Passing data through hyperlink Pin
vinodkrebc31-Mar-09 18:32
vinodkrebc31-Mar-09 18:32 
GeneralRe: Passing data through hyperlink Pin
yorockk31-Mar-09 20:43
yorockk31-Mar-09 20:43 

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.