Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I am working on asp.net 3.5 on N-tier application.
I am facing a problem like not able to read data from .aspx page to class file when reading controls value in any function on .aspx page

Below is the code
in a.aspx page
  Private Function Save_Data(ByVal md As Integer) As Boolean
        cuser = Session("User")
        Dim Doc As New iflow.PODoc(Lst_Index_Image.SelectedValue, Session("List_src"), cuser.User_Id)
If retrieve_value() = False Then lbl_msg.Visible = True : Exit Function
                    Doc.update(Tran)
End Sub


Public Function retrieve_value()
        Try
            Dim doc = Session("Doc")
            Dim txt As New TextBox
            txt = FormView1.FindControl("txt_vencd") 
doc.Vencd = txt.Text.Trim
            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function


In my PODoc.vb file, my code is like

Public Class PODoc
Dim _ven_cd As String
Public Property Vencd() As String
            Get
                Return _ven_cd
            End Get
            Set(ByVal value As String)
                _ven_cd = value
            End Set
        End Property
End Class


And my update function in class file
Public Sub update(ByVal trn As Transaction)
  Dim prms(0) As SqlClient.SqlParameter
  prms(0) = New SqlClient.SqlParameter("@Vendor_Code", SqlDbType.Text)
  prms(0).Value = _ven_cd
           
            Try
'Executing my stored procedure
                con.Set_cmd("UpdateInsertTranPO", prms, CommandType.StoredProcedure)
            Catch ex As Exception
                Throw New Exception(ex.Message)
            End Try
        End Sub


Now in above update function I am not able to read _ven_cd value when I am writing retrieve_value function….wherease if I don’t create this retreive_value function and if I read value directly in my main sub then it is reading value in vb class file.

Can anyone suggest me on this
Posted
Updated 15-Jul-10 2:11am
v2
Comments
Fredrik Bornander 15-Jul-10 8:12am    
Added code formatting.
[no name] 15-Jul-10 20:16pm    
How is this N-tier architecture? I believe you should read about the term before attempting to use it.
Sushma_Patel 15-Jul-10 23:58pm    
I know this is not exactly n-tier architecture....but i am applying that in my application. This is just one part of the code where i am facing the problem.
Abdul Quader Mamun 12-Nov-10 1:05am    
It is not really a n-tire architecture.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900