0

i am developing application and i have set some html control which are runat="server" on code behind i need to change there text,i made htmlcontrol[] array which contain those control now the problem which i am facing that it didn't showing my text property so that i can change there text dynamically my code is

HtmlControl[] htmlctrl = { ctl1,ctl2,ctl3,ctl4 };

        foreach (HtmlControl ctl in htmlctrl)
        {


        }

Can anyone help me out.

3
  • Can you provide the contents of your foreach loop? Commented Jan 17, 2011 at 10:44
  • Maxim:i am not getting the property of INNERTEXT OR INNERHTML so what i provide you i just need to set text from sql. Commented Jan 17, 2011 at 10:47
  • HTMLControl is base of all html controls and does not contain non-generic property like innerText. Use HtmlGenericControl and access propety InnerText Commented Jan 17, 2011 at 10:48

1 Answer 1

2

you must type-cast html-control (which is textbox) to TextBox, in order to get Text property shown.

Sign up to request clarification or add additional context in comments.

1 Comment

please typecast htmlcontrol to htmlgeneric control in such case, and then use INNERTEXT OR INNERHTML properties, eg: HtmlGenericControl gen = ((HtmlGenericControl)(ctl));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.