Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
375
Access to user control inside WebExplorerBar not working
posted

Hi guys,

I Have WebExplorerBar and inside I have ItemTemplate and inside ItemTemplate I have usercontrol.In code behind I try to access to it bu unsuccesfull.

<ig:WebExplorerBar ID="WebExplorerBar1" runat="server" CssClass="viewPanel" StyleSetName="Header" Width="805px" Height="870px">

<%--<igmisc:WebPanel ID="ViewPanel" runat="server" CssClass="viewPanel" StyleSetName="Header"
Width="805px" Height="870px">--%>
<%--<ClientSideEvents ExpandedStateChanging="CancelXpand" />--%>

<ItemTemplate>


<div class="content" id="content">
<div id="navigation" class="navigation" style="height: 5px;">
</div>
<div id="findemp" class="findemp" style="margin-top: 0px">
<div id="personInfo" style="margin-top: 0px">
<table>
<tr>
<td>
<uc1:CFNList ID="CFNList1" runat="server"></uc1:CFNList>
</td>

Here is my coding in C#:

UserControl cntrl = (UserControl)this.WebExplorerBar1.Groups[0].FindControl("CFNList1").Controls[0];

and when I am running I am getting runtime error:

it is pointing to Groups[0] and say:Index was out of range.

Please help.

Thanks,

Parents
  • 10685
    Offline posted

    Hello Jane,

    I suggest you should use

    UserControl cntrl = (UserControl)this.WebExplorerBar1.Groups[0].FindControl("CFNList1") to access the user control.

    I am not aware what the exact issue you are experiencing is, as there is no code available for debugging shared in the topic. However, in order to better assist you I have created a code sample illustrating how to access a user control contained in ItemTemplate. The sample also illustrates how to access other controls in Item Template as well.

    PS: As Version=15.1.20151.1018 is used to create the sample, in order to run it could require for to change the references if using different version.

    Please let me know how my suggestions work for you.

    WEB_GetWebUserControlInItemTemplate.zip
Reply Children