Forum Moderators: open

Message Too Old, No Replies

Passing a Dynamic Variable

         

NoSkills

10:33 pm on Jan 4, 2005 (gmt 0)

10+ Year Member



I'm trying to set a variable dynamicly using a session(ID). I'm not sure if its possible and/or how to right it. Here is what I have.

<form name="dealer" runat="server">
<p>Zip:<asp:textbox ID="zip" runat="server" columns="5" TextMode="SingleLine" />
</p>
<p> Password:<asp:textbox ID="Password" runat="server" />
</p>
<p><asp:button ID="Submit" runat="server" Text="Submit" />
</p>
<% if dataset1.RecordCount > 0 then
Session("Zip") = "DataSet1.FieldValue("Zip", Container)"

Session("Pass") = "DataSet1.FieldValue("Password", Container)"

Response.Redirect("view2.aspx")

else if((Request.Form("password"))) <> Nothing _

OR ((Request.Form("zip"))) <> Nothing

response.Write("Login failed. Please try again.")

end if %>
</form>

I'm using Dreamweaver so the Data bound items look a little different (i think)

Please help!

CaseyRyan

3:16 pm on Jan 5, 2005 (gmt 0)

10+ Year Member



Hello NoSkills,
are you receiving an error when running this page?
What do you expect to happen and what is it actually doing?

Could you also post the code which you use to populate the Dataset?

Thanks

-=casey=-

NoSkills

11:14 pm on Jan 6, 2005 (gmt 0)

10+ Year Member



I figured it out. I needed the request.form() to set the session. Thanks for your help. but I have another problem that I could use help on. The info below will not update my data-base:

<%@ 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:Update
runat="server"
CommandText='<%# "UPDATE tblNews SET header=?, news=?, Date=? WHERE id=?" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_RMM2") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_RMM2") %>'
Expression='<%# Request.Form("MM_update") = "form1" %>'
CreateDataSet="false"
SuccessURL='<%# "success.aspx" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@header" Value='<%# IIf((Request.Form("header") <> Nothing), Request.Form("header"), "") %>' Type="WChar" />
<Parameter Name="@news" Value='<%# IIf((Request.Form("news") <> Nothing), Request.Form("news"), "") %>' Type="WChar" />
<Parameter Name="@Date" Value='<%# IIf((Request.Form("Date") <> Nothing), Request.Form("Date"), "") %>' Type="Date" />
<Parameter Name="@id" Value='<%# IIf((Request.Form("theID") <> Nothing), Request.Form("theID"), "") %>' Type="Integer" />
</Parameters>
</MM:Update>
<MM:DataSet
id="DataSet1"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_RMM2") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_RMM2") %>'
CommandText='<%# "SELECT * FROM tbldealers WHERE Zip =? AND Password =?" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@zip" Value='<%# IIf((Not Session("Zip") Is Nothing), Session("Zip"), "") %>' Type="WChar" />
<Parameter Name="@password" Value='<%# IIf((Not Session("Pass") Is Nothing), Session("Pass"), "") %>' Type="WChar" />
</Parameters>
</MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<html>
<head>
<title>RMM Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
H2 {
font-family: revue, "Arial Black", Arial;
text-decoration: blink;
}
body {
font-family: Arial, Helvetica, sans-serif;
color: #000000;
text-decoration: none;
}
a {font-family: Arial, Helvetica, sans-serif;
color: #FF0000;
text-decoration: none;}
-->
</style>
</head>
<body>
<table width="95%" height="123" border="2" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center">
<h2>R Millen Motorsport<br>
Dealer Contact Information Form</h2>
</div></td>
</tr>
<tr>
<td width="100%" height="21">

<p>&nbsp;</p>

<form method="post" name="form1" runat="server">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Id:</td>
<td> <asp:label id="theID" runat="server" /> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Header:</td>
<td> <asp:textbox id="header" TextMode="SingleLine" Columns="32" runat="server" /> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">News:</td>
<td> <asp:textbox id="news" TextMode="SingleLine" Columns="32" runat="server" /> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input type="submit" value="Update Record"></td>
</tr>
</table>
<input type="hidden" name="Date" value="">
<input type="hidden" name="theID" value="">
<input type="hidden" name="MM_update" value="form1">
</form>
<p>&nbsp;</p>
</td>
</tr>
</table>
<p></p>
</body>
</html>

Please let me know if you see anything that isn't correct. Thanks.