Loading Images From Database In Mvcmusicstore Sample?
Feb 12, 2011
mvc musicstore sample application loads cart images using code below. In my application product images are store in database. How to modify this code so that images are loaded from database ?
I created subdirectory Store in IIS 7 root page and converted it to application and added .NET 3.5 mvc musicstore sample to it. App pool is classic and isapi dll handler is added for request path *
Typing localhost/Store returns error below. How to run mvcmusicstore sample from subdirectory or from root directory using same code base?
Server Error in '/Store' Application.
Parser Error
Description:
An error occurred during the parsing of a resource required to service this request. review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'System.Web.Mvc.ViewPage<IEnumerable<Business.Toode>>'.
Source Error:
[Code]....
Source File: /Store/Views/Home/Index.aspx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.4206; ASP.NET Version:2.0.50727.4209
i am looking for some sample code in order to upload and/or retrieve images stored in a database.even the web is full of samples, i was not able to find one without using blobs as i would like to save only the directory of an image when it comes to the place of storing. the reason behind is that i do want to have my database small for some reason and therefore only want to save links to my images inside.
Recent we are deploy(Setup and Deploy) our Product which is develop in ASp.Net(C#) using SqlServer Here We Face one Problem i.e.
When we install the porduct there is no issue if we manually run the sqlScript file in sql server(manully we create the DataBase and All DataBase Object i.e. Table,StoreProcedure,Function,Views....& We are enter the Sample Data) But We know that is not the Right Approch.
Any one Can tell me the procedure "How to Building DataBase & All DataBase Object with Sample Data when we click the Install and set up file"
In Setup and Deploy wized it ask for any Dependence file for the application i have attach the Dependence file(.sql) but i am not getting any OutPut .
Is there any Command prompt Utility(SqlServer/VS Commandprompt) ?
I have a page where I want to load a lot of images to. Say I have a page of like 50 images 2mb large each and I want them to be displayed on one page. Whats the best way to do that?
Basically what I'm doing right now is loading them from the server and displaying them in image tags. Problem is this crashes the browser. In chrome it will crash, in IE it will bog the computer down and lock it up. I think the browser is running out of memory or something.I'm wondering if I should be using a background worker or a different thread or something.. Is this possible with a web app?
I am very new to asp.net mvc 2. i actually do not start the class until next week but went ahead and read half of the Pro ASP.NET MVC 2 Framework book and built the mvc music store app the problem i keep having is when i try to create a new account i keep getting this message:
The password retrieval answer provided is invalid. check the value and try again. Did i do something wrong?? I have went over every piece of code in vs and made sure it matched exactly what was in the tutorial and also the supplied code.
I'm using Crystal Reports in a Webform inside of an MVC application. Images in the reports are not being displayed, however, on both the ASP.NET Development Server and IIS 7 (on Win7x64).
I know from a number of other questions similar to this that the CrystalImageHandler HTTP Handler is responsible for rendering the image, but I've tried all of the usual solutions to no avail.
So far, I have
Added the following to my appSettings (via http://www.mail-archive.com/bdotnet@groups.msn.com/msg26882.html) <add key="CrystalImageCleaner-AutoStart" value="true" /> <add key="CrystalImageCleaner-Sleep" value="60000" /> <add key="CrystalImageCleaner-Age" value="120000" /> Added the following httpHandler to system.web/httpHandlers (via http://stackoverflow.com/questions/2253682/crystal-report-viewer-control-isnt-loading-the-images-inside-the-report) <add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/> Added the following to my Global.asax.cs (via http://stackoverflow.com/questions/2006011/crystal-reports-images-and-asp-net-mvc) routes.IgnoreRoute("{resource}.aspx/{*pathInfo}"); and routes.IgnoreRoute("CrystalImageHandler.aspx");
i am working through the MvcMusicStore Tutorial Version 2.0 from 1/12/2010. I do have an issue with the EDIT Screen. When trying to save an album i get the error "The field Price must be a number". The value of the Price was not changed, it contains e.g. 8,99. I don´t know where this error comes from and what i need to do to avoid this error.
I had to move an asp.net website from Windows 2003 to another server with Windows 2008. Now when I run the website after setting everything up the images will not load. It is a logo that is in a folder named Images. The file is there along with the folder just like on the other site. Any reason this would not work now? Everything else is working except images. Is there something else I missed in the setup?
I have a set of images which are subjected to display inside a usercontrol(horizontally) but while loading the page the images are displaying vertically. Only after the page completely loaded they are displaying properly. How can I use jQuery to hide the images when the page is loading and display them when the page is fully loaded. Below is the usercontrol code I am using for displaying controls:
I'm creating a simple CMS for a fairly simple web page. I'm currently working on a part for displaying news on the main page.
The controls I have on the page:
- a GridView control with enabled pagging and a SELECT button, - an Image control for displaying news cover picture, - CKeditor control for editing news text, - Repeater control for displaying pictures from database
How does it all work?
In Page_load I have the following:
vb.net Code: connectionString = "Data Source=KORISNIK-PCSQLEXPRESS;Initial Catalog=****; User ID=**;Password=****"    conn = New SqlConnection(connectionString)    If conn.State = ConnectionState.Closed Or conn.State = ConnectionState.Broken Then        Try        conn.Open()        If Not IsPostBack Then          bindGrid()         Â
[Code] ...
As you can see, I load the GridView control with news from DB. At this moment all other control are disabled. User has to SELECT the row he wants to edit, and click the MODIFY button.
This is what happens when user clicks the MODIFY button:
vb.net Code: Private Function selectForEdit()    dsSelectForEdit = New DataSet    captionPicture.ImageUrl = ""     enableCommands()    Dim sqlQuery As String     sqlQuery = "SELECT news.newsCaption, news.newsIntro, news.newsCoverPicture, news.newsStatus,
[Code] ....
Basically, I select newsDetails based on newsID. Also, this is where I take the coverPicture from the database using a generic handler.
This is the code for showImage.ashx:
vb.net Code: Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest     Dim newsID As Int32    If Not context.Request.QueryString("newsID") Is Nothing Then      newsID = Convert.ToInt32(context.Request.QueryString("newsID"))    Else      Throw New ArgumentException("No parameter specified")    End If    Â
[Code] ....
This part works fine, as the picture is correctly displayed in the Image control. Now, I also want to load the pictures that are related to the selected news. So, I use this function:
vb.net Code: Private Function selectNewsPictures()    dsSelectPicturesForEdit = New DataSet     enableCommands()    Dim sqlQuery As String     sqlQuery = "SELECT newsDetailsPictureID,newsDetailsPicture,newsDetailsPictureCaption,newsDetailsPictureDescription FROM newsDetailsPictures WHERE newsID = @newsIDEditing"      myCommand = New SqlCommand(sqlQuery, conn)     myCommand.Parameters.Add("@newsIDEditing", SqlDbType.Int, 250)   Â
[Code] ....
You can see that I take pictureID's and store them into a List (of integer). That way I can use those integers in showNewsPictures.ashx to display all the pictures.
showNewsPictures.ashx:
vb.net Code: Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest     Dim newsID As Int32    If Not context.Request.QueryString("pictureID") Is Nothing Then      newsID = Convert.ToInt32(context.Request.QueryString("pictureID"))    Else      Throw New ArgumentException("No parameter specified")    End If    Â
[Code] ....
The picture ID's are being sent through pictureRepeater_ItemDataBound:
vb.net Code: Private Sub pictureRepeater_ItemDataBound(sender As Object, e As RepeaterItemEventArgs) Handles pictureRepeater.ItemDataBound     If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then       Dim ctrl As New Image      ctrl = e.Item.FindControl("pictureHolder")      ctrl.Width = 100      ctrl.Height = 100        ctrl.ImageUrl = "~/showNewsPictures.ashx?pictureID=" & listOfIDs.Item(itemIndex)      itemIndex = itemIndex + 1     End If  End Sub
THE PROBLEM:
I load the page, select the news, click the MODIFY button and all works well. The news details are loaded, the cover picture is loaded, the repeater pictures are loaded.
I click the cancel button (clears all the commands and disables them) and I get an error saying the DataReader needs to be closed.And I never use one This happens either in showNewsPictures.ashx or showImage.ashx.
In some other scenario, this happens right after I click the MODIFY button.
I have a website using Telerik controls for ASP.NET. When an AJAX request starts, the Loading Panel (defined in the master page) will display, with a loading image, text, and faded white background color. It works totally fine in Firefox and Chrome, but the background image and text don't display in IE8. All that displays is the white background.LoadingPanel code: Loading ideas why IE8 isn't displaying the images? I've inspected the page source, and they're there in the CSS.
I am working on URL Rewriting using RegisterRoutes.
its working fine but all css ,js and image not working when i redirect page using URL Rewrite.
my code is in global ascx is below
 public static void RegisterRoutes(RouteCollection routeCollection) { routeCollection.MapPageRoute("RouteForcategory", "Product/{Cat_Id}/{Cat_Name}", "~/ProductDetailss.aspx"); }
My image path isÂ
<img src="images/logo.png" alt="logo">
 But when i run then url and image path looking like belowÂ
http://localhost:49936/Product/3/Fruits
And my image path lookedÂ
http://localhost:49936/Product/3/images/logo.png
but above is not correct path .
When I redirect page from home page to Productdetailss.aspx then images css, directory root path  are changed and its also rewrite. I dont want to rewrite css,js,and image path .
I am also used resloved url code but not working .
I have asp.net web site which has master page ajax and css file....
I have change masterpage and change master page reference in each page to new masterpage name. then i open aspx page and open in design view no problem i can see new lay out colours and images, when i right click on file name and click on view on browser page open in IE but not images no styles. try on Firefox same problem.
I have a website that uses a master page that contains the navigation for the site.The navigation buttons are images.Some of the navigation button images have hover menus tied to them.Those hover menus contain several image buttons, so as to create a drop down menu affect.The problem I have is when any of the pages are loading all of my hover menu image buttons flash on the left side of the screen for a second or less as the page is being rendered.Can this be stopped?
i have implemented an image preloader using javascript inside my mvc 2 web app, in order to display an animated "loading" image .gif while sequentially displaying page images.I have also implemented caching using a cache profile for the controller action that displays the specific page ([OutputCache(CacheProfile = "LongCache")]).The problem is that the image preloader javascript is called when caching is applied. I was wondering whether i could, somehow, use the image preloader code only when the page gets refreshed and not when the cached version is rendered.
I have form where I am displaying States and related cities. it is displaying properly. I also used MaintainScrollPositionOnPostBack="true" too. But the problem is when I select some state then my scroller goes top of the position first and loading some images. [it shows me on status bar] and after this it it maintained the position. During image loading it takes 4 - 5 seconds and it's too much for me.