Web Forms :: ImageUrl Giving Wrong Path?
Aug 27, 2010
I'm working on an auto-fill feature for a form. Everything works perfectly except for filling in an image beside a file upload control. I know you can't set an upload control, so I'm setting the imageurl with the path and using that instead. The problem is, when I add the path in the code behind, it's messing up the space character (%20) in the path.
for example what should be:
file:///S:/Projects/Bulletin_Mugs/CBProject/Brown,%20john%2012-11-1981.png
becomes:
file:///S:/Projects/Bulletin_Mugs/CBProject/Brown,%2520john%252012-11-1981.png
Here's the relevant code: [Code]....and here's the path as is in the database:
S:/Projects/Bulletin_Mugs/CBProject/Brown, john 12-11-1981.png
View 6 Replies
Similar Messages:
Sep 9, 2010
I have a log in control that has this set in the aspx:
View 2 Replies
Nov 18, 2010
I have an image ItemTemplate within a FormView, where the ImageUrl is the photo_file_name. However, I want to add "~/uploads/" at the begining of the photo_file_name.
Below is the code:
[Code]....
So for example, if the photo_file_name is Jellyfish.jpg I want it, the ImageUrl to be ~/uploads/Jellyfish.jpg without having to change the photo_file_name in the DB.
View 4 Replies
Aug 19, 2010
is there a way to manipulate a piece of a File path in a ImageUrl of an asp image?
Ex: <asp:Image ID="helpButton" ImageUrl="images/HelpButtonsA/buttons/help.png" runat="server"/>
I would like to change HelpButtonsA dynamically to HelpButtonsB(assuming that the path "images/HelpButtonsB/buttons/help.png" exists.) Can it be done by setting a public variable in the code behind then using that variable in the path?
View 12 Replies
Apr 21, 2010
I'm trying to render some text into a specific part of an image in a Web Forms app. The text will be user entered, so I want to vary the font size to make sure it fits within the bounding box.
I have code that was doing this fine on my proof-of-concept implementation, but I'm now trying it against the assets from the designer, which are larger, and I'm getting some odd results.
I'm running the size calculation as follows:
StringFormat fmt = new StringFormat();
fmt.Alignment = StringAlignment.Center;
fmt.LineAlignment = StringAlignment.Near;
fmt.FormatFlags = StringFormatFlags.NoClip;
fmt.Trimming = StringTrimming.None;
[Code]....
Now I have two problems.
Firstly, the text sometimes insists on wrapping by inserting a line-break within a word, when it should just fail to fit and cause the while loop to decrement again. I can't see why it is that Graphics.MeasureCharacterRanges thinks that this fits within the box when it shouldn't be word-wrapping within a word. This behaviour is exhibited irrespective of the character set used (I get it in Latin alphabet words, as well as other parts of the Unicode range, like Cyrillic, Greek, Georgian and Armenian). Is there some setting I should be using to force Graphics.MeasureCharacterRanges only to be word-wrapping at whitespace characters (or hyphens)? This first problem is the same as post 2499067.
Secondly, in scaling up to the new image and font size, Graphics.MeasureCharacterRanges is giving me heights that are wildly off. The RectangleF I am drawing within corresponds to a visually apparent area of the image, so I can easily see when the text is being decremented more than is necessary. Yet when I pass it some text, the GetBounds call is giving me a height that is almost double what it's actually taking.
Using trial and error to set the __minimumSize to force an exit from the while loop, I can see that 24pt text fits within the bounding box, yet Graphics.MeasureCharacterRanges is reporting that the height of that text, once rendered to the image, is 122px (when the bounding box is 64px tall and it fits within that box). Indeed, without forcing the matter, the while loop iterates to 18pt, at which point Graphics.MeasureCharacterRanges returns a value that fits.
The trace log excerpt is as follows:
Decrementing font size to 24, as size is 193×122 and limit is 212×64
Decrementing font size to 23, as size is 191×117 and limit is 212×64
Decrementing font size to 22, as size is 200×75 and limit is 212×64
Decrementing font size to 21, as size is 192×71 and limit is 212×64
Decrementing font size to 20, as size is 198×68 and limit is 212×64
Decrementing font size to 19, as size is 185×65 and limit is 212×64
Writing VENNEGOOR of HESSELINK in DIN-Black at 18pt, size is 178×61 and limit is 212×64
So why is Graphics.MeasureCharacterRanges giving me a wrong result? I could understand it being, say, the line height of the font if the loop stopped around 21pt (which would visually fit, if I screenshot the results and measure it in Paint.Net), but it's going far further than it should be doing because, frankly, it's returning the wrong damn results.
View 2 Replies
Nov 30, 2010
i am using file upload control if i check tha applicaion in IE i get it correctly i slect a file using fileuplaod control and use fileuplad.postedfile.filename so i get teh physical path of the file whereas from firefox i just get the filename not the path hence i am not able to get teh file as its showing me msg unable to load file
i need to get the physical path of the file
i cant use server.mappath as the file can be from any drive
how can i get the filename with path
View 1 Replies
Jan 7, 2010
I have two folders called CSVLoad and Forms... I have an aspx page inside forms folder which has a fileupload control. I save my uploaded file to my CSVLoad folder i gave the following path
FileUpload1.SaveAs(Server.MapPath("CSVLoad//" + FileUpload1.FileName));
I am receiving file not found exception.
Could not find a part of the path
'F:WebSitesPayrollFormsCSVLoadEmployeesdata.csv'
CSVLoad folder is outside Forms folder (ie) both are root level folders of my application
Answer :
FileUpload1.SaveAs(Server.MapPath("~/CSVLoad//" + FileUpload1.FileName));[URL]
View 1 Replies
Mar 17, 2011
In my c# class I wrote I have a photo property that returns the photo source if the image exists (nothing or default image otherwise). In my code I use:
public string Photo
{
get
{
string source = "~/images/recipes/" + id + ".jpg";
if (File.Exists(source))
return "~/images/recipes/" + id + ".jpg";.......
If I get the FileInfo() information for this image I see that I tries to find this image in the following directory: C:Program Files (x86)Common FilesMicrosoft SharedDevServer10.0~images ecipes Of course the image is not located in that directory and File.Exists is returning me the wrong value.how can I fix this?
View 3 Replies
Aug 1, 2010
I have a weird thing happening. I have two identical databases installed on one virtual machine but under two different instances of SQLServer. For some reason, periodically when saving from one it will save to the other instead. Using debug, I have verified that the connection string is correct and when the item saves, it still saves to the wrong database.I use session variable, and am of the belief that it might have something to do with it...and t hat when I go from one to the other it is still getting the connection string form the other for some reason.To make sure that it isn't a problem, I make sure that I completely close out one database before opening the other in a new IE window.I assume that when I completely close out an internet explorer window that it abandons all session states. Is that true?
View 7 Replies
Aug 1, 2010
I have a very weird thing happening. I have two databases that have exactly the same tables but different database names on the same virtual machine, but in different instances of SQL Server. For some reason, when using one of them, it will save to the other. In debug, looking at my connection string..I have verified that it is correct, yet when I allow the save, I look in the table and it isn't there, it is in the other database that is in a table with a completely different name and in a different instance of SQL Server.
View 1 Replies
Oct 7, 2010
I have a code to open PDF file, like this
[Code]....
Over here I have created a folder with name Data inside my solution, so the Server.Mappath("Data") as well the statemet for converting assigning the src property of the IFrame I1 is working properly. But I want to use the files from a folder which resides in a network folder like
View 1 Replies
Jul 3, 2010
I am trying to upload a file Into a MapPath but I am getting a error 'C:/WebSite/userimages/' is a physical path, but a virtual path was expected. My code is:
[Code]....
View 6 Replies
Jan 30, 2010
the syntax to convert a virtual path to a physical path.
I wanted to upload a file located in one server and i know only the website name.
View 3 Replies
Jan 13, 2010
i want to add imageUrl name how i can add this before that my code was ImageUrl="~/images/update.gif" now i have change it to ImageUrl="<%=SitePath.Path.StaticPath()%>update.gif" <asp:ImageButton runat="Server" ID="BtnUpdate" ImageUrl="<%=SitePath.Path.StaticPath()%>update.gif" style="width:77px;height: 27px; border: 0px" OnClick="Update_Click" /> but at a desing time it shows something like that %3C%=SitePath.Path.StaticPath()%%3Eupdate.gif
wht i can do ,how i can achieve this ( i have try with style tag also , but its not showing proper coz it take html code as )
<input type="image" name="DL$ctl00$BtnRemove"
id="DL_ctl00_BtnRemove" src=""
style="border-width:0px;width: 80px;height: 25px; vertical-align: middle; border: 0px;background-image:url('http://localhost:2011/static1.Site/remove.gif')"
/>
if i use this then border get come but i have also added border=0 on style plus image name is also get added on that image
View 6 Replies
Apr 1, 2010
In my website1, I posted some data to my website2 by doing an HttpWebRequest.The data are posted successfully but what I wanna do is change the imageUrl in website2 after website1 fired some data. When I try to debug, I can see that it passes through the code of changing the ImageUrl, but when I view the source of website2, I can't see the imageUrl being change at all... Does anyone have a clue?
View 3 Replies
Aug 14, 2010
My code works fine when running it on my pc, but when I uploading it to the server, I always get the same error, I can't delete file I have just assigned into imageurl. However I able to delete it before using Image1.ImageUrl = sOldFileName; Somehow the server doesn't release sOldFileName after assignment it into imageurl. Here is the code, it's a pop up that gets the a variable from another page as a QueryString. The image blocks on the page load, before clicking the btnCrop_Click button.
[Code]....
[Code]....
View 11 Replies
Oct 1, 2010
Is there a way to set "LeafNodeStyle-ImageURL" = an image corresponding to file type. For example if it is an excel file then the LeafNode should be showing the Excel icon; in case of a Word document, the Word icon and so on.
View 1 Replies
Jan 29, 2010
I am currently working on an application that sets imageurl to an actual .aspx page. The code I use is:
imgCustService.ImageUrl = Me.ResolveUrl("~/PolicyHolder/CustServiceLogo.aspx?FI=)
However, when I set a breakpoint in the PageLoad function of CustServiceLogo.aspx I find that it never gets called and thus the image it serves is never displayed.
View 2 Replies
Nov 24, 2010
I am trying to load an image in my webpage from a file server where all of our images will be held.I set the imageurl property on the image control to dynamically;;
image1.ImageUrl =photo+"//"+image1.jpg;(Here photo is a string that value is: "//server/DBV/Documents/Employee/phot")
and I can see the image perfectly fine in IE.
However, the image does not show in Firefox. In Firefox it is just a blank screen when i am using developer tools that image button is in there but it showing faded in developer tool(firebug).in screen nothing showing only blank.
View 11 Replies
May 28, 2010
I have a FileUpload control that allows a user to upload an image. After the image is uploaded, I'd like to update an Image control I have on the page.
The uploading part is working, as I can see the files in the folder after. However, the image never updates.
I'm relative new to .NET but I think maybe it has something to do with postback?
Here is the code I have:
[Code]....
View 4 Replies
Nov 24, 2010
How can I write this correctly inside my repeater?
[Code]....
View 1 Replies
Sep 8, 2010
I'm trying to display the picture that i have saved using the fileUploadControl functions. so far my code can save the picture to the folder that I want but the picture does not appear on my webpage. I used the code at visual studio 2005 and it works totally find but when I put it at visual studio 2008 it doesn't work fully. can somebody teach me how to solve this problem?? is there a new updates at visual studio 2008 that i missed??
below are my codes.
[Code]....
View 3 Replies
Nov 26, 2010
After changing image data how can I force to reload image from httphandler ? I tried something like this:
//Change Codes for image data...from sql...code blocks hidden here...
//Than attemption to reload new image into imagebutton.
//Both ImageButton and Label inside an updatepanel
ImageUrl="";
ImageUrl="~/Handlers/ProjectPreview.ashx?ID="+Num;
Label1.Text="NEW TEXT COMES HERE";
New Image Data for ImageButton rendering in IE but in firefox not.
Label renders very well but ImageButton still shows old picture. so is there a way to focre reload imageButton's new image data ? or Im missing a ToolkitScriptManager setting or a method can do this ?
View 3 Replies
Aug 7, 2010
I am using asp:image to bind image in datalist itemTemplate. but it does not bind i mean the image does not displayed. my source is:
<asp:Image ID="imgPhoto" runat="server" ImageUrl='<%#Eval("Images") %>' Width ="90px" Height ="100px"/>
View 2 Replies
Sep 22, 2010
I have a image control (image1) on a .aspx page and I'm trying to pass in a file system path (not a url) on my Page Load event:
Dim strPictureExists
As
String =
View 1 Replies