troubleshooting Question

asp.net datalist control

Avatar of newbie27
newbie27Flag for United Kingdom of Great Britain and Northern Ireland asked on
ASP.NETMicrosoft SQL Server 2005
1 Comment1 Solution527 ViewsLast Modified:
Hello Experts,

I am trying to understand how these are tied together. Can someone please let me know what would be need of storing SQL queries in the
xsd and then calling on the page , if this is what it is doing?

please advice

thanks
sam
<asp:DataList ID="DataList1" runat="server" DataSourceID="dsProductRanking" RepeatColumns="2" HorizontalAlign="Center" RepeatDirection="Horizontal" CellSpacing="5" CellPadding="0">
                    <ItemTemplate>
                        <asp:Panel ID="pnlProduct" runat="server" BorderColor="Transparent" Height="120px" Width="250px">
                        <table width="250">
                            <tr>
                                <td align="center" width="102" valign="top">
                                    <asp:HyperLink ID="lnkProductImage" runat="server" ImageUrl='<%# "~/images/thumbnails/" & Eval("ProdImg") %>' NavigateUrl='<%# "Product.aspx?ProdID=" & Eval( "ProdID") %>' Text='<%# Eval("ProdName") %>'></asp:HyperLink></td>
                                <td style="width: 3px">&nbsp;</td>
                                <td align="left" valign="top" width="145">                                    
                                    <asp:Hyperlink ID="lnkProdName" runat="server" NavigateUrl='<%# "Product.aspx?ProdID=" & DataBinder.Eval(Container.DataItem, "ProdID") %>' Text='<%# DataBinder.Eval(Container.DataItem, "ProdName") %>' Font-Bold="True" ForeColor="#404040" /><br />
                                    <asp:Image ID="imgProdNameSpacer" runat="server" ImageUrl="~/images/spacer.gif" Height="5" /><br />
                                    <asp:Label ID="lblShortDesc" runat="server" Text='<%# Eval("ProdOneLiner") %>' Font-Size="8pt" ForeColor="DimGray"  /><br />
                                    <asp:Image ID="imgProdShorDescSpacer" runat="server" ImageUrl="~/images/spacer.gif" Height="5" /><br />
                                    <asp:Label ID="lblPrice" runat="server" Text='<%# WebFunctions.ShowAsPounds(DataBinder.Eval(Container.DataItem, "ProdPrice")) %>' Font-Bold="True" ForeColor="Gray" />
                                </td>
                            </tr>
                        </table>
             </asp:Panel>
       </ItemTemplate>
 </asp:DataList>
 
 
<asp:ObjectDataSource ID="dsProductRanking" runat="server" SelectMethod="GetTop10WebOrderProducts"
                    TypeName="ProductRankingClass" OldValuesParameterFormatString="original_{0}"></asp:ObjectDataSource>
 
 
dsProductRanking.xsd
------------------------
 
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="dsProductRanking" targetNamespace="http://tempuri.org/ProductRanking.xsd" xmlns:mstns="http://tempuri.org/ProductRanking.xsd" xmlns="http://tempuri.org/ProductRanking.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:annotation>
    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
      <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
        <Connections>
          <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="GFConnectionString" ConnectionStringObject="" IsAppSettingsProperty="True" Modifier="Assembly" Name="GFConnectionString (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.GFConnectionString.ConnectionString" Provider="System.Data.SqlClient">
          </Connection>
        </Connections>
        <Tables>
          <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="ProductRankingTableAdapter" GeneratorDataComponentClassName="ProductRankingTableAdapter" Name="ProductRanking" UserDataComponentName="ProductRankingTableAdapter">
            <MainSource>
              <DbSource ConnectionRef="GFConnectionString (Web.config)" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="False" GeneratorGetMethodName="GetTop8WebOrderProducts" GetMethodModifier="Public" GetMethodName="GetTop8WebOrderProducts" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="GetTop8WebOrderProducts" UserSourceName="GetTop8WebOrderProducts">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT TOP (8) ProductRanking.ProdID, ProductRanking.Ranking, ProductRanking.ProdImg, Product.ProdName, Product.ProdPrice, Product.ProdShortDesc, Product.ProdOneLiner FROM ProductRanking INNER JOIN Product ON ProductRanking.ProdID = Product.ProdID</CommandText>
                    <Parameters>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </MainSource>
            <Mappings>
              <Mapping SourceColumn="ProdID" DataSetColumn="ProdID" />
              <Mapping SourceColumn="Ranking" DataSetColumn="Ranking" />
              <Mapping SourceColumn="ProdImg" DataSetColumn="ProdImg" />
              <Mapping SourceColumn="ProdName" DataSetColumn="ProdName" />
              <Mapping SourceColumn="ProdPrice" DataSetColumn="ProdPrice" />
              <Mapping SourceColumn="ProdShortDesc" DataSetColumn="ProdShortDesc" />
              <Mapping SourceColumn="ProdOneLiner" DataSetColumn="ProdOneLiner" />
            </Mappings>
            <Sources>
              <DbSource ConnectionRef="GFConnectionString (Web.config)" DbObjectType="Unknown" FillMethodModifier="Public" FillMethodName="GetTop10WebOrderProducts1" GenerateMethods="Both" GenerateShortCommands="True" GeneratorGetMethodName="GetTop10WebOrderProducts" GeneratorSourceName="GetTop10WebOrderProducts1" GetMethodModifier="Public" GetMethodName="GetTop10WebOrderProducts" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetTop10WebOrderProducts" UserSourceName="GetTop10WebOrderProducts1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT TOP (10) ProductRanking.ProdID, ProductRanking.Ranking, ProductRanking.ProdImg, Product.ProdName, Product.ProdPrice, Product.ProdShortDesc, Product.ProdOneLiner 
FROM ProductRanking INNER JOIN Product ON ProductRanking.ProdID = Product.ProdID
ORDER BY Ranking</CommandText>
                    <Parameters>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="GFConnectionString (Web.config)" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetTop4WebOrderPro`ducts" GetMethodModifier="Public" GetMethodName="GetTop4WebOrderProducts" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetTop4WebOrderProducts" UserSourceName="GetTop4WebOrderProducts1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT TOP (4) ProductRanking.ProdID, ProductRanking.Ranking, ProductRanking.ProdImg, Product.ProdName, Product.ProdPrice, Product.ProdShortDesc, Product.ProdOneLiner FROM ProductRanking INNER JOIN Product ON ProductRanking.ProdID = Product.ProdID
ORDER BY ProductRanking.Ranking</CommandText>
                    <Parameters>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
              <DbSource ConnectionRef="GFConnectionString (Web.config)" DbObjectType="Unknown" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetTop9WebOrderProducts" GetMethodModifier="Public" GetMethodName="GetTop9WebOrderProducts" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="True" UserGetMethodName="GetTop9WebOrderProducts" UserSourceName="GetTop9WebOrderProducts1">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT     TOP (9) ProductRanking.ProdID, ProductRanking.Ranking, ProductRanking.ProdImg, Product.ProdName, Product.ProdPrice, 
                      Product.ProdShortDesc
FROM         ProductRanking INNER JOIN
                      Product ON ProductRanking.ProdID = Product.ProdID</CommandText>
                    <Parameters>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </Sources>
          </TableAdapter>
        </Tables>
        <Sources>
        </Sources>
      </DataSource>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="dsProductRanking" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="dsProductRanking" msprop:Generator_DataSetName="dsProductRanking">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="ProductRanking" msprop:Generator_UserTableName="ProductRanking" msprop:Generator_RowDeletedName="ProductRankingRowDeleted" msprop:Generator_RowChangedName="ProductRankingRowChanged" msprop:Generator_RowClassName="ProductRankingRow" msprop:Generator_RowChangingName="ProductRankingRowChanging" msprop:Generator_RowEvArgName="ProductRankingRowChangeEvent" msprop:Generator_RowEvHandlerName="ProductRankingRowChangeEventHandler" msprop:Generator_TableClassName="ProductRankingDataTable" msprop:Generator_TableVarName="tableProductRanking" msprop:Generator_RowDeletingName="ProductRankingRowDeleting" msprop:Generator_TablePropName="_ProductRanking">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ProdID" msprop:Generator_UserColumnName="ProdID" msprop:Generator_ColumnPropNameInRow="ProdID" msprop:Generator_ColumnVarNameInTable="columnProdID" msprop:Generator_ColumnPropNameInTable="ProdIDColumn">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="30" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Ranking" msprop:Generator_UserColumnName="Ranking" msprop:Generator_ColumnPropNameInRow="Ranking" msprop:Generator_ColumnVarNameInTable="columnRanking" msprop:Generator_ColumnPropNameInTable="RankingColumn" type="xs:int" />
              <xs:element name="ProdImg" msprop:Generator_UserColumnName="ProdImg" msprop:Generator_ColumnPropNameInRow="ProdImg" msprop:Generator_ColumnVarNameInTable="columnProdImg" msprop:Generator_ColumnPropNameInTable="ProdImgColumn" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="100" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="ProdName" msprop:Generator_UserColumnName="ProdName" msprop:Generator_ColumnPropNameInRow="ProdName" msprop:Generator_ColumnVarNameInTable="columnProdName" msprop:Generator_ColumnPropNameInTable="ProdNameColumn">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="100" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="ProdPrice" msprop:Generator_UserColumnName="ProdPrice" msprop:Generator_ColumnVarNameInTable="columnProdPrice" msprop:Generator_ColumnPropNameInRow="ProdPrice" msprop:Generator_ColumnPropNameInTable="ProdPriceColumn" type="xs:decimal" />
              <xs:element name="ProdShortDesc" msprop:Generator_UserColumnName="ProdShortDesc" msprop:Generator_ColumnVarNameInTable="columnProdShortDesc" msprop:Generator_ColumnPropNameInRow="ProdShortDesc" msprop:Generator_ColumnPropNameInTable="ProdShortDescColumn" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="2147483647" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="ProdOneLiner" msprop:Generator_UserColumnName="ProdOneLiner" msprop:Generator_ColumnVarNameInTable="columnProdOneLiner" msprop:Generator_ColumnPropNameInRow="ProdOneLiner" msprop:Generator_ColumnPropNameInTable="ProdOneLinerColumn" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="100" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
    <xs:unique name="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//mstns:ProductRanking" />
      <xs:field xpath="mstns:Ranking" />
    </xs:unique>
  </xs:element>
</xs:schema>
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