I am trying to display a series of images from a SQL database, in a sigle row in the following page where (PLACE IMAGES HERE!!) is on the page transaction_new_photo.aspx
. I have included the code behind to this page also which will show the fields for which I am saving the image data into. What I would like to happen is that when the page loads it passes 'transactionID' = 1023 in the querystring. I would like all of the images corresponding to tranactionID in table HA_Transaction_Images and resize_internalID = "thumb" in table HA_Tranasaction_Pictures in the database to display in a single row on my web page. (Also note that HA_Transactions_Images.rec
ordID = HA_Trasanction_Pictures.im
ageID)
SQL Table 'HA_Transaction_Images'
recordID transactionID description
31 1023 Waterfall
32 1023 stuff
33 1023
SQL Table 'HA_Transaction_Pictures'
RecordID c_i_c imageID resize_internalID image
11 NULL 31 __Selected Binary Data
12 NULL 31 __Icon Binary Data
13 NULL 31 thumb Binary Data
14 NULL 32 __Selected Binary Data
15 NULL 32 __Icon Binary Data
16 NULL 32 thumb Binary Data
17 NULL 33 __Selected Binary Data
18 NULL 33 __Icon Binary Data
19 NULL 33 thumb Binary Data
tansaction_new_photo.aspx
<%@ Page Language="vb" AutoEventWireup="false" Inherits="HomesAndAgents.t
ransaction
_new_photo
Detail" CodeFile="transaction_new_
photo.aspx
.vb" Debug="True" %>
<%@ Register TagPrefix="rawcil" Namespace="Radactive.WebCo
ntrols.ILo
ad" Assembly="Radactive.WebCon
trols.ILoa
d" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat=server>
</script>
<html xmlns="
http://www.w3.org/1999/xhtml"
>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="../styles.css">
<head runat="server">
<title>Untitled Page</title>
</head>
<body leftmargin="0" topmargin="0">
<!-- #include file="index_header.asp" -->
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="400" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td><table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td bgcolor="#597A9C"> <s
trong><fon
t color="#FFFFFF">New Transaction</font></strong
></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td width="15"> </td>
<td><form id="form1" runat="server">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"> <a href="javascript:history.g
o(-1)">Ste
p
1</a> > Step 2 > Step 3 > Step 4 > <strong>Step 5 (Upload Listing Images)</strong></td>
</tr>
<tr>
<td width="10%" height="250" valign="top"> </td>
<td width="30%" height="250" valign="middle"><table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" nowrap="nowrap">Use the following for to upload images of your listing: </td>
</tr>
<tr>
<td colspan="2" nowrap="nowrap"> </td
>
</tr>
<tr>
<td colspan="2" nowrap="nowrap" bgcolor="#000000"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="75" bgcolor="#FFFFFF"><RAWCIL:
ILoad ID="picture1" runat="server">
<Configuration ManualTemporaryFolder="Fal
se" InternalCode="" GenerateKey="False" GenerateIconImage="True" Title="" KeepSourceImage="False" CutMode="Manual" WebPublishedDestinationFol
der="True"
GenerateIndexFile="True" OnCompleteBehavior="KeepFi
lesInTempo
raryFolder
">
<DestinationFolder UrlMode="Automatic" ManualUrl="" Path=""> </DestinationFolder>
<TemporaryFolder UrlMode="Automatic" ManualUrl="" Path=""> </TemporaryFolder>
<InputOptions>
<UploadableFileSizeLimits>
<HiLimit Enabled="False" Value="2097152"> </HiLimit>
<LowLimit Enabled="False" Value="1"> </LowLimit>
</UploadableFileSizeLimits
>
<FileExtensionValidator DefaultBehavior="AcceptAll
" NotAcceptedFileExtensions=
"" AcceptedFileExtensions="">
</FileExtensionValidator>
</InputOptions>
<WebImageDefinitions>
<Radactive.WebControls.ILo
ad.Configu
ration.Web
ImageDefin
ition InternalCode="Default" Title="Default">
<SizeConstraint Mode="FixedSize">
<FixedAspectRatioSizeData Size="400, 300" LimitedDimension="Width">
<Limits>
<HiLimit Enabled="False" Value="400"> </HiLimit>
<LowLimit Enabled="False" Value="300"> </LowLimit>
</Limits>
</FixedAspectRatioSizeData
>
<FixedSizeData Size="400, 300"> </FixedSizeData>
<FreeSizeData>
<LimitsH>
<HiLimit Enabled="False" Value="400"> </HiLimit>
<LowLimit Enabled="False" Value="300"> </LowLimit>
</LimitsH>
<LimitsW>
<HiLimit Enabled="False" Value="400"> </HiLimit>
<LowLimit Enabled="False" Value="300"> </LowLimit>
</LimitsW>
</FreeSizeData>
</SizeConstraint>
<OutputOptions FormatMode="Source" Format="b96b3cae-0728-11d3
-9d7b-0000
f81ef32e" JPEGForceRecompression="Fa
lse" JPEGQuality="92"> </OutputOptions>
<ResizeDefinitions>
<Radactive.WebControls.ILo
ad.Configu
ration.Web
ImageResiz
eDefinitio
n UseSourceImage="False" AdaptiveMaxSize="64, 64" BackgroundColor="White" FixedSize="160, 120" DisableIfSmaller="True" InternalCode="thumb" Title="Thumbnail" Mode="Fixed" ZoomFactor="200" Fit="True" HTMLBackgroundColor="White
"> </Radactive.WebControls.IL
oad.Config
uration.We
bImageResi
zeDefiniti
on>
</ResizeDefinitions>
</Radactive.WebControls.IL
oad.Config
uration.We
bImageDefi
nition>
</WebImageDefinitions>
<WindowsAppearance>
<PreviewWindow WindowTitle="I-load - Preview"> </PreviewWindow>
<ImageUploadWizardWindow WelcomePageText="" TopLogoImageMode="Default"
WindowTitle="I-load" ShowSummaryPage="True" TopLogoImageManualUrl="" ShowImagePreviewBeforeFile
Upload="Tr
ue" ShowMeHowSWFUrl="
https://licenseserver.radactive.com/Shared/WebControls/ILoad/V1/ShowMeHow.swf" ShowWelcomePage="True"> </ImageUploadWizardWindow>
</WindowsAppearance>
<License Number="" Key=""> </License>
</Configuration>
</RAWCIL:ILoad></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" nowrap="nowrap"></td>
</tr>
<tr>
<td nowrap="nowrap"> </td
>
<td nowrap="nowrap"> </td
>
</tr>
<tr>
<td nowrap="nowrap">Image Description &n
bsp;</td>
<td nowrap="nowrap"><asp:TextB
ox ID="Description" runat="server" Width="300" MaxLength="200" /> <img src="../GIF/Icons/info.jpg
" alt="help" width="21" height="21" align="absmiddle" /></td>
</tr>
<tr>
<td nowrap="nowrap"> </td
>
<td nowrap="nowrap"> </td
>
</tr>
</table></td>
<td width="50%" valign="middle"> </td
>
</tr>
<tr>
<td> </td>
<td colspan="2"><input name="userID" type="hidden" id="userID" value="" />
<input name="sessionID" type="hidden" id="sessionID" value="" />
<input name="action" type="hidden" id="action" value="add" />
<input name="transactionID" type="hidden" id="transactionID" value="" />
<input name="agent_role" type="hidden" id="agent_role" /></td>
</tr>
<tr>
<td><font color="#990000"><strong> </strong></font></td>
<td colspan="2"><asp:Button ID="SaveButton" runat="server" Text="Save Image" />
<input name="Submit" type="submit" id="Submit" value="Continue to next page >>" />
<a href="javascript:history.g
o(-1)"><im
g src="../GIF/back.gif" alt="back" width="34" height="19" border="0" align="absmiddle" /></a> <a href="transaction_delete.a
sp?userID=
&sessi
onID=&
transactio
nID=" onclick="return Submit_onclick1()"><img src="../GIF/cancel.gif" alt="cancel" width="47" height="19" border="0" align="absmiddle" /></a></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td colspan="2">PLACE IMAGES HERE!!!</td>
</tr>
</table>
</form></td>
<td width="15"> </td>
</tr>
</table></td>
</tr>
</table>
<p> </p>
<p> </p>
</body>
</html>
transaction_new_photo.aspx
.vb (code behind)
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports Radactive.WebControls.ILoa
d
Namespace HomesAndAgents
Partial Class transaction_new_photoDetai
l
Inherits System.Web.UI.Page
Private _conString As String
Public Sub New()
_conString = WebConfigurationManager.Co
nnectionSt
rings("Pro
duction").
Connection
String
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' On page load give focus to the first text field
Me.RegisterStartupScript("
doFocus", "<script language=""javascript"">do
cument.for
ms[0].Desc
ription.fo
cus();</sc
ript>")
' Initialzie the page
If (Not Me.IsPostBack) Then
Dim transactionID As Integer = 0
Dim idString As String = Request.QueryString("trans
actionID")
If (idString <> "") Then
Try
transactionID = Integer.Parse(idString)
Catch
End Try
End If
' A id have been passed in query string, load the relative news.
'If (id > 0) Then
'Me.loadNews(transactionID
)
'End If
' Store id in the view state.
Me.ViewState("TransactionI
D") = transactionID
End If
'-------------------------
----------
----------
----------
----------
---------
Private Sub saveImage(ByVal transactionID As Integer, ByVal recordID As Integer)
' Prepare the database connection string
Dim con As New SqlConnection(_conString)
Dim transID as String = transactionID
Dim cmd As New SqlCommand()
cmd.Connection = con
cmd.CommandText = "Insert HA_Transaction_Images (transactionID, description, picture) Values (@transactionID, @description, @picture)"
cmd.Parameters.AddWithValu
e("@transa
ctionID", transactionID)
cmd.Parameters.AddWithValu
e("@descri
ption", Me.Description.Text)
cmd.Parameters.AddWithValu
e("@pictur
e", Me.Picture1.GetIndexXml())
Using con
con.Open()
cmd.ExecuteNonQuery()
cmd.Dispose()
cmd = New SqlCommand("Select @@IDENTITY", con)
Try
recordID = CInt(cmd.ExecuteScalar())
Finally
cmd.Dispose()
End Try
Dim recID as String = recordID
Dim resize As WebImageResize
For Each resize in Me.Picture1.Value.Resizes
cmd = New SqlCommand()
cmd.Connection = con
cmd.CommandText = "Insert HA_Transaction_Pictures (configuration_internal_co
de, imageID, resize_internalID, image) Values (@configuration_internal_c
ode, @imageID, @resize_internalID, @image)"
cmd.Parameters.AddWithValu
e("@config
uration_in
ternal_cod
e", Me.Picture1.Configuration.
InternalCo
de)
cmd.Parameters.AddWithValu
e("@imageI
D", recID)
cmd.Parameters.AddWithValu
e("@resize
_internalI
D", resize.InternalCode)
cmd.Parameters.AddWithValu
e("@image"
, resize.GetFileBytes())
cmd.ExecuteNonQuery()
cmd.Dispose()
Next
End Using
' Return to news list page
Response.Redirect("transac
tion_new_p
hoto.aspx?
transactio
nID=" + transID)
End Sub
Private Sub SaveButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveButton.Click
Dim transactionID As Integer = CInt(Me.ViewState("Transac
tionID"))
Dim recordID As Integer = 99
Me.saveImage(transactionID
, recordID)
End Sub
End Class
End Namespace