Avatar of rwallacej
rwallacej asked on

ASP.net and XML in formview

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>

Open in new window

ASP.NETXML

Avatar of undefined
Last Comment
ororiole

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
ororiole

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Your help has saved me hundreds of hours of internet surfing.
fblack61