开发者

Object must implement IConvertible Error with List

I posted a question earlier about a using a list to store data then pass it through a session variable I have this code so far:

Default page:

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)              
{
    var basketItems = new List<int>();
    basketItems.Add(1);//I need to get the ID of the book I am selecting from the gridView
    Session["BasketList"] = basketItems;
    Response.Redirect("Basket.aspx");           
}

Basket Page:

protected void Page_Init(object sender, EventArgs e)       
{
    var basketListItems = (List<int>)Session["BasketList"];          
}

Then I have a gridView control on the basket page using this syntax:

SelectCommand="SELECT * FROM [tblBook] WHERE ([BookID] = ?)">

I thought this would match the bookID from the database to whatever the ID from the bookID in the gridView is, then output the books.

Basically I need to be able to click select on the gridview and then take the id of the book that has been clicked and then send it to the basket page where the book info can be dis开发者_如何学JAVAplayed from the book table.


Use generic version of List instead List<int>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜