Solved

Inserting data using a Wizard Control ASP.net

Posted on 2013-06-26
7
430 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 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

13 Experts available now in Live!

Get 1:1 Help Now