We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Swapping images in a rendered html document

Thread ID:





40927 Feb 16,2006 06:08 PM UTC Feb 17,2006 01:05 PM UTC Windows Forms 2
Tags: HTMLUIControl
Neil Conway
Asked On February 16, 2006 06:08 PM UTC

I am interested in changing an image in an HTMLUIControl after the page has been rendered. The following statement does not appear to work: this.image1.Attributes["src"].Value = "..\\..\\btnStep3d0.bmp"; It gives me this error: “Object reference not set to an instance of an object.” I made sure that I had instanciated image1. The following code was executed before trying to add an image to the document. public void htmluiControlLoadFinished() { WireElements(); } private void WireElements() { try { htmlelements = htmlCtrl.Document.GetElementsByUserIdHash(); this.image1 = htmlelements["Image1"] as BaseElement; ... Here is the HTML Code I used (abbreviated):
I also tried loading the document without attempting to change the image. It worked fine. It loaded images directly hard coded into the html document. I just cannot change out the image after it is loaded. I also wondered whether not having quotes on the statement was making a difference. So, I tried the following statement: this.image1.Attributes["src"].Value = "\"..\\..\\ImageName.bmp\""; I got the same error as above. Can someone see something in my code that is incorrect? Any help or advice would be appreciated.

Neil Conway
Replied On February 16, 2006 06:13 PM UTC

I forgot that the forum would try to render my piece of html code. Here it is again without brackets: td IMG alt="" src="" id="Image1" /td

Neil Conway
Replied On February 17, 2006 01:05 PM UTC

I found the error. The wiring event was not firing. My apologies for the false alarm. I thought that there was a problem with how I had entered the filepath of the image. That turned out not to be the case.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon