Click here to Skip to main content
15,887,746 members
Home / Discussions / Web Development
   

Web Development

 
QuestionAlert for unsaved Data on page Pin
khush111-Apr-09 8:12
khush111-Apr-09 8:12 
AnswerRe: Alert for unsaved Data on page Pin
Marc Firth7-Apr-09 21:59
Marc Firth7-Apr-09 21:59 
QuestionJavascript Help!! [modified] Pin
chungonttt1-Apr-09 0:18
chungonttt1-Apr-09 0:18 
AnswerRe: Javascript Help!! Pin
Marc Firth1-Apr-09 1:31
Marc Firth1-Apr-09 1:31 
QuestionText Over Text in HTML Pin
Harvey Saayman31-Mar-09 22:06
Harvey Saayman31-Mar-09 22:06 
AnswerRe: Text Over Text in HTML Pin
Marc Firth1-Apr-09 1:34
Marc Firth1-Apr-09 1:34 
Questioni need imge viewer for web in asp, javascript plzz help mee its urgent Pin
khurramram31-Mar-09 21:43
khurramram31-Mar-09 21:43 
Questionhow to save images in sqlserver again retrive from sqlserver using asp.net control Pin
Ch.Gayatri Subudhi31-Mar-09 19:09
Ch.Gayatri Subudhi31-Mar-09 19:09 
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
Mohammad Dayyan31-Mar-09 20:59
Mohammad Dayyan31-Mar-09 20:59 
Questionadding a item to listbox by javascript [modified] Pin
[N][Q][H]31-Mar-09 15:20
[N][Q][H]31-Mar-09 15:20 
AnswerRe: adding a item to listbox by javascript Pin
mrMercury31-Mar-09 17:51
mrMercury31-Mar-09 17:51 
GeneralRe: adding a item to listbox by javascript Pin
[N][Q][H]31-Mar-09 18:08
[N][Q][H]31-Mar-09 18:08 
QuestionFirefox and onblur event Pin
ycorre31-Mar-09 14:55
ycorre31-Mar-09 14:55 
QuestionWSS and Ajax Pin
Not Active31-Mar-09 6:36
mentorNot Active31-Mar-09 6:36 
AnswerRe: WSS and Ajax Pin
I am BATMAN31-Mar-09 6:47
I am BATMAN31-Mar-09 6:47 
GeneralRe: WSS and Ajax Pin
Not Active31-Mar-09 6:50
mentorNot Active31-Mar-09 6:50 
AnswerRe: WSS and Ajax Pin
Not Active31-Mar-09 10:21
mentorNot Active31-Mar-09 10:21 
QuestionChanging a form's target through javascript Pin
William Engberts31-Mar-09 5:15
William Engberts31-Mar-09 5:15 
AnswerRe: Changing a form's target through javascript Pin
I am BATMAN31-Mar-09 6:31
I am BATMAN31-Mar-09 6:31 
Questionget_serverversion exception ocurred when webservice create connection to remote db Pin
Member 314758430-Mar-09 23:23
Member 314758430-Mar-09 23:23 
QuestionZip files runtime Pin
SubarnaMishra30-Mar-09 21:05
SubarnaMishra30-Mar-09 21:05 
AnswerRe: Zip files runtime Pin
SeMartens31-Mar-09 21:27
SeMartens31-Mar-09 21:27 
QuestionWeb Service callback in Desktop Client getting problem Pin
NazarHussain30-Mar-09 13:34
NazarHussain30-Mar-09 13:34 
QuestionVery in depth and specific help needed Pin
shawndeprey30-Mar-09 10:02
shawndeprey30-Mar-09 10:02 
AnswerRe: Very in depth and specific help needed Pin
Yusuf30-Mar-09 10:13
Yusuf30-Mar-09 10:13 

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.