Solved

Inserting data using a Wizard Control ASP.net

Posted on 2013-06-26
7
434 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 12

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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

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

Accepted Solution

by:
CodeCruiser earned 500 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

816 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now