Wednesday, March 21, 2012

problem of find control in nested Formview control

I can find my Textbox contols in following structures,

<asp:PanelID="Popup1"runat="server"CssClass="popup"style="display:none;">

<asp:UpdateProgressid="UpdateMessagesProgress"DynamicLayout="false"runat="server"DisplayAfter="0">

<ProgressTemplate>

Processing...

</ProgressTemplate>

</asp:UpdateProgress>

<asp:UpdatePanelID="UpdatePopup"runat="server"UpdateMode=Always>

<ContentTemplate>

<asp:FormViewid="FormView1"runat="server" DefaultMode="Edit">

<EditItemTemplate>

<asp:TextBoxid="title_TextBox"runat="server" Text='<%# Bind("title") %>'></asp:TextBox>

............

</EditItemTemplate>

</asp:FormView>

</ContentTemplate>

</asp:UpdatePanel>

</asp:Panel>

I want to set the textbox's visible to false but can't find it. Please help me!!

Check out

http://forums.asp.net/t/1107107.aspx it may help you


Try this one :

FormView1.FindControl('title_TextBox').Visible = false


I still can't solve this problem. Any other ideas?


Finally, I can find my Textbox control by using following method:

In RowUpdating envent:

protected void GridView2_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow MyRow = GridView2.Rows[e.RowIndex];

if (MyRow != null)
{
TextBox exit_price_text = MyRow .FindControl("exit_price_TextBox") as TextBox;
.....

}

}

No comments:

Post a Comment