• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 589
  • Last Modified:

XmlDataSource FindControl within FormView and TabContainer

I have a Gridview displaying data from a xml datasource that I am populating in codebehind which displays the data if placed in a plain web page but I need to add the data within a FormView and TabContainer. When I add the gridview inside the Formview nothing is displayed.

I have other Datalist and Gridviews within the formview and inside tabcontainers which all display ok using the following findcontrol

            DataList CostOnSiteDataList = (DataList)PropertyForm.FindControl("propertycontainer").FindControl("Panel2").FindControl("COSDataList");


This is the Gridview;

                                                         <asp:GridView ID="COSGridView" DataSourceID="XmlDataSourceCOS" GridLines="None" runat="server" Width="100%" AutoGenerateColumns="false" BackColor="#FFFFFF" ShowHeader="False">
                                                                        <AlternatingRowStyle/>
                                                                        <Columns>
                                                                        <asp:TemplateField>
                                                                        <ItemTemplate>
                                                                        <table width="100%">
                                                                        <tr valign="top">
                                                                        <td align="left">
                                                                        <asp:Label ID="Costs_Description_Label" runat="server" CssClass="pdheading" Text='<%# XPath("Description") %>' /><br />
                                                                        </td>
                                                                        <td align="right">
                                                                        <asp:Label ID="Costs_Value_Label" runat="server" CssClass="pdheading" Text='<%# XPath("Value") %>' />
                                                                        </td>
                                                                        </tr>
                                                                        </table>
                                                                        </ItemTemplate>
                                                                        </asp:TemplateField>
                                                                        </Columns>
                                                                </asp:GridView>
   
    <asp:XmlDataSource ID="XmlDataSourceCOS" EnableCaching="false" runat="server" XPath="//COS" />


and the code behind data tag which loadsa the data when the gridview is outside of the formview.

             XmlDataSourceCOS.Data = root9.OuterXml;


FormView;

                                <asp:FormView ID="PropertyForm" runat="server" Width="100%" CellSpacing="3">
                                <ItemTemplate>
    <cc1:tabcontainer runat="server" id="propertycontainer" width="955px" cssclass="mytabs" onclientactivetabchanged="ActiveTabChanged">
        <cc1:TabPanel runat="Server" ID="Panel1" HeaderText="Information">
            <ContentTemplate>
                <ItemTemplate>
0
chrispaton
Asked:
chrispaton
  • 2
1 Solution
 
Bob LearnedCommented:
If you move a control inside of another naming container, then it would change the behavior for FindControl, which might be the reason for your problems...
0
 
chrispatonAuthor Commented:
In the end I had to remove the formview and change the page design as this was the only way I could get this to work properly
0
 
chrispatonAuthor Commented:
The suggestion made did not work as the item was still not displaying data on the page
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now