Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Data Schema to GridView ASP.NET/VB.NET Dup data

  • 07-02-2007 08:20PM
    #1
    Registered Users, Registered Users 2 Posts: 8,590 ✭✭✭


    I have a Web Service that populates a .xsd files.

    When I run the web service on its own. Everything is fine.

    But when i call it from the front page all the data is duplicated in the grid view.

    Is there any reason why this is happening.

    Lines of code below populate the gridview
    
            grv.DataSource = xsd.Table1
            grv.DataBind()
    
    


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Can you post the html for the gridview as well? That's the aspx file as apposed to the aspx.vb file.


  • Registered Users, Registered Users 2 Posts: 8,590 ✭✭✭Trampas


    <asp:GridView ID="grv" runat="server">
    <Columns>
    <asp:BoundField DataField="Day" HeaderText="Day"/>
    <asp:BoundField DataField="Dat" HeaderText="Date"/>
    <asp:BoundField DataField="Month" HeaderText="Month" />
    </Columns>
    </asp:GridView>


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    I think I'll also need the xsd file too and can you give the code for the complete function that contains the databinding code in your first post? :)


  • Registered Users, Registered Users 2 Posts: 8,590 ✭✭✭Trampas


    
    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema id="xsd1" targetNamespace="http://tempuri.org/xsd1.xsd" xmlns:mstns="http://tempuri.org/xsd1.xsd" xmlns="http://tempuri.org/xsd1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
      <xs:element name="xsd1" msdata:IsDataSet="true">
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="Table1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="Day" type="xs:string" minOccurs="0" />
                  <xs:element name="Dat" type="xs:string" minOccurs="0" />
                  <xs:element name="Month" type="xs:string" minOccurs="0" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:choice>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    
    
    <asp:GridView ID="grv" runat="server">
    <Columns>
    <asp:BoundField DataField="Day" HeaderText="Day"/>
    <asp:BoundField DataField="Dat" HeaderText="Date"/>
    <asp:BoundField DataField="Month" HeaderText="Month" />
    </Columns>
    </asp:GridView>
    
            grv.DataSource = xsd1.Table1
            grv.DataBind()
    
    

    When I do the following
    
     For Each row In xsd1.Table1
                Dim strText As String
    
                strText = CStr(row("Day"))
            Next
    
    

    It doesn't dup the result.

    here is a snip of the results in the schema.

    thanks
    
    - <Table1 diffgr:id="Table13" msdata:rowOrder="2" diffgr:hasChanges="inserted">
       <Day>Thu</Day> 
      <Dat>15</Dat> 
      <Month>Feb</Month> 
      </Table1>
    
    
    


Advertisement