Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

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

  • 07-02-2007 7:20pm
    #1
    Registered Users, Registered Users 2 Posts: 7,987 ✭✭✭


    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: 7,987 ✭✭✭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: 7,987 ✭✭✭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