Wednesday, March 21, 2012

Panle control

I have a panel control with a pure text inside.

Is it possible to read that text from code behind?

<asp:PanelID="Panel1"runat="server">

Some Text

</asp:Panel>

Thank you

That text should be a child control of the panel. You can look at which are the child controls of your panel control like this:

Panel1.Controls[index]

try a foreach loop in that array to study it.

I think that test gets placed inside a LiteralControl control if I'm not mistaken.

Hope this helps.

German Afanador


Below is a sample code

LiteralControl lt = (LiteralControl)Panel1.Controls[0];

Response.Write(lt.Text);

HC


Thank you all

0 comments:

Post a Comment