Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Inserting data using a Wizard Control ASP.net

Posted on 2013-06-26
7
Medium Priority
?
440 Views
Last Modified: 2013-06-27
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

0
Comment
Question by:gfranco
  • 4
  • 2
7 Comments
 

Author Comment

by:gfranco
ID: 39280245
hi guys, any help on this?
0
 
LVL 13

Expert Comment

by:Jitendra Patil
ID: 39280428
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.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39280754
On 2nd step of your wizard, do you have Next button or Finish button?
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:gfranco
ID: 39281747
Finish button.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 39281847
That's your problem then because you have

Protected Sub Wizard1_NextButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.NextButtonClick


Either add a separate handler for Finish or change existing to

Protected Sub Wizard1_NextButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.NextButtonClick, Wizard1.FinishButtonClick
0
 

Author Comment

by:gfranco
ID: 39281851
Using the same index (0 and 1)? Let me try, thanks.
0
 

Author Closing Comment

by:gfranco
ID: 39281948
Thanks.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question