This question is locked. New answers and comments are not allowed.
Hi All,
I am very new to both web development and MVC and was wondering if you could help me with a problem.
I am trying to load an image on the master page from a SQL table based on a passed in key from the Site.Master. I know I am probably doing something stupid but would appreciate your guidance.
How do I call the GetImage method from the view?
ApplicationImageStore.generated.vb ( Open Access generated class )
ApplicationImageStore.vb ( My model extension to the ORM class to expose the method via LINQ)
I am very new to both web development and MVC and was wondering if you could help me with a problem.
I am trying to load an image on the master page from a SQL table based on a passed in key from the Site.Master. I know I am probably doing something stupid but would appreciate your guidance.
How do I call the GetImage method from the view?
ApplicationImageStore.generated.vb ( Open Access generated class )
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Imports System
Imports System.Data
Imports System.Linq
Imports System.Linq.Expressions
Imports System.Data.Common
Imports System.Collections.Generic
Imports Telerik.OpenAccess
Partial Public Class ApplicationImageStore
Private _key As String
Public Overridable Property Key As String
Get
Return Me._key
End Get
Set(ByVal value As String)
Me._key = value
End Set
End Property
Private _image As Byte()
Public Overridable Property Image As Byte()
Get
Return Me._image
End Get
Set(ByVal value As Byte())
Me._image = value
End Set
End Property
End Class
ApplicationImageStore.vb ( My model extension to the ORM class to expose the method via LINQ)
Imports Telerik.OpenAccess
Partial Public Class ApplicationImageStore
Private _db As New IntranetEntityDiagrams
Public Function GetImage(ByVal keyString As String) As Image
Dim img As Image
Dim i = From pic In _db.ApplicationImageStores
Where Key = keyString
Select pic.Image
Return i
End Function
End
Class
Site.Master<td class="mainbody" align="center">
<img ID="globalmainbanner";alt="Header Image"; width="100%"; src="<%=ApplicationImageStore.GetImage("GlobalMainBanner")%>"/>
</td>