Monday, March 26, 2012

Access Textbox Inside an Atlas CollapsiblePanel

Hello all, I have this code

<%

@dotnet.itags.org.RegisterSrc="~/Controls/CollapsibleContent.ascx"TagPrefix="collapsible"TagName="CollapsibleContent" %>

<collapsible:CollapsibleContentID="generalPanel"IsCollapsed="false"runat="server">
<Title>Datos Generales del Documento</Title>
<Content>
<tablewidth="100%"border="0"cellspacing="0">
<tr>
<tdstyle="text-align: left; width:15%">
<asp:LabelID="lblFormItem1"runat="server"Text="Titulo"></asp:Label>
</td>
<tdstyle="text-align: left; width:25%">
<asp:TextBoxID="txtFormItem1"runat="server"MaxLength="50"Width="85%"Enabled="false"></asp:TextBox>
<asp:RequiredFieldValidatorID="RequiredFieldValidator3"runat="server"ControlToValidate="txtFormItem1"ErrorMessage="this is a required field, can't be null"ValidationGroup="Page">*</asp:RequiredFieldValidator>
</td>
</tr>
</table>
</Content>
</collapsible:CollapsibleContent>

I'm trying to access the value of the textbox but when I build my solution, the debuger send that the txtFormItem1 doesn't exist, I have tried to do this

TextBox txt1 = (TextBox)this.Page.FindControl("txtFormItem1");
if (txt1 !=null)
{
txt1.Enabled = !txt1.Enabled;
}

Can anyone help me please. Thanks.

Try

generalPanel.FindControl("txtFormItem1");


I haven't tryed to reproduce your issue but feel questions:

Why are you using FindControl if you haven't instantiated the control dynamicly? just access txtFormItem1.Text...

if it doesn't work, download the latest release from codeplex... an issue about blank textboxes was resolved...

Hope helped...

Regards,

Felipe Oquendo
MCAD


sburke_msft:

Try

generalPanel.FindControl("txtFormItem1");

it would work too...

No comments:

Post a Comment