A
amatuer
Hi, I am trying to add data to a datagrid that i get from another
page. I can add the data bt wen i add more data it replaces the
previous data. can anyone help please?
Here's my coding:
--This section gets my data from the one page and using a session i
pass a primary key to the next page.
Private Sub GetUS()
Try
Dim obj As Businesslayer.Registration = New
Businesslayer.Registration
Dim ds As Data.DataSet
ds = obj.GetUS(System.Convert.ToInt16(txtUS.Text))
obj = Nothing
'TextBox2.Items.Clear()
txtUSCode.Text = ds.Tables(0).Rows(0).Item(1)
txtDesc.Text = ds.Tables(0).Rows(0).Item(2)
txtNQF.Text = ds.Tables(0).Rows(0).Item(3)
txtCredit.Text = ds.Tables(0).Rows(0).Item(4)
txtWA.Text = ds.Tables(0).Rows(0).Item(5)
txtLT.Text = ds.Tables(0).Rows(0).Item(6)
Session("PkUS") = ds.Tables(0).Rows(0).Item(0)
'DDLTitle.DataValueField = "TitleID"
'DDLTitle.DataSource = ds
'DDLTitle.DataBind()
'DDLTitle.AppendDataBoundItems = False
Catch ex As Exception
'UserMsgBox(ex.Message)
End Try
End Sub
-- In my following page i use the session to query the data from the
database and when clicking on a button the data is added to my
datagrid. But if i select another set of data it jus replaces the
previous set.
Private Sub GetUnitStd()
Try
Dim obj As Businesslayer.Registration = New
Businesslayer.Registration
Dim ds As Data.DataSet
ds = obj.GetUnitStd(Session("PkUS"))
obj = Nothing
For Each row As GridViewRow In GVUnits.Rows
DirectCast(row.FindControl("txtName"), TextBox).Text()
= ds.Tables(0).Rows(0).Item(1)
DirectCast(row.FindControl("txtDescrip"),
TextBox).Text() = ds.Tables(0).Rows(0).Item(0)
Next
Catch ex As Exception
UserMsgBox(ex.Message)
End Try
End Sub
Can someone please assist?
Thanks.
page. I can add the data bt wen i add more data it replaces the
previous data. can anyone help please?
Here's my coding:
--This section gets my data from the one page and using a session i
pass a primary key to the next page.
Private Sub GetUS()
Try
Dim obj As Businesslayer.Registration = New
Businesslayer.Registration
Dim ds As Data.DataSet
ds = obj.GetUS(System.Convert.ToInt16(txtUS.Text))
obj = Nothing
'TextBox2.Items.Clear()
txtUSCode.Text = ds.Tables(0).Rows(0).Item(1)
txtDesc.Text = ds.Tables(0).Rows(0).Item(2)
txtNQF.Text = ds.Tables(0).Rows(0).Item(3)
txtCredit.Text = ds.Tables(0).Rows(0).Item(4)
txtWA.Text = ds.Tables(0).Rows(0).Item(5)
txtLT.Text = ds.Tables(0).Rows(0).Item(6)
Session("PkUS") = ds.Tables(0).Rows(0).Item(0)
'DDLTitle.DataValueField = "TitleID"
'DDLTitle.DataSource = ds
'DDLTitle.DataBind()
'DDLTitle.AppendDataBoundItems = False
Catch ex As Exception
'UserMsgBox(ex.Message)
End Try
End Sub
-- In my following page i use the session to query the data from the
database and when clicking on a button the data is added to my
datagrid. But if i select another set of data it jus replaces the
previous set.
Private Sub GetUnitStd()
Try
Dim obj As Businesslayer.Registration = New
Businesslayer.Registration
Dim ds As Data.DataSet
ds = obj.GetUnitStd(Session("PkUS"))
obj = Nothing
For Each row As GridViewRow In GVUnits.Rows
DirectCast(row.FindControl("txtName"), TextBox).Text()
= ds.Tables(0).Rows(0).Item(1)
DirectCast(row.FindControl("txtDescrip"),
TextBox).Text() = ds.Tables(0).Rows(0).Item(0)
Next
Catch ex As Exception
UserMsgBox(ex.Message)
End Try
End Sub
Can someone please assist?
Thanks.