In case of ImageRotator we can use FileUpload Control To upload my images.Here I use it in a siple way:-
Step 1:- we use Image Control (Image1),FileUpload Contol , Button(Button1..) and HiddenField ( for store the FileName), and a Save button to call the js function
Step2 :- On the Click of Button1:-
we upload a file with the help of FileUpload1 and store the Filename in HiddenField1 and show the image in Image Control:
string filename = FileUpload1.PostedFile.FileName.ToString();
FileUpload1.SaveAs(Server.MapPath("~/") + filename);
Image1.ImageUrl = filename.ToString();
HiddenField1.Value = filename.ToString();
Step 3 :- On the Click of Button2:-
we upload a file with the help of FileUpload2 and store the Filename in HiddenField2 and show the image in Image Control:
string filename = FileUpload2.PostedFile.FileName.ToString();
FileUpload2.SaveAs(Server.MapPath("~/") + filename);
Image1.ImageUrl = filename.ToString();
HiddenField2.Value = filename.ToString();
Step 4 :- On the Click of Button3:-
we upload a file with the help of FileUpload3 and store the Filename in HiddenField3 and show the image in Image Control:
string filename = FileUpload3.PostedFile.FileName.ToString();
FileUpload3.SaveAs(Server.MapPath("~/") + filename);
Image1.ImageUrl = filename.ToString();
HiddenField3.Value = filename.ToString();
Suppose we add only three Images for ImageRotator
Step5 : on the Click of Save Button (HTML Control)
Here we call the js function (show()) on the onclick event:-
<script language="javascript" type="text/javascript" >
function show()
{
var a=document.getElementById('HiddenField1').value;
document.getElementById('Image1').src=a;
setTimeout("show2()",1000);
}
function show2()
{
var b=document.getElementById('HiddenField2').value;
document.getElementById('Image1').src=b;
setTimeout("show3()",1000);
}
function show3()
{
var b=document.getElementById('HiddenField3').value;
document.getElementById('Image1').src=b;
setTimeout("show()",1000);
}
</script>
Revision number 2, Saturday, October 30, 2010 2:03:41 PM by codenickel