未将对象引用设置到对象实例问题
在前台页面我放了imagebutton<asp:ImageButton ID="ImageButton2" runat="server" CommandName="detailSee" CommandArgument =<%#DataBinder.Eval(Container.DataItem,"BookID") %> ImageUrl='<%#DataBinder.Eval(Container.DataItem,"BookUrl") %>'Width="100%" onclick="ImageButton2_Click" />通过CommandArgument =<%#DataBinder.Eval(Container.DataItem,"BookID") %>绑定数据库的商品id
我想通过这个图片按钮查看商品的详细信息。
程序代码: public void GetGoodsInfo()
{
string strSql = "select * from tb_BookInfo where BookID=" + Convert.ToInt32(Request["id"].Trim());//断点调试这里的值是null 没获取到商品的id
SqlCommand myCmd = dbObj.GetCommandStr(strSql);
DataTable dsTable = dbObj.GetDataSetStr(strSql, "tbBI");
this.txtCategory.Text = gcObj.GetClass(Convert.ToInt32(dsTable.Rows[0]["ClassID"].ToString()));
this.txtName.Text = dsTable.Rows[0]["BookName"].ToString();
this.txtAuthor.Text = dsTable.Rows[0]["Author"].ToString();
this.txtCompany.Text = dsTable.Rows[0]["Company"].ToString();
this.txtMarketPrice.Text = dsTable.Rows[0]["MarketPrice"].ToString();
this.txtHotPrice.Text = dsTable.Rows[0]["HotPrice"].ToString();
this.ImageMapPhoto.ImageUrl = dsTable.Rows[0]["BookUrl"].ToString();
this.cbxCommend.Checked = bool.Parse(dsTable.Rows[0]["Isrefinement"].ToString());
this.cbxHot.Checked = bool.Parse(dsTable.Rows[0]["IsHot"].ToString());
this.cbxDiscount.Checked = bool.Parse(dsTable.Rows[0]["IsDiscount"].ToString());
this.txtShortDesc.Text = dsTable.Rows[0]["BookIntroduce"].ToString();
}是我传值的方式错了还是怎么回事?


