Hi folks
I have created a web form with an asp listbox and asp:button in Dreamweaver MX. The listbox captures dynamic information from a column in an Access table I have set up called ModTitle. I have no problem displaying this information. The problem is I want the form to direct to a page called "DisplayResults.aspx", which of course it doesn't since on submit, the page posts back to itself.
I know how to post to a results page using standard html forms and listboxes (adding values), however I have created an admin section to my site, so when the user adds a module, I want the module to be displayed in the listbox. This is why I need to use asp.net controls. Is there a way to override ispostback?
Also on the DisplayResults page do I need to declare a form variable with the listboxs ID. An SQL statement like SELECT * FROM Modules WHERE ModTitle like listbox1?
Code for Likstbox Search
Code:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MM:DataSet
id="dsSearchMod"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_connOpenDay") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_connOpenDay") %>'
CommandText='<%# "SELECT * FROM Modules" %>'
Debug="true"
> </MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" runat="server" method="post" action="DisplayResults.aspx" >
<p>
<asp:dropdownlist AutoPostBack="false" DataSource="<%#dsSearchMod.DefaultView%>" DataTextField="ModTitle" ID="SearchMod" runat="server"></asp:dropdownlist>
<asp:button ID="button" runat="server"></asp:button>
</p>
<p></p>
</form>
<p> </p>
</body>
</html>
Code for DisplayResults
Code:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MM:DataSet
id="dsDisplay"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_connOpenDay") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_connOpenDay") %>'
CommandText='<%# "SELECT * FROM Modules WHERE SearchMod = ModTitle" %>'
Debug="true"
>
<Parameters>
<Parameter Name="SearchMod" Value='<%# IIf((Request.Form("SearchMod") <> Nothing), Request.Form("SearchMod"), "") %>' Type="WChar" />
</Parameters>
</MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>DisplayMod Results</p>
<table width="75%" border="1">
<tr>
<td width="27%" height="23">ModCode </td>
<td width="73%"> <%# dsDisplay.FieldValue("ModCode", Container) %> </td>
</tr>
<tr>
<td height="23">Title</td>
<td>
<%# dsDisplay.FieldValue("ModTitle", Container) %>
</td>
</tr>
<tr>
<td height="23">Level</td>
<td>
<%# dsDisplay.FieldValue("ModLevel", Container) %>
</td>
</tr>
<tr>
<td height="23">Lect</td>
<td>
<%# dsDisplay.FieldValue("ModLecturer", Container) %>
</td>
</tr>
<tr>
<td height="23">Aims</td>
<td>
<%# dsDisplay.FieldValue("ModAimsObj", Container) %>
</td>
</tr>
<tr>
<td height="23"> </td>
<td> </td>
</tr>
</table>
<p> </p>
</body>
</html>