Click to See Complete Forum and Search --> : Transfering Datagrid Values to a form


Dark_AngeL
05-24-2006, 10:39 AM
Hi :confused:

I really need help desperatly ...

I have a datagrid which lists all the lists I have in my database .. In the datagrid I've added a Hyperlink Column ..

<asp:HyperLinkColumn Text="Edit" DataNavigateUrlField="ItemNo" DataNavigateUrlFormatString="ItemsDetails.aspx?ItemNo" DataTextField="ItemNo" HeaderText="Settings"></asp:HyperLinkColumn>

Now when I click on the ItemNo in the datagrid it transfers me to the page I want but it doesnt show the Item's No and Name ... I am a bit confused of how to do it but I tried several thinks like this ..

Public Sub Page_Load(Source As Object, E As EventArgs)
Dim objConnection As OleDBConnection
Dim objCommand As OleDBCommand
Dim objAdapter As OleDBDataAdapter
Dim objDataSet As DataSet
Dim dr As DataRow
Dim strOleDBQuery As String
Dim ItemNo As Integer

objConnection = New OleDBConnection ("Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Inetpub\wwwroot\HASEM_sys\HASEM_sys.mdb")


If Not Page.IsPostBack Then

ItemNo = CInt(Request.QueryString("ItemNo"))

objDataSet = New DataSet()

objCommand = New OleDBCommand("tblItems", objConnection)

objCommand.CommandType = CommandType.StoredProcedure

objCommand.Parameters.Add("@ItemNo", DbType.Int32).Value = ItemNo

objAdapter = New OleDBDataAdapter(objCommand)

objConnection.Open()

objAdapter.Fill(objDataSet, "tblItems")

dr = objDataSet.Tables("tblItems").Rows(0)

txtItemNo.Text = dr("ItemNo")

txtItemNm.Text = dr("ItemName")

txtStatus.Text = dr("Status")

objConnection.Close()

End if

End Sub



I might be on the right track and I might not be ... This took me 2 days to figure it out ..
Please I need guidence and help :(