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