Z
Zamdrist
I swear if I have to 'relearn' how AutoPostBack, EnableViewState and
Me.IsPostBack works, or should work, I'm going to literally tear my
hair out.
I've got a pretty simple form, couple of text boxes, a check box, a
drop down list and a button.
The drop down list is populated via code, and that works fine. The
TextValue is set to a one field returned by a stored procedure, as is
the ValueField set to an associated numeric value.
When I hit the command button to submit and run my code, the value
selected in the drop down list changes. The values listed in the drop
down list are not unique, but the text values are.
I've tried various combination of AutoPostBack = True, False,
EnableViewState = True, False. But I cannot get it working as it
should. The value selected in the drop down list shouldn't change, as
its value depends on my code working correctly. Here is what I have in
the Page Load event:
If Not Me.IsPostBack Then
If adoConn_FirmApps.State <> ConnectionState.Open Then
adoConn_FirmApps.Open()
adoComm_SubClass.Connection = adoConn_FirmApps
adoComm_SubClass.CommandType = CommandType.StoredProcedure
adoComm_SubClass.CommandText = "CI_SubClassList"
With ddlSubClass
.DataSource =
adoComm_SubClass.ExecuteReader(CommandBehavior.CloseConnection)
.DataTextField = "SubClass"
.DataValueField = "SubClassType"
.DataBind()
End With
End If
Any help, advice or suggestions would be greatly appreciated! Thanks!
Me.IsPostBack works, or should work, I'm going to literally tear my
hair out.
I've got a pretty simple form, couple of text boxes, a check box, a
drop down list and a button.
The drop down list is populated via code, and that works fine. The
TextValue is set to a one field returned by a stored procedure, as is
the ValueField set to an associated numeric value.
When I hit the command button to submit and run my code, the value
selected in the drop down list changes. The values listed in the drop
down list are not unique, but the text values are.
I've tried various combination of AutoPostBack = True, False,
EnableViewState = True, False. But I cannot get it working as it
should. The value selected in the drop down list shouldn't change, as
its value depends on my code working correctly. Here is what I have in
the Page Load event:
If Not Me.IsPostBack Then
If adoConn_FirmApps.State <> ConnectionState.Open Then
adoConn_FirmApps.Open()
adoComm_SubClass.Connection = adoConn_FirmApps
adoComm_SubClass.CommandType = CommandType.StoredProcedure
adoComm_SubClass.CommandText = "CI_SubClassList"
With ddlSubClass
.DataSource =
adoComm_SubClass.ExecuteReader(CommandBehavior.CloseConnection)
.DataTextField = "SubClass"
.DataValueField = "SubClassType"
.DataBind()
End With
End If
Any help, advice or suggestions would be greatly appreciated! Thanks!