How to call an ASPX page function in another project?

1

How to call an ASPX page function in another project?

When I click on insert I call a project to make the business rules, at some point I need to call a C # function that is on the page and after the return of this function continue in the making business rules.

What do I call this function?

    
asked by anonymous 03.04.2014 / 14:38

2 answers

1

You could pass the method to be caller to the BLL as a delegate, and then use the delegate to call the method.

Example:

BLL Code:

public void RegraInserir(Action metodo)
{
    metodo(); // chamando o método passado na forma de delegate
}

Page Code:

public void buttonInserir_Click(EventArgs e)
{
    businessLayer.RegraInserir(this.Metodo);
}

private void Metodo()
{
    // método que será chamado pela BLL
}
    
03.04.2014 / 14:52
1

Hello.

For this to happen, you'll need to reference your project (not solution) in your BLL. However, if you have already done the BLL reference in your application, VS will not allow it.

One solution that I use a lot is to keep as many methods as possible in the BLL, even if it is something specific, so if you need to use it in aspx or in the BLL itself, just call it normally.

I hope I have helped !!!

    
03.04.2014 / 14:46