PDA

View Full Version : ASP Post Data Problem


odellp
09-23-2007, 10:17 AM
Hi

I am using dreamweaver 9 with IIS as local server and Win XP Pro
I am trying to get started by creating a simple site with 2 pages test.aspx and receive.aspx.

Test.aspx has a simple form with textbox and submit button and I want to post the form data to another page receive.aspx which has a datagrid to display the results but when I click the submit button it just refreshes the test.aspx page.Looking at the code for firefox action =test.aspx where my original dreamweaver code says receive.aspx

Any help for a newbie appreciated

Mozilla Firefox code for test.aspx



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body><form name="form1" method="post" action="test.aspx" id="form1"><div><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEzMzE5MDUyNjFkZO4bMH+HPPVJGcRX1pIYGjyIssU f" /></div> <p> <input name="txtEnter" type="text" value="action" id="txtEnter" /></p> <p>&nbsp;</p> <p> <input type="submit" name="searchButton" value="search" id="searchButton" /></p> <p>&nbsp;</p> <div> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwKkrYKeDALDhPyrCwKx1vaaCdRRLAeII42k69nPxxJy2+2 rBaa3" /></div></form></body></html>



Dreamweaver code
Code for test.aspx


<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="receive.aspx" method="post" name="form1" id="form1" runat="server">
<p>
<asp:TextBox ID="txtEnter" Text="action" TextMode="SingleLine" runat="server" />
</p>
<p>&nbsp;</p>
<p>
<asp:Button ID="searchButton" runat="server" Text="search" />
</p>
<p>&nbsp;</p>
</form>
</body>
</html>

code for receive.aspx


<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="utf-8" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=83 6f606ede05d46a,culture=neutral" %>
<MM:DataSet
id="DataSet2"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_STRING_test") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_DATABASETYPE_test") %>'
CommandText='<%# "SELECT * FROM info WHERE genre = ?" %>'
Debug="true" PageSize="10"
>
<Parameters>
<Parameter Name="@genre" Value='<%# IIf((Request.QueryString("genre") <> Nothing), Request.QueryString("genre"), "") %>' Type="WChar" />
</Parameters>
</MM:DataSet>
<MM:PageBind runat="server" PostBackBind="false" />

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form method="get" name="myForm" id="myForm" runat="server">
<asp:DataGrid id="DataGrid1"
runat="server"
AllowSorting="False"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
ShowFooter="false"
ShowHeader="true"
DataSource="<%# DataSet2.DefaultView %>"
PagerStyle-Mode="NextPrev"
AllowPaging="true"
AllowCustomPaging="true"
PageSize="<%# DataSet2.PageSize %>"
VirtualItemCount="<%# DataSet2.RecordCount %>"
OnPageIndexChanged="DataSet2.OnDataGridPageIndexChanged"
>
<HeaderStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<ItemStyle BackColor="#F2F2F2" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<AlternatingItemStyle BackColor="#E5E5E5" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<FooterStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<PagerStyle BackColor="white" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<Columns>
<asp:BoundColumn DataField="ID"
HeaderText="ID"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="filmname"
HeaderText="filmname"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="genre"
HeaderText="genre"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="imdblink"
HeaderText="imdblink"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="description"
HeaderText="description"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="timelength"
HeaderText="timelength"
ReadOnly="true"
Visible="True"/>
</Columns>
</asp:DataGrid>
</form>
</body>
</html>

odellp
09-25-2007, 02:35 PM
Well I used a spry form to post data but displayed results with asp grid and it works
Still dont know why asp doesnt work

domedia
09-25-2007, 02:49 PM
odell, asp people are few and far between here. Stick around for a while, I'd love to have some more ASP people here.