Solved

Pass a control to a class

Posted on 2011-09-16
1
192 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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now