0

Hi !

I am having problems accessing a label on an aspx page to a called function which resides in a seperate .vb file.

My code is as follows:

Login.aspx
======== <asp:label id="lblErrorMessage" runat="server"></asp:label> BL / PSUrAccount.vb
==============

Public Class WBUserAcct
        I want to access the 'lblErrorMessage' control here..!!
End Class

Thanks,
Adi

2
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by luckyads
0

No you cant access your page controls in any other class file other than your code behind file. Can U explain what u r trying to achieve. May b there is some work around

0

Hey thanks!

But I want to seperate out the code in the .vb file and not use it in the .aspx file. I am actually reading an XML file in the code and verifying the username and password with the XML. Here I want to show a message on the Login.aspx page if the username is incorrect and I am writing this code in the .vb file but I am not able to access the lblMessage in the vb file..

Please could you suggest something to work around.

Thanks again!
Adi

0

One alternative will be to create a function that returns a boolean value that indicates the result of user authentication in your calss file like this
Your .vb file

public shared CheckUserAuthentication() As Boolean
{
   //Authentication code goes here
}

Your .aspx.vb file

if(!MyClass.CheckUserAuthenticaiton())
{
      lblErrorMessageText="Invalid Login Name  and Password "
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.