troubleshooting Question

ASP.net and XML in formview

Avatar of rwallacej
rwallacej asked on
XMLASP.NET
1 Comment1 Solution1163 ViewsLast Modified:
Hi all
I think one would be able to do this
Here's some obscurated XML to be displayed on a formview; formview is the choice so that user can navigate from record to record and only 1 record is dispalyed at a time (maybe another choice is better though).

I want a view that user can navigate through each "Test"

When user navigate from one to another test, Labels on the formview should update with the "Field" and "AnotherField" values.
A case of binding the asp:Lable text value to the XML innertext I would think? How to do I don't know

Thanks for help in advance
<?xml version="1.0" encoding="utf-8" ?>
<TheTopNode>
  <Test ID="1">
    <Field>1234</Field>
    <AnotherField>987</AnotherField>
  </Test>
  <Test ID="2">
    <Field>1234</Field>
    <AnotherField>987</AnotherField>
  </Test>
  <Test ID="3">
    <Field>1234</Field>
    <AnotherField>987</AnotherField>
  </Test>
</TheTopNode>
 
 
 
the following code displays only the ID; I want the other fields displayed on labels
<asp:FormView ID="FormView1" runat="server" AllowPaging="True" DataSourceID="XmlDataSource1">
        <EditItemTemplate>
            ID:
            <asp:TextBox ID="IDTextBox" runat="server" Text='<%# Bind("ID") %>' />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                Text="Update" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
                CommandName="Cancel" Text="Cancel" />
        </EditItemTemplate>
        <InsertItemTemplate>
            ID:
            <asp:TextBox ID="IDTextBox" runat="server" Text='<%# Bind("ID") %>' />
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                Text="Insert" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
                CommandName="Cancel" Text="Cancel" />
        </InsertItemTemplate>
        <ItemTemplate>
            ID:
            <asp:Label ID="IDLabel" runat="server" Text='<%# Bind("ID") %>' />
            <br />
            <asp:TextBox ID="TextBox3" runat="server" Text=""></asp:TextBox>
        </ItemTemplate>
    </asp:FormView>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros