Link to home
Start Free TrialLog in
Avatar of gfranco
gfrancoFlag for United States of America

asked on

Inserting data using a Wizard Control ASP.net

Hi there, I am using this code for inserting data from a wizard control. I need to insert data on 2 tables, however I am be able to insert only on first index 0, but when the second part of the wizard is done, the second index is not saving on my other table.
Any help would be appreciated. Thanks.

Partial Class SignUpPhysian
    Inherits System.Web.UI.Page

    

    Protected Sub Wizard1_NextButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.NextButtonClick
        'Dim val(1) As Byte
        If e.CurrentStepIndex = 0 Then
            Dim objEhr As New TarmarikDataContext
            objEhr.Modify_Doctors(1, 1, DoctorName.Text, DoctorLastName.Text, DoctorSurName.Text, DoctorEmail.Text, DoctorOfficeNumber.Text, DoctorMobileNumber.Text,
                                 DoctorFaxNumber.Text, ddDoctorGender.SelectedValue, DoctorAddress.Text, ddDoctorCountry.SelectedValue, ddDoctorCity.SelectedValue, ddCityZone.SelectedValue,
                                 DoctorZipCode.Text, ddDoctorSpeciality.SelectedValue, DoctorLicenseNumber.Text, ddDoctorRUC.Text, DoctorDOB.Text, "BIO")

        ElseIf e.CurrentStepIndex = 1 Then
            Dim objEhr As New TarmarikDataContext
            objEhr.Modify_Users(1, 1, UserId.Text, UserFirstName.Text, UserLastName.Text, DoctorPassword.Text, ddDoctorSecurityQuestion.SelectedValue, DoctorSecurityAnwer.Text, 1, Today, Today, Today, UserId.Text, True, "A")
        End If
    End Sub

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        UserId.Text = DoctorEmail.Text
        UserFirstName.Text = DoctorName.Text
        UserLastName.Text = DoctorLastName.Text

    End Sub
End Class

Open in new window

Avatar of gfranco
gfranco
Flag of United States of America image

ASKER

hi guys, any help on this?
Avatar of jitendra patil
i think the step indexing starts with 1

try changing like
 If e.CurrentStepIndex = 1 Then
            Dim objEhr As New TarmarikDataContext
            objEhr.Modify_Doctors(1, 1, DoctorName.Text, DoctorLastName.Text, DoctorSurName.Text, DoctorEmail.Text, DoctorOfficeNumber.Text, DoctorMobileNumber.Text,
                                 DoctorFaxNumber.Text, ddDoctorGender.SelectedValue, DoctorAddress.Text, ddDoctorCountry.SelectedValue, ddDoctorCity.SelectedValue, ddCityZone.SelectedValue,
                                 DoctorZipCode.Text, ddDoctorSpeciality.SelectedValue, DoctorLicenseNumber.Text, ddDoctorRUC.Text, DoctorDOB.Text, "BIO")

        ElseIf e.CurrentStepIndex = 2 Then
            Dim objEhr As New TarmarikDataContext
            objEhr.Modify_Users(1, 1, UserId.Text, UserFirstName.Text, UserLastName.Text, DoctorPassword.Text, ddDoctorSecurityQuestion.SelectedValue, DoctorSecurityAnwer.Text, 1, Today, Today, Today, UserId.Text, True, "A")
        End If

Open in new window

hope this helps.
On 2nd step of your wizard, do you have Next button or Finish button?
Avatar of gfranco

ASKER

Finish button.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gfranco

ASKER

Using the same index (0 and 1)? Let me try, thanks.
Avatar of gfranco

ASKER

Thanks.