Solved

Pass a control to a class

Posted on 2011-09-16
1
217 Views
Last Modified: 2012-05-12
I have a button with the ID "Button1" on a web page.  I want to pass it to a Class that determines if the user has the rights to view it.  If not, then I want to set visible=false.
How do I pass a control to a Class?
0
Comment
Question by:rrhandle8
1 Comment
 
LVL 21

Accepted Solution

by:
Dale Burrell earned 250 total points
ID: 36553129
Something like:

-----

MyClass NewMyClass = new MyClass();

NewMyClass.CheckPermission(Button1);

------

public class MyClass
{
    public MyClass() {}

    public void CheckPermission(LinkButton In)
    {
        if (/* Some Test*/) In.Visible = true; else In.Visible = false;
    }
}
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question