Hi all,
I have created a master page in asp2.0 and i have placed ModalPopupExtender in that. I have written a custom Textbox control. In that text Changeded event i have created reference to the Masterpage modalpopupextender using Findcontrrol method. But i cant able to loop through tge Master page controls Properly. I am unable to findthe controls with its client id. Can anybody know how to solv this.
My aim is to call the modalpopupextender show event from the custom control.
<cc1:ModalPopupExtenderID="ModalPopupExtender1"runat="server"TargetControlID="btnForLookup"PopupControlID="LookupPanel"BackgroundCssClass="modalBackground">Private
Sub AHNLookup_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Click{ Dim contr as ModalpopupExtender
Contr = Me.page.master.FindControls("ModalPopupExtender1")
Constr.show() -->Gives error as Null object.
}
====
Thanks in advance.
S.Sathishraja
Hi,Please try to find it in a recursive way.
public?Control FindControlRecursive(Control root, string id)
{
????if (root.ID == id)
????{
????????return root;
????}
????foreach (Control c in root.Controls)
????{
????????Control t = FindControlRecursive(c, id);
????????if (t != null)
????????{
????????????return t;
????????}
????}
????return null;
}
Hope this helps.
No comments:
Post a Comment