473,472 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Save state when create image

Hi there, I will be very happy if someone helps me. I need to create dynamic
image, and save the state between the postback. I mean I've got 5 buttons
and when I click on one of them, the image is creted with:

System.Web.UI.WebControls.Image Img1 = new
System.Web.UI.WebControls.Image();

Img1.ImageUrl = newPath;

Panel1.Controls.Add(Img1);

That's work fine but when I click on some of the other buttons I lost the
Image.

I tried this:

System.Web.UI.WebControls.Image Img1 = new
System.Web.UI.WebControls.Image();

Panel1.Controls.Add(Img1);

Img1.ImageUrl = newPath;

But it does not help me. I cant use OnInit, so the only way which I know is
to add image in design time and do it with Panel1.visible=false ,but I am
looking for more intelligent way to do it.

Any idea?
Nov 19 '05 #1
2 2254
Hi Mango
put ur image control at design and set visible to false
when u click ur button change the visibilty to true and pase ur imagepath to
it .
Hope this help:)

"Mango" wrote:
Hi there, I will be very happy if someone helps me. I need to create dynamic
image, and save the state between the postback. I mean I've got 5 buttons
and when I click on one of them, the image is creted with:

System.Web.UI.WebControls.Image Img1 = new
System.Web.UI.WebControls.Image();

Img1.ImageUrl = newPath;

Panel1.Controls.Add(Img1);

That's work fine but when I click on some of the other buttons I lost the
Image.

I tried this:

System.Web.UI.WebControls.Image Img1 = new
System.Web.UI.WebControls.Image();

Panel1.Controls.Add(Img1);

Img1.ImageUrl = newPath;

But it does not help me. I cant use OnInit, so the only way which I know is
to add image in design time and do it with Panel1.visible=false ,but I am
looking for more intelligent way to do it.

Any idea?

Nov 19 '05 #2
All controls you create dynamically you have to re-create on every postback.
And, as in another response, it's much simpler to create controls in design
time and in run time just switch their visibility.

Eliyahu

"Mango" <mi*********@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi there, I will be very happy if someone helps me. I need to create dynamic image, and save the state between the postback. I mean I've got 5 buttons
and when I click on one of them, the image is creted with:

System.Web.UI.WebControls.Image Img1 = new
System.Web.UI.WebControls.Image();

Img1.ImageUrl = newPath;

Panel1.Controls.Add(Img1);

That's work fine but when I click on some of the other buttons I lost the
Image.

I tried this:

System.Web.UI.WebControls.Image Img1 = new
System.Web.UI.WebControls.Image();

Panel1.Controls.Add(Img1);

Img1.ImageUrl = newPath;

But it does not help me. I cant use OnInit, so the only way which I know is to add image in design time and do it with Panel1.visible=false ,but I am
looking for more intelligent way to do it.

Any idea?

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mark Johnson | last post by:
How can you save all or a portion of the Grafics object to a Image/Bitmap ? I am try to save the Images from Cards.dll to a BitMap file. I can read in the Images to the Grafics, but when I try this...
0
by: prakash | last post by:
Dear Friends I am new guy to Visual C++.NET I've program to save website as a image vc++.net . It have a function "SaveSnapshot" to save the webpage as an image On that function ifor saving...
4
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a...
2
by: NATO24 | last post by:
Hello, I am trying to write a sub routine that I can pass a posted (image) file to. That routine will save the original file, then create a thumbnail and save it. When I try to create the image...
1
by: Hardy Wang | last post by:
Hi, I found a piece of code to add drop shadow to a photo like below, after I save the image, it is actually a BMP file even though I specify a JPG file extension (see...
15
by: Sharon | last post by:
Hello gurus, I have a System.IntPtr pointing to the memory address of my image (not a ..NET image). I wish to save this image data pointed by the IntPtr to a raw data file. The way I now to...
1
by: liuliuliu | last post by:
hi -- sorry if this is trivial -- but how do you make a screenshot of a pygame display? i have a surface which is basically the entire visible screen -- how do you write this surface as an image...
3
by: =?Utf-8?B?Um9nZWxpbw==?= | last post by:
I'm having the wierdest problem. I'm trying to save images into a SQL 2005 database. the field is just called "IMAGES" and hte data type is "image". here is my code to save //following code...
3
by: neovantage | last post by:
Hey all, i have created image by mixing logo and the original image. It create image and show in the same window. I have done 3 steps for this. First i upload an image to my server by using...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.