C# 输入字符串格式不正确查询字符串datalist购物车

C# 输入字符串格式不正确查询字符串datalist购物车,c#,asp.net,query-string,shopping-cart,datalist,C#,Asp.net,Query String,Shopping Cart,Datalist,我正在尝试使用Devart LinqConnect(Linq to Mysql)在asp.net C#和Mysql中创建一个购物车web应用程序 当选择类别显示ShowProducts.aspx页面中的相应产品时,我在层次结构中有类别。我添加了一个datalist,它从查询字符串值获取数据 我已经分配给每个类别,比如男士衬衫类别,我给了超链接Id,比如 <li><a href="ShowProducts.aspx?id=8">Mens</a><span

我正在尝试使用Devart LinqConnect(Linq to Mysql)在asp.net C#和Mysql中创建一个购物车web应用程序

当选择类别显示ShowProducts.aspx页面中的相应产品时,我在层次结构中有类别。我添加了一个datalist,它从查询字符串值获取数据

我已经分配给每个类别,比如男士衬衫类别,我给了超链接Id,比如

<li><a href="ShowProducts.aspx?id=8">Mens</a><span class="rarrow">&#9654;</span>
                        <ul class="sub2">
                            <li><a href="ShowProducts.aspx?id=9">Shirts</a></li>
这是我在ShowProducts.aspx中的数据绑定:

 <asp:LinqDataSource ID="LinqDataSourceProducts" runat="server" ContextTypeName="ShoppingContext.ShoppingDataContext"
    EntityTypeName="" Select="new (ProductName, ProductUnitPrice, ProductBrand, Category, ParentID, ProductImage, ProductID)"
    TableName="Products" Where="ParentID == @ParentID1">
    <WhereParameters>
        <asp:QueryStringParameter DefaultValue="0" Name="ParentID1" QueryStringField="id"
            Type="Int64" />
    </WhereParameters>
</asp:LinqDataSource>
<asp:DataList ID="DataListProducts" runat="server" DataSourceID="LinqDataSourceProducts" 
    RepeatDirection="Horizontal" RepeatColumns="4" 
Style="margin-left: 87px" CellSpacing="50"
    CellPadding="50" onitemcommand="DataListProducts_ItemCommand">
    <ItemTemplate>
        <table style="border:5px dotted #c0c0c0">
            <tr>
                <td>
                    <asp:ImageButton ID="ImageButton1" ImageUrl='<%# GetImage(Eval("ProductImage")) %>'
                        runat="server" Width="250px" Height="270px" />
                    <br />
                    <center>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("ProductID") %>'></asp:Label>
                        <asp:Label ID="LabelProductName" runat="server" Text='<%# Eval("ProductName") %>'></asp:Label><hr />
                    </center>
                    By : &nbsp;<b><asp:Label ID="Label2" runat="server" Text='<%# Eval("ProductBrand") %>'></asp:Label></b><br />
                    <asp:Button ID="ButtonAddToCart" runat="server" Text="Add To Cart" CommandName="AddToCart" CommandArgument='<%# Eval("ProductID") %>'
                        Style="padding-top: 3px; left: 5px" />
                </td>
            </tr>
        </table>
    </ItemTemplate>
</asp:DataList>



作者:
请任何人对此都有答案。。。
请帮助..

传递给Convert.ToInt32的值之一不是数字,因此会失败

e.CommandArgument.ToString()
or
DataListProducts.DataKeyField[RowClicked]

请你再检查一下我的问题,我已经编辑好了,下一行有错误。。。
e.CommandArgument.ToString()
or
DataListProducts.DataKeyField[RowClicked]