Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 server controls properties that I change in client

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-09-29 : 11:15:20
I have an html image in my aspx page for example. I change its src property in javascript function.

I want to save its src property in a viewstate so when I post back the page I can load the same src property of the image. Here is what I do:

in my html page: <img id=myimage runat=server> then I set the src property of the image in a javascript function

then in code behind I do this:

HtmlImage img;

img=(HtmlImage)this.FindControl("myimage");

But I can t get the src property that I set in the javascript function. how do I do that pls

Thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-09-29 : 12:01:08
a page will get reloaded and thus generete the image with the original src.
one way to do this is to save the new src in a hidden field and then on the postback set that src to the image.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-09-29 : 13:59:29
How do I do that: let s say Change the src property in javascript:
myImage.src="........"
then in submit button. Should I get the src like this or what:
Submit.OnClick()
HtmlImage img;
img=(HtmlImage)this.FindControl("myimage");
string imagesrc;
imagesrc=img.src;


is that correct or am I mistakedn
do u have a little scenario for me or any document for this pls
Thanks
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-10-02 : 22:10:19
Using document.all.myfield.value=****** and runat=server hidden field in aspx page and code behind fixed the problem.

Thanks
Go to Top of Page
   

- Advertisement -