private void BindProductData() { DataManager myData = new DataManager(DbFunctions.GetConnectionString()); MySqlConnection myPConn = myData.GetPooledConnection(new MySqlConnection()); DataSet productTable = new DataSet(); MySqlDataAdapter sAdapter; sAdapter = new MySqlDataAdapter("select * from productmast P Inner join productdetail V on P.productid=V.productid Inner join userpermission U on P.productid=U.productid where adminuserid = " + Session["AdminUserId"].ToString() + "", myPConn); sAdapter.Fill(productTable, "productmast"); if (productTable.Tables["productmast"].Rows.Count == 0) { LabelError.InnerText = "No Rows Found"; } else { Products.DataSource = productTable; } Products.DataBind(); myData.CloseConnection(myPConn); } protected void Products_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataManager myData = new DataManager(DbFunctions.GetConnectionString()); MySqlConnection myPConn = myData.GetPooledConnection(new MySqlConnection()); string strProductId = ((DataRowView)(e.Row.DataItem)).Row[0].ToString(); //Setup the Select Checkbox CheckBox chkSelect = (CheckBox)e.Row.FindControl("chkSelect"); if (chkSelect != null) { chkSelect.Checked = ShoppingCart.IsProductSelected((DataTable)Session["Admin_Order"], "productid", strProductId); } //Setup the Select Checkbox CheckBox chkEvalVersion = (CheckBox)e.Row.FindControl("ChkEvalVersion"); if (chkEvalVersion != null) { chkEvalVersion.Checked = ShoppingCart.IsEvalVersion(Session["Admin_Order"], "productid", strProductId); } //Setup the version DropDownList DropDownList ddlVersion = (DropDownList)e.Row.FindControl("ddlVersion"); if (ddlVersion != null) { MySqlDataReader productReader = null; myData.GetDataReader("productdetail", "productdetailid, version", "productid = " + TextUtilities.ToSql(strProductId, "N"), null, "productdetailid", ref productReader, myPConn); ddlVersion.DataSource = productReader; ddlVersion.DataBind(); ddlVersion.SelectedValue = ShoppingCart.GetSelectedProductDetailId((DataTable)Session["Admin_Order"], "productid", strProductId); } myData.CloseConnection(myPConn); } }
AutoPostBack = "true"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)