any idea why the following throws a System.ArgumentException: Parameter is not valid.? basically, I have a grid, that when I click on the thumbnail, opens a radwindow which loads a page with the below code to generate a radrotator with a radbinary as an inner control. (first few lines are just retrieving the binary image data from the database, in this case sql server 2008, using the enterprise library.)
if (!string.IsNullOrEmpty(Request.QueryString["productID"])) |
{ |
Database db = DatabaseFactory.CreateDatabase("sql"); |
DbCommand mycommand = db.GetSqlStringCommand("SELECT mediaID,imageFull FROM core.productMedia WHERE (productID = @productID AND active=1 AND removed=0)"); |
db.AddInParameter(mycommand, "productID", DbType.Int32, Request.QueryString["productID"]); |
DataTable mytable = db.ExecuteDataSet(mycommand).Tables[0]; |
Debug.WriteLine("number of media " + mytable.Rows.Count.ToString()); |
if (mytable.Rows.Count > 0) |
{ |
RadRotator myrot = new RadRotator(); |
foreach (DataRow myrow in mytable.Rows) |
{ |
RadBinaryImage myimg = new RadBinaryImage(); |
myimg.DataValue = (byte[])myrow[1]; |
Debug.WriteLine("media " + myrow[0].ToString()); |
RadRotatorItem myitem = new RadRotatorItem(); |
myitem.Controls.Add(myimg); |
myrot.Items.Add(myitem); |
} |
Panel1.Controls.Add(myrot); |
} |
} |