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

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

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

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 "
}

Much thanks!
Will let you know!

-Aditi

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.