Hello Everyone,
I am a newbie as far as DNN module development is concerned, although I have been doing ASP.net programming for over 5 years. We are currently in the process of moving all our existing sites to DNN. There is one application that I am having some trouble converting due to my lack of knowledge about DNN modules.
Heres how the application works.
The user logs in and we present to him the about 9-10 different categories of images to choose from, he picks one and this category has about 5-15 subcategories. When he clicks on any one sub-category, we show him a preview thumbnail and a download link.
We store all the images and categories/subcategories in DB. Our current ASP.Net 2.0 application uses an aspx page to display the image using the Response object. (Code for the GetImage.aspx.vb is at the bottom of this posting)
I have made the module with a view control to display the first set of categories. On this view page, i need to create hyperlinks to this GetImage.aspx to display the images. I have made the GetImage a control in my custom module and declared it in the Module definition page. I am not sure what to do next. How do I link from this ViewModule to the GetImage page in my image links so that GetImage will display the images on the view control?
Please point me in the right direction, also let me know if you need to see more code.
Thanks
Sid
---------------------------------------------------------------- GetImage.aspx.vb -----------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadTry
If Not Page.IsPostBack Then
Initialize()
End If
ProcessModuleLoadException(
Catch exc As ExceptionMe, exc)End Try
End Sub
Private Sub Initialize()If Not Request.QueryString("i") Is Nothing Then
Dim picID As Integer = System.Convert.ToInt32(Request.QueryString("i"))Dim bHiRes As Integer = 0If (Request.QueryString("h") = "1") Then
bHiRes = 1
End If
Dim DEDataAccessObj As New DEDataAccess(Utility.DbConnectionStringExtranet)If (picID > 0) Then
Dim dtKinds As DataTable = Nothing
Select Case Request.QueryString("t").ToUpper()Case "M"
dtKinds = DEDataAccessObj.GetPictureByProductModelID(picID, bHiRes)
Case "K"
dtKinds = DEDataAccessObj.GetPictureByProductKindID(picID, bHiRes)
Case "P"
dtKinds = DEDataAccessObj.GetPictureByID(picID, bHiRes)
End Select
If dtKinds Is Nothing Then
Return
End If
If dtKinds.Rows.Count > 0 Then
Dim kindDataRow As DataRow = dtKinds.Rows(0)Dim image As Byte() = Nothing
If (kindDataRow("Picture").GetType().Name <> "DBNull") Then
image = kindDataRow(
"Picture")End If
If (Not image Is Nothing) Then
'Adjust content headers so that High Res images
' are sent for download (not displayed in browser)
If (bHiRes) Then
Response.AddHeader(
Response.AddHeader(
"Content-Disposition", "attachment; filename=" & kindDataRow("OriginalFileName"))"Content-Length", image.Length)End If
Response.ContentType =
"image/jpeg"
Response.BinaryWrite(image)
Else
Response.ContentType =
"image/jpeg"
'Response.BinaryWrite()
End If
End If
End If
End If
End Sub
-----------------------------------------------------------------------------------------------------------------------------