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
710
WebExplorerBar structure and accessing its controls in code behind
posted

Hi, I am migrating from 11.1 to 13.2 and I have a page that have plenty of controls, among them, WebTabs with WebExplorerBars that have DataGrids inside and other asp controls.

For example, here's one WebExplorerBar:

<ignav:WebExplorerBar CssClass="panelBackground" ID="wpExpensesCodes" Height="275px" Width="645px" runat="server">
<Templates>

<igtbl:WebDataGrid ShowHeader="true" AutoGenerateColumns="false" ID="uwgRelationsExpensesCodes" runat="server" Width="643px" Height="220px">
<Columns>
<igtbl:BoundDataField Key="ExpenseId" DataFieldName="ExpenseId" Hidden="true">
</igtbl:BoundDataField>
<igtbl:BoundDataField Key="Name" DataFieldName="Name" Width="530px">
<Header Text="Name">
</Header>
</igtbl:BoundDataField>
<igtbl:BoundDataField CssClass="cellGridStyle" Key="MenuPosition" DataType="System.Int16" DataFieldName="MenuPosition"
Width="90px">
<Header Text="Menu Position">
</Header>
</igtbl:BoundDataField>
</Columns>
<Behaviors>
<igtbl:RowSelectors Enabled="false"></igtbl:RowSelectors>
<igtbl:Selection CellClickAction="Row" CellSelectType="Single"></igtbl:Selection>
<igtbl:ColumnFixing Enabled="true"></igtbl:ColumnFixing>
<igtbl:EditingCore>
<Behaviors>
<igtbl:RowAdding Enabled="true"></igtbl:RowAdding>
<igtbl:CellEditing>
<ColumnSettings>
<igtbl:EditingColumnSetting ColumnKey="MenuPosition" ReadOnly="false" />
<igtbl:EditingColumnSetting ColumnKey="ExpenseId" ReadOnly="true" />
<igtbl:EditingColumnSetting ColumnKey="Name" ReadOnly="true" />
</ColumnSettings>
</igtbl:CellEditing>
</Behaviors>
</igtbl:EditingCore>
</Behaviors>
</igtbl:WebDataGrid>
<div style="height: 5px;">
</div>
<asp:DropDownList ID="cmbRelationsExpensesCodes" runat="server">
</asp:DropDownList>
<asp:Button ID="btnRelationsExpensesCodesAdd" OnClick="btnRelationsExpensesCodesAdd_Click"
Text="Add" Width="80px" runat="server" />
<asp:Button ID="btnRelationsExpensesCodesDelete" OnClick="btnRelationsExpensesCodesDelete_Click"
Text="Remove" Width="80px" runat="server" />

</Templates>
</ignav:WebExplorerBar>

And I access its controls in the code-behind, and it's compiling perfectly

but once I launch the application I am getting this error:

Infragistics.Web.UI.ItemTemplateCollection must have items of type 'Infragistics.Web.UI.ItemTemplate'. 'igtbl:WebDataGrid' is of type 'Infragistics.Web.UI.GridControls.WebDataGrid'.


STEP 2:


taking that error into consideration, I tried adding the ItemTemplate like this:

<ignav:WebExplorerBar CssClass="panelBackground" ID="wpExpensesCodes" Height="275px" Width="645px" runat="server">
<Templates>

<ig:ItemTemplate> 
<Template>

<igtbl:WebDataGrid ShowHeader="true" AutoGenerateColumns="false" ID="uwgRelationsExpensesCodes" runat="server" Width="643px" Height="220px">
<Columns>
<igtbl:BoundDataField Key="ExpenseId" DataFieldName="ExpenseId" Hidden="true">
</igtbl:BoundDataField>
<igtbl:BoundDataField Key="Name" DataFieldName="Name" Width="530px">
<Header Text="Name">
</Header>
</igtbl:BoundDataField>
<igtbl:BoundDataField CssClass="cellGridStyle" Key="MenuPosition" DataType="System.Int16" DataFieldName="MenuPosition"
Width="90px">
<Header Text="Menu Position">
</Header>
</igtbl:BoundDataField>
</Columns>
<Behaviors>
<igtbl:RowSelectors Enabled="false"></igtbl:RowSelectors>
<igtbl:Selection CellClickAction="Row" CellSelectType="Single"></igtbl:Selection>
<igtbl:ColumnFixing Enabled="true"></igtbl:ColumnFixing>
<igtbl:EditingCore>
<Behaviors>
<igtbl:RowAdding Enabled="true"></igtbl:RowAdding>
<igtbl:CellEditing>
<ColumnSettings>
<igtbl:EditingColumnSetting ColumnKey="MenuPosition" ReadOnly="false" />
<igtbl:EditingColumnSetting ColumnKey="ExpenseId" ReadOnly="true" />
<igtbl:EditingColumnSetting ColumnKey="Name" ReadOnly="true" />
</ColumnSettings>
</igtbl:CellEditing>
</Behaviors>
</igtbl:EditingCore>
</Behaviors>
</igtbl:WebDataGrid>
<div style="height: 5px;">
</div>
<asp:DropDownList ID="cmbRelationsExpensesCodes" runat="server">
</asp:DropDownList>
<asp:Button ID="btnRelationsExpensesCodesAdd" OnClick="btnRelationsExpensesCodesAdd_Click"
Text="Add" Width="80px" runat="server" />
<asp:Button ID="btnRelationsExpensesCodesDelete" OnClick="btnRelationsExpensesCodesDelete_Click"
Text="Remove" Width="80px" runat="server" />

</Template>
</ig:ItemTemplate>


</Templates>
</ignav:WebExplorerBar>

 

but now my application is not compiling because I can't find the controls within this WebExplorer, for instance "cmbRelationsExpensesCodes"

 

what am I doing wrong?

 

than you!


Parents
No Data
Reply
  • 7499
    Verified Answer
    posted

    Hello Nicole,

    The step 2 is the right way to add a template inside the WebExplorerBar, but you cannot access the controls inside the template using the ID. To access the webdatagrid inside the webexplorerbar use the following code

    WebDataGrid wdd = (WebDataGrid)this.WebExplorerBar2.Groups[0].Items[0].FindControl("WebDataGrid1") ;

    Please let me know if you have any questions

Children
No Data