Link to home
Start Free TrialLog in
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

ASKER CERTIFIED SOLUTION
Avatar of ororiole
ororiole
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial