|
hi everybody. I am storing an image in database. but when i retrieve it from it, i can't find a way to display it in image control of my form. I am using buffer for uploading and downloading images. i am supposed to store that image on hard drive and then apply the path of that image into image control.
please tell me if is there any other alternative.
|
|
|
|
|
This is a good one to Google. There has been a lot written about displaying images in a database on an ASP.NET form - typically the solution will either involve having a dedicated .aspx page that returns the image as a binary stream, or having a custom ASP.NET handler (.ashx) that will retrieve and stream out images. The consuming page would then have something like
<img src='myImagePage.aspx?imageId=42' /> to define the image.
Creating a dedicated .aspx page for this is probably easier - here's an example:
http://www.superdotnet.com/Article.aspx?ArticleID=83[^]
Creating an HTTP handler requires a little more understading, but could pay off for you if you're interested in learning about it. Here is a link that describes HTTP handlers and a second that specifically deals with image display:
http://www.15seconds.com/issue/020417.htm[^]
http://www.c-sharpcorner.com/Code/2003/June/HTTPHandlersForImages.asp[^]
|
|
|
|
|
Hi,
Is there any way to add items to a datalist manually?
Thanks!
munklefish
|
|
|
|
|
Hi munkle. Wouldn't you have to add an item to the DataList's underlying DataSource and rebind?
I'm thinking that maybe you'd use an ArrayList for the datasource, then .Add() items to the arraylist and rebind as necessary?
|
|
|
|
|
Mike,
Talk about a speedy response!
I really wouldnt know, youre the expert :->! But i guess what your saying would make sense. I was hoping their was a simple answer but obviously not (at least for my purpose).
Thanks!
munklefish
|
|
|
|
|
ex - pert (n.) A person who knows a lot about very little.
|
|
|
|
|
hi all
i have a small question,,,
i am storing ASP Code in the database. the code for example have to asp.net controls ( button, label).
and i want to fetch that code from database and run it. when i use respone.write(), it doesn't work. help me plz.
-- modified at 9:05 Friday 14th April, 2006
|
|
|
|
|
You have to parse the code for it to become more than plain text. Look at the Page.ParseControl method.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks Guffa.
its work now
|
|
|
|
|
Does anyone know of any good links for crystal reports. I need to create one from scratch and without the wizard. It needs to use sql server for a query to return all the data for the parameters I enter. At the momment i can get it to return everything but i want to limit this to an id to get all the report info and generate.
Any help is much apprciated.
|
|
|
|
|
hi mcgannmcgann ,
I have a one link about crystal report i thik i will give u better understanding still if u will face problem in crystal report reply again...
link-->
http://www.codeproject.com/aspnet/crystal_report.asp
jitendra
|
|
|
|
|
Hi,
I have a two pages.I have a check box in the second page.if i check the check box in the second page i want to populate the values from the first page with out postback. i.e i want it to work at the client side.Can someone help me out.It is important.
|
|
|
|
|
hi uma ,
I have a one solution but our value will papulate on pop up window if this is your requirement then i will send u code .
or refer this link u will got solution i think so.....
http://www.dotnetbips.com/articles/displayarticle.aspx?id=306 :
jitendra
|
|
|
|
|
Hi Jitendra,
WE are not using a popup but anyway u send me the code I will make use of it.
bye
|
|
|
|
|
Hi Jitendra,
I have gone through the code but it will not suit my requirement.Would u pls send me the code that u have done.I will make use of it.Its urgent.
Bye
|
|
|
|
|
Hi.
I have created and image in the Page_Load event:
Bitmap bm = new Bitmap(300, 300);
Graphics g = Graphics.FromImage(bm);
g.FillRectangle(brush, 50,50,100,100);
g.DrawLine(Pens.WhiteSmoke, 10, 10,180,10);
g.DrawLine(Pens.White,10,10,10,180);
After the line drawing code I added:
bm.Save(Response.OutputStream, ImageFormat.Jpeg);
bm.Save("C:\\mypic.gif", ImageFormat.Jpeg);
bm.Dispose();
g.Dispose();
I would like to be able to save that image to my hard drive but I haven´t been able to do that, can anyone help me? This compiles just fine but when I want to view it in the browser and an error occurs. What am I doing wrong? Can someone please show me the error of my ways?
Thanks,
F
|
|
|
|
|
So what is the error you are getting? Are you certain the account running the ASP.NET worker process has permission to write to the C:\ directory?
|
|
|
|
|
Hi.
I am just running this on my own PC and I pretty much copied the code from a book to learn and modify later. Everything seems to be OK but when I right-click and choose view in browser I get:
A generic error occurred in GDI+ and this line gets the red color:
bm.Save("C:\\Mypic.gif", ImageFormat.Jpeg);
This just doesn´t make sense
F
|
|
|
|
|
Perhaps you need to look at the InnerException of the exception you are getting? The outer exception may say "generic error", but often the InnerException will have more details.
I'm still betting that your ASP.NET worker process does not have permission to write to your C:\ directory. Any comment on that?
|
|
|
|
|
Hi.
I am not really following you If you are right, how do we fix the problem?
F
|
|
|
|
|
|
Hi.
It just so happens that I have 2 hard drives, c and e. I changed the code to:
bm.Save("e:\\mypic.gif",ImageFormat.Jpeg);
and it made all the difference in the world , the image appears on drive e. You were absolutely right!! Very impressive. On the other hand I don´t understand why this small change makes such a big difference? Do you have any suggestions on how I can make the pic save to c?
F
|
|
|
|
|
Hello dear,
I have just use this code of yours and it is working absolutely fine. Storing the picture in the given folder and displaying it in Browser or anything else.
Bitmap bm = new Bitmap(300, 300);<br />
Graphics g = Graphics.FromImage(bm);<br />
g.DrawLine(Pens.WhiteSmoke, 10, 10,180,10);<br />
g.DrawLine(Pens.White,10,10,10,180);<br />
<br />
bm.Save("C:\\mypic.gif", ImageFormat.Gif);<br />
bm.Dispose();<br />
g.Dispose();
I have modified a little bit.
regards
Mubashir
|
|
|
|
|
Hi.
If I comment out this line: bm.Save("C:\\mypic.gif", ImageFormat.Gif);
I get no error reports but I want to save it to my hard drive.
F
|
|
|
|
|
i want to drag and drop list box item in the tree view. in c#
any ideas ,
thanks in advance.
|
|
|
|