Link to home
Create AccountLog in
Avatar of -Dman100-
-Dman100-Flag for United States of America

asked on

'System.Web.UI.WebControls.TextBox' is a 'type' but is used like a 'variable'

I'm getting the following error when I run my page:

'System.Web.UI.WebControls.TextBox' is a 'type' but is used like a 'variable'

protected void ValidateInputLength(object source, ServerValidateEventArgs args)
    {
        TextBox txt = TextBox(GridView1.FindControl("txtDescription"));

        if (txt.Text.Length > 255)
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }

The error is thrown on the following line:
TextBox txt = TextBox(GridView1.FindControl("txtDescription"));

Thanks for any help.
ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account