S
Scott
I am trying to sort a datagrid which contains 5 checkbox columns. All
other columns sort properly except these 5 checkbox columns which dont
sort at all.
I am using ASP.NET 1.1 and this code is located in a user control.
The code snippet for binding the checkbox control is as follows and is
found in the ItemDataBound event for the datagrid. It appears that
the index value never changes...it always seems to reference the
orginal dataset index.
Any help would be greatly appreciated.
try
{
System.Web.UI.WebControls.Image img1 =
(System.Web.UI.WebControls.Image)e.Item.Cells[7].Controls[1];
int iIndx = e.Item.DataSetIndex;
/*
0 Disabled
1 Approved
2 Waiting For Approval
3 Rejected
4 Locked
*/
int iResultSR = dsListBuilders.Tables["bb_saved_builders"].Rows[iIndx]
["sales_rep_approved"].ToString() == string.Empty?
2:int.Parse(dsListBuilders.Tables["bb_saved_builders"].Rows[iIndx]
["sales_rep_approved"].ToString());
switch(iResultSR)
{
case 0:
img1.ImageUrl="../../images/greybox.gif";
break;
case 1:
img1.ImageUrl="../../images/checkboxyes.gif";
break;
case 2:
img1.ImageUrl="../../images/checkboxno.gif";
break;
case 3:
img1.ImageUrl="../../images/redcheckboxno.gif";
break;
case 4:
img1.ImageUrl="../../images/lock.gif";
break;
default:
img1.ImageUrl="../../images/checkboxno.gif";
break;
}
}
catch(Exception exBinding1)
{
//ignore...
}
other columns sort properly except these 5 checkbox columns which dont
sort at all.
I am using ASP.NET 1.1 and this code is located in a user control.
The code snippet for binding the checkbox control is as follows and is
found in the ItemDataBound event for the datagrid. It appears that
the index value never changes...it always seems to reference the
orginal dataset index.
Any help would be greatly appreciated.
try
{
System.Web.UI.WebControls.Image img1 =
(System.Web.UI.WebControls.Image)e.Item.Cells[7].Controls[1];
int iIndx = e.Item.DataSetIndex;
/*
0 Disabled
1 Approved
2 Waiting For Approval
3 Rejected
4 Locked
*/
int iResultSR = dsListBuilders.Tables["bb_saved_builders"].Rows[iIndx]
["sales_rep_approved"].ToString() == string.Empty?
2:int.Parse(dsListBuilders.Tables["bb_saved_builders"].Rows[iIndx]
["sales_rep_approved"].ToString());
switch(iResultSR)
{
case 0:
img1.ImageUrl="../../images/greybox.gif";
break;
case 1:
img1.ImageUrl="../../images/checkboxyes.gif";
break;
case 2:
img1.ImageUrl="../../images/checkboxno.gif";
break;
case 3:
img1.ImageUrl="../../images/redcheckboxno.gif";
break;
case 4:
img1.ImageUrl="../../images/lock.gif";
break;
default:
img1.ImageUrl="../../images/checkboxno.gif";
break;
}
}
catch(Exception exBinding1)
{
//ignore...
}