Set A Picture As The Background In .NET?
Jul 1, 2010
I am unable to get the background picture to show in my pages. I am trying to do this in the master page using CSS.I have a CSS which contains the following:
body {
background-image: url(../images/background.jpg) no-repeat;
background-attachment: fixed;
margin-top: 0px;
}
I know the CSS is being read because all other styles defined in it are working on the .aspx pages... except of course the background image, the background remains white. (This works perfectly fine in .php pages by the way.)I have been searching online like crazy and all the answers I find, say the above CSS code is the answer... but it is not working!I am using the following:
Microsoft Visual Studio 2008 Version 9.0.30729.1 SP
Microsoft .NET Framework Version 3.5 SP 1
Firefox Version 3.6.6
View 2 Replies
Similar Messages:
Feb 8, 2011
i'm new to c# and i wanted to know how can i allow user to upload a picture from a text box and a button??
after uploading the picture, how can i save the picture in the database??
**note**the picture i allow user to upload need to be in a fixed size.
View 4 Replies
Dec 23, 2010
I have this code to insert a picture from database into an ImageControl on my ASP.NET form:
strConnString = "server=" + Server + ";database=" + DataBase + ";UID=" + UID + ";password=" + PASS + ";";SqlConnection MyConnection = new SqlConnection(strConnString);SqlCommand MyCommand = new SqlCommand("SELECT Pic FROM MEN WHERE ID=5", MyConnection);MyConnection.Open();SqlDataReader MyReader = MyCommand.ExecuteReader();if (MyReader.Read()){ byte[] m_MyImage = (byte[])MyReader["Pic"]; Response.BinaryWrite(m_MyImage);}
And I have this ImageControl on the form:
<asp:Image Width="88" Height="100" Runat="server" ID="m_Image" NAME="m_Image" />
but when I run the code, I see the picture big on the screen and not in my ImageControl.
i also put this in the form_load:
m_Image.ImageUrl = "MyPhoneBook.aspx?m_Image";my control is: m_Imagemy control ID is: m_Imagemy namespace is MyPhoneBook
but still dont work
View 5 Replies
Mar 1, 2011
I ve an application dat am working on. The section of the upload picture works perfectly on the development environment and also on a test server but the issue comes up when it was hosted life. I started geting an error dat says picture could not be attached. I ve a folder cald Passport and dis ve been working for me on befor now but i dont now the reason y its not working now.
protected void btnUpload_Click1(object sender, EventArgs e)
{
Boolean fileOK = false;
String fileExtension = string.Empty;
String path = Server.MapPath("~/Passport/");
if (fuPassport.HasFile)
{
fileExtension = System.IO.Path.GetExtension(fuPassport.FileName).ToLower();
String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
if (allowedExtensions.Contains(fileExtension))
{
fileOK = true;
}
}
else
{
Utilities.PortalMessage = "Please attach an image file.";
return;
}
if (fileOK)
{
try
{..............................
View 3 Replies
Aug 4, 2010
In order to avoid having to pass Data that goes in the master page of my site before every view in every controller I have created an ApplicationController that sets the data on its constructor... the problem with this approach is that one of the viewdatas I must pass is the url of the profile Image of the current logged in user.
[Authorize(Roles = "Administrator")]
public abstract class AdministratorController : Controller
{
private IPortalAdministratorServices _servicioPortalAdministrator;
public AdministratorController()
{
_servicioPortalAdministrator = new PortalAdministratorServices();
ViewData["associates"] = _servicioPortalAdministrator.getAssociates();
ViewData["picture"] = _servicioPortalAdministrator.GetPic();
public AdministratorController(IPortalAdministratorServices service)
{
_servicioPortalAdministrator = service;
}
}
and so my companies Controllers wich inherits from AdministratorController now doesnt have to set all that Data upon every View Call.
[Authorize(Roles = "Administrator")]
public class CompaniesController : AdministratorController
{
private ICompaniasServices _service;
public CompaniesController()
{
_service = new CompaniasServices(new ModelStateWrapper(this.ModelState));
}
public CompaniesController(ICompaniasServices service)
{
_service = service;
}
The problem is this: When I try to manually access the Companies Controller without actually being logged in the method GetPic() wont actually be able to get the picture url cause no one is logged in.. and these method is getting called in spite of the Authorize attribute....so now, even after being logged in the ViewData for the picture url has been permanently set to "unknown.png" Some of this code isnt mine.. I just discovered the bug but cant figure out how to fix it.
View 2 Replies
Dec 4, 2010
i add Image control to my WebForm.i insert picture to App_Data.i connect the picture to my Image control in the ImageUrlit seen like this:
<asp:Image ID="Image1" runat="server" Height="94px"
ImageUrl="~/App_Data/Tulips.jpg" Width="209px" />
in the design i see this picture, but when i run the project i dont see the picture.
View 3 Replies
Apr 11, 2010
i'm trying to build a picture of the day in c#
string m1 ;
Image1.ImageUrl = "~/PictureOfTheWeekImages/+"m1"+.jpg";
and i want to insert the name of the file as a variable that changes with the date ...
my way not working .... i'm sure it somthing like this,
and i'm not sure how to write the url right ..
View 2 Replies
Jul 17, 2010
In one page I have image controls that are showing pics from the web site. This works fine but sometimes, and randomly some pics are not shown. I guess this issue could happen because Im using the IIS 5.1 in my development enviroment and it could be denying some requests. Anyway, I dont know exactly what is happening, so i request help of those who have workaround this fixture.
View 1 Replies
May 28, 2010
I am inserting a picture into a database, using the following code.
strFileType = Path.GetExtension(filImage.PostedFile.FileName).ToLower();
switch (strFileType)
{
case ".gif":
strMimeType = "image/gif";
break;
case ".jpg":
case ".jpeg":
case ".jpe":
strMimeType = "image/jpeg";
break;
case ".png":
strMimeType = "image/png";
break;
}
//Store the content length
int iDocLength = filImage.PostedFile.ContentLength;
byte[] bDocBuffer = new byte[iDocLength];
//Get stream object
Stream streamImage;
streamImage = filImage.PostedFile.InputStream;
streamImage.Read(bDocBuffer, 0, iDocLength);
cmPerson.CommandText = "INSERT INTO photos VALUES(@referenceid, @image, @imgtype)";
cmPatient.Parameters.AddWithValue("@referenceid", iPersonID.ToString("000000"));
cmPerson.Parameters.AddWithValue("@image", bDocBuffer);
cmPerson.Parameters.AddWithValue("@imgtype", strMimeType);
cmPerson.ExecuteNonQuery();
If in case that the user, did not browser for a picture, then, I have to use the nopho.jpg that is stored in the images/folder of my web app. How am I be able to do this?
View 1 Replies
Feb 27, 2010
Why StyleSheet.css is not displaying the picture depends on the situation. It displays “Taken!“ or "Available!" but no picture. I am using Ajax with asp.net
[code].....
View 8 Replies
Jan 15, 2011
I am using asyncfileupload ajax control and can successfully upload and save picture on server.I need to do the following and not sure how:When user is in process of uploading, I only want them to see *.jpg *.gif and *.bmp files
Once the user uploads their picture, how do I reduce the quality of the picture so it is less than 10 KB?
View 1 Replies
Sep 6, 2010
i hope u will be fine and best. plz tell me how can i set the image in my generated email ? i want to set the logo of my company in the right corner of my email
View 2 Replies
Nov 18, 2010
using vb.net 2005
I am looping through a directory and grabbing a jpg filename if it matches certain conditions (shown in my code snippet below).
However there might be more than one jpg in the file with the same name string "BarneyIsCool" and in this case I need to get the newest file that contains "BarneyIsCool" .
my question: How do i determine which file is the newest (last one added to the folder) using my vb.net code? the relevant code snippet follows:
[Code]....
View 5 Replies
Dec 21, 2010
i have sql-server-2008 database that contain image field that hold picture.
i have pictureBox control in my webform.
how to put picture from database to pictureBox control ?
(I work with C# asp.net FW3.5)
can i get any sample code or program ?
View 1 Replies
Jun 4, 2010
I have no clue if it is possiable but lets see. is there a way for a .NET app (windows app) to look at a picture for imperfections (for example a watermark or a set object or shape i can tell it) and if it finds it thorw a error?
View 3 Replies
Nov 18, 2010
I want to know, how can i open a picture from a web page to picture viewer like microsoft picture manager, when i click a button it should open a image in picture manager, picture is in one of my folders.
View 2 Replies
Aug 16, 2010
I have wrothe this following code for placing a picture in Table Row but it is not working.
View 3 Replies
Feb 5, 2010
I am developing project using asp.net 2.0 and C#.net.I want to capture users picture or video from webcam and save it in a folder in Harddisk. how to develop this feature and if possible provide me reference links.
View 4 Replies
Dec 31, 2010
How to set in ASP.NET for ImageButton to change picture on mouse hover?
View 3 Replies
Feb 22, 2011
how to change a specific Picture on ohver at menuItem in menu control the code is like this
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu"
EnableViewState="False" IncludeStyleBlock="False">
<Items>
<asp:MenuItem NavigateUrl="~/Homepage.aspx" ImageUrl="~/images/ONE.png" ></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/AboutUs.aspx" ImageUrl="~/images/SOME.png"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/ContactUs.aspx" ImageUrl="~/images/MENU.png"></asp:MenuItem>
</Items>
</asp:Menu>
View 1 Replies
Jan 31, 2011
I have a webform with 2 Textbox (ID & Name), 2 grouped radio button (Male-female), and a Picturebox (Photo).
I need to display/Load Details into the given controls from the ID number. I am using VS2008 SP1, C# and MS SQL.
View 2 Replies
Mar 14, 2011
using asp.net/vb.net 2005. when I am in VS and I run the application I have a .net Image control where I am displaying an image programmatically and when I run this in VS all works well, the image displays.
I have the site setup in IIS now on the dev server however the problem is when I run this program from there, just navigating to the [URL] then I can run the program and not getting any exception, however I am not seeing the image when I click the button to view the image. The code is something like this: [Code]....
again this shows ok when I am in the application in vs.net in debug mode but not showing at all when I just open a broswer window and view it as a user would, has anyone seen this before?
View 4 Replies
May 21, 2010
I build a website with management system. In the management pages, I can upload pictures to a specific folder in my website. While doing it in my localhost in works perfect. While doing it on the hosted site, I get: A generic error occurred in GDI+. I read a little bit about it, and relized that it is probably an authorization problem. I asked the hosting to let a iusr_xxx permition to that folder. I've just informed now that it was done. The problem still occures. Here is the problematic code. It falls on the save command:
using
{
bitmap.Save(MapPath("../images/lawyers/" + fileName), image.RawFormat);
}
I tried already to put GC.collect(); after this line and alse I tries bitmap.Disppose() after this line.
View 2 Replies
Feb 18, 2011
I want to rename the image when uploaded to server. How to get it Give me code if possible.
View 3 Replies
Mar 7, 2011
I let my users upload picture files from a VB6 project. I can filter out all but the common file types (.jpg, .gif etc.) when sending to the FTP.
Is there a way to open the files with Asp.Net, without knowing the specific file type. Like FileName.* or something?
View 3 Replies