Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting records into the db using multiview

Status
Not open for further replies.

Ken011

MIS
Oct 13, 2006
66
US
experts,

I have been going in circles with a project that was so very simple with classic asp but very challenging so far.

I am using multiview control to pass values from one page to another page.

By this, I mean that i have 2 views = view1, view2. Then there is a 3rd view, where all values from view1 and view2 are collected.

I think I have done this successfully.

My question now is how to I insert these values into the db?

Here is an example of the codeBehind that I am using:

Code:
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls

Partial Public Class _Default
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    End Sub

    Protected Sub btnBack_Click(ByVal sender As Object, ByVal e As EventArgs)
        MultiView1.ActiveViewIndex -= 1
    End Sub

    Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As EventArgs)
        MultiView1.ActiveViewIndex += 1
    End Sub

    Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' store data into database
    End Sub

    Protected Overloads Overrides Sub OnPreRender(ByVal e As EventArgs)
        If MultiView1.ActiveViewIndex = MultiView1.Views.Count - 1 Then
            FillSummary()
        End If

        btnBack.Visible = MultiView1.ActiveViewIndex > 0
        btnNext.Visible = MultiView1.ActiveViewIndex < MultiView1.Views.Count - 1
        btnSend.Visible = MultiView1.ActiveViewIndex = MultiView1.Views.Count - 1
        MyBase.OnPreRender(e)
    End Sub

    Private Sub FillSummary()
        lblName.Text = txtAuthName.Text
        lblSurname.Text = txtAuthJob.Text
        lblAge.Text = txtAuthPhone.Text
        lblPhone.Text = txtAuthEmail.Text

    End Sub
End Class

Not real sure if this is the best approach.

There are a whole lot more records than the 4 I am using as examples here.

For instance, how I do I insert txtAuthName, txtAuthJob, txtAuthPhone txtAuthEmail into the database?

I am using vb.net and I will truly appreciate your expert assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top