Submit form in ASP.net

  • Thread starter Thread starter Miguel Dias Moura
  • Start date Start date
M

Miguel Dias Moura

Hello,

i have a form inserted in a multipage. This multipage has 6 panels.

When i finally submit the form a new record in the database is created but
the record is allways empty.

This is driving me crazy.

Please, if you can look to my file just send me an email to my email
address:

web001@27NOSPAMlamps

Just take the NOSPAM part.

Thanks,
Miguel
 
Miguel said:
i have a form inserted in a multipage. This multipage has 6 panels.

When i finally submit the form a new record in the database is created but
the record is allways empty.

This is driving me crazy.

Please, if you can look to my file just send me an email to my email
address:

web001@27NOSPAMlamps

Just take the NOSPAM part.

Hi Miguel,

why don't you simply post the relevant code so that everyone is able to
find the error?

Cheers

Arne Janning
 
It's just that is so long. Well i just cuted mostly of the form parts and
posted just some of it as an example:

Hello,

I will post only the code of 2 input form items as it would be to big to
post all the form items.

here is the database code:

<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls"
Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,c
ulture=neutral" %>
<MM:Insert
ConnectionString='<%#
System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING
_connBonsAlunos") %>'
CommandText='<%# "INSERT INTO explicador (BIAno, BIDia) VALUES (?, ?)" %>'
CreateDataSet="false"
Debug="true"
Expression='<%# Request.Form("MM_insert") = "dadosForm" %>'
runat="server" id="InsertFormValues"
DatabaseType='<%#
System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABA
SETYPE_connBonsAlunos") %>' manualmode="true"<Parameters>
<Parameter Name="@BIAno" Value='<%#
IIf((Request.Form("panelSubscribe1:BIAno") <> Nothing),
Request.Form("panelSubscribe1:BIAno"), "") %>' Type="WChar" />
<Parameter Name="@BIDia" Value='<%#
IIf((Request.Form("panelSubscribe1:BIDia") <> Nothing),
Request.Form("panelSubscribe1:BIDia"), "") %>' Type="WChar" />
</Parameters>
</MM:Insert>

Script which controls the multipage:

<script runat="Server">

Sub Page_Load
If Not IsPostBack Then
ViewState( "CurrentPage" ) = 1
End If
End Sub

Sub btnNextPage_Click( s As Object, e As EventArgs )
Dim pnlPanel As Panel
Dim strPanelName AS String

' Hide Previous Panel
strPanelName = "panelSubscribe" & ViewState( "CurrentPage" )
pnlPanel = FindControl( strPanelName )
pnlPanel.Visible = False

' Show Current Panel
ViewState( "CurrentPage" ) += 1
strPanelName = "panelSubscribe" & ViewState( "CurrentPage" )
pnlPanel = FindControl( strPanelName )
pnlPanel.Visible = True
End Sub

Sub btnPrevPage_Click( s As Object, e As EventArgs )
Dim pnlPanel As Panel
Dim strPanelName AS String

' Hide Current Panel
strPanelName = "panelSubscribe" & ViewState( "CurrentPage" )
pnlPanel = FindControl( strPanelName )
pnlPanel.Visible = False

' Show Previous Panel
ViewState( "CurrentPage" ) -= 1
strPanelName = "panelSubscribe" & ViewState( "CurrentPage" )
pnlPanel = FindControl( strPanelName )
pnlPanel.Visible = True
End Sub

Sub btnFinish_Click( sender As Object, e As System.EventArgs )
InsertFormValues.DoInit()
End Sub

</script>

Some of the form code:

<form runat='server' method='POST' name='dadosForm' class="tableForm"
id="dadosForm">
<asp:Panel ID="panelSubscribe1" Runat="Server">
<table>
<td><asp:TextBox ID="BIAno" runat="server" /></td>
</table>
<table>
<td><asp:TextBox ID="BIDia" runat="server" /></td>
</table>

..... there are 6 panels.

The last code line are:

</asp:Panel>
<input type="hidden" name="MM_insert" value="dadosForm">
</form>

As i said, a new record is inserted in the database but is empty. Have no
idea what else to do.

Thank You For Your Help,
Miguel
 
Hi Miquel,

In addition to Arne,

I thought this problem have sand before, however when the question is, "why
is there a empty row created in the database", than we can maybe help you
with showing some code how you update that database, I could not find it in
what you sand.

I see an insert string, however nowhere a command or an adapter which take
some action with that string. (I hope I do not oversee it, however point us
than on that).

Cor
 
Back
Top