Skip to content

How to make web user control readonly

sheetal

Asked Feb 19, 2012, 10:12 PM EST1 answer
Share
LinkedInX
Hi,

I have a web user control gridview containing table and rows and columns. I want to make it readonly based on certain conditions.
I have declared property in web user control page as follows:

 public Boolean ReadOnly
    {
        get
        {
            return ViewState["ReadOnly"] == null ? false : Convert.ToBoolean(ViewState["ReadOnly"]);
        }

        set
        {
            ViewState["ReadOnly"] = value;
        }
    }

Now I want to call this and set the control to readonly. How to do that?

Thanks,
Sheetal

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Place the user control in a Panel and set Panel.Enable = ReadOnly.
    0