I am Using a AsynchronousPostBack control and a html img control to view the selected image..
The code runs well and I do get a output too..
But,Then I after I realize that I am not able to change img control's height and width..And also the img control and an other Asp:image control which I have used to set the ThrobberID property of the <asp: AsynchronousPostBack ..>control..are not appearing
in the design view..
Please note that though I tried to set width and height of the img control as per as my desire..it didn't appeared as such on the page..
Other Functions are--
function uploadStarted1() {
$get("imgDisplay1").style.display = "none";
}
function uploadComplete1(sender, args) {
var imgDisplay= document.getElementById("imgDisplay1");
// var imgDisplay = $get("imgDisplay");
imgDisplay.src = "";
imgDisplay.style.cssText = "";
var img = new Image();
img.onload = function () {
imgDisplay.style.cssText = "height:100px;width:100px";
imgDisplay.src = img.src;
};
img.src = "<%=ResolveUrl(UploadFolderPath) %>" + args.get_fileName();
var filename = args.get_fileName();
var contentType = args.get_contentType();
var text = "Name: " + filename + " Size: " + args.get_length() + "Bytes";
if (contentType.length > 0) {
text += " Type: '" + contentType + "'.";
}
document.getElementById('lblStatus1').innerText = text;
}
Please suggest me where to make the changes so that I can adjust width and height of the img control as per as my desire..Right now it is displaying as passport size pic or I believe even less than that..
you need to add client side function on image upload success and need to return those attributes that you want to set..... in that client function you can use javascript to set height and width that you have returned... if you want some sample please let me
know
ambitiousrah...
Member
24 Points
20 Posts
[Javascript Programmers] Please Help..
Oct 14, 2011 08:59 PM|LINK
It might be simple bt it's somewhat new to me..
I am Using a AsynchronousPostBack control and a html img control to view the selected image..
The code runs well and I do get a output too..
But,Then I after I realize that I am not able to change img control's height and width..And also the img control and an other Asp:image control which I have used to set the ThrobberID property of the <asp: AsynchronousPostBack ..>control..are not appearing in the design view..
The controls which I used are.
<asp:AsyncFileUpload ID="AsyncFileUpload1" runat="server" OnClientUploadComplete="uploadComplete1" OnClientUploadStarted="uploadStarted1" UploaderStyle="Modern" CompleteBackColor="White" OnUploadedComplete="FileUploadComplete" ThrobberID="imgLoader1" /> <asp:Image ID="imgLoader1" runat="server" ImageUrl="~/ajax_loader.gif" Width="35" Height="40" /><br /><br /> <img id = "imgDisplay1" alt="" runat="server" src="" width="100" height="120" style = "display:none"/> <asp:Label ID="lblStatus1" runat="server" ForeColor="#003399" Text=""></asp:Label>function uploadStarted1() {$get("imgDisplay1").style.display = "none"; }function uploadComplete1(sender, args) { var imgDisplay= document.getElementById("imgDisplay1"); // var imgDisplay = $get("imgDisplay"); imgDisplay.src = ""; imgDisplay.style.cssText = ""; var img = new Image(); img.onload = function () { imgDisplay.style.cssText = "height:100px;width:100px"; imgDisplay.src = img.src; }; img.src = "<%=ResolveUrl(UploadFolderPath) %>" + args.get_fileName(); var filename = args.get_fileName(); var contentType = args.get_contentType(); var text = "Name: " + filename + " Size: " + args.get_length() + "Bytes"; if (contentType.length > 0) { text += " Type: '" + contentType + "'."; } document.getElementById('lblStatus1').innerText = text; }Please suggest me where to make the changes so that I can adjust width and height of the img control as per as my desire..Right now it is displaying as passport size pic or I believe even less than that..
Please Do reply....
Thnks
megh1207
Contributor
2274 Points
494 Posts
Re: [Javascript Programmers] Please Help..
Oct 15, 2011 11:28 AM|LINK
ambitiousrah...
Member
24 Points
20 Posts
Re: [Javascript Programmers] Please Help..
Oct 16, 2011 06:54 AM|LINK
megh1207
Thnks for the reply..
I understodd the logic but am unable to implement it..as I am not so confident in javascript programming..
It wud be a great help if u post a sampe code,sir..
Thnks in advance...
megh1207
Contributor
2274 Points
494 Posts
Re: [Javascript Programmers] Please Help..
Oct 16, 2011 08:19 AM|LINK
here you can use this for help
http://weblogs.asp.net/manojkdotnet/archive/2009/10/16/asynfileupload-control-and-its-validation.aspx
and here my sample if you want
http://www.4shared.com/file/yg9aVxAV/sample.html
feel free to ask any issue.