copazuwajipxv
New Member
When the usercontrol Titlebar is loaded through procesSearchCriteria1 I want the defaultbutton of PNL1 to be SearchButton. Of course when it's loaded through ucBBB I want the SaveButton to be the defaultButton of Pnl2.Is this possible? Mainpage: \[code\]<asp
anel runat="server" ID="Pnl1" defaultButton=""> <uc1:AAA ID="procesSearchCriteria1" runat="server"/></asp
anel><div class="separator"></div><asp
anel runat="server" ID="Pnl2" defaultButton=""> <uc2:BBBB ID="ucBBB" runat="server"/></asp
anel>\[/code\]UserControl procesSearchCriteria1:\[code\]<uc3:TitleBar ID="ucTitleBarAAA" runat="server" Type="Search" />\[/code\]UserControl ucBBB:\[code\]<uc3:TitleBar ID="ucTitleBarBBB" runat="server" Type="Save" />\[/code\]UserControl Titlebar\[code\] <asp:ImageButton ID="SearchButton" runat="server" ImageUrl="/Images/title_search.png" OnClick="SearchButton_Clicked" /> <asp:ImageButton ID="SaveButton" runat="server" ImageUrl="/Images/title_save.png" OnClick="SaveButton_Clicked" />\[/code\]I've tried to pass the Id of the button to main page like below but get this errormessage:The DefaultButton of 'PnlWerkprocesSearchCriteria1' must be the ID of a control of type IButtonControl. while the id DefaultButton.UniqueID does equal the Id of the button when looked in the browserCode Behind Mainpage:\[code\]public procesSearchCriteria procesSearchCriteria { get { return procesSearchCriteria1; } }protected void Page_Load(object sender, EventArgs e){procesSearchCriteria.Load += new EventHandler(procesSearchCriteria_Load);}void procesSearchCriteria_Load(object sender, EventArgs e){ ImageButton DefaultButton = procesSearchCriteria.DefaultButtonProcesSearchCriteria; Pnl1.DefaultButton = DefaultButton.UniqueID;}\[/code\]Code behind procesSearchCriteria1:\[code\]public ImageButton DefaultButtonProcesSearchCriteria { get; set; }DefaultButtonProcesSearchCriteria = (ImageButton)ucTitleBarAAA.TitleBarSearchButton\[/code\]



