I have a local DB table that is displayed in a GridView. In that table, I have a column called: "Completed".
When I first display the table, I am displaying it without completed records (Completed=false). Here is the SqlDataSource select command:
"SELECT * FROM [CERecord] WHERE [Completed]='false' ORDER BY [Priority]";
I have a checkbox which causes postback. I want to toggle the display of Completed records by ticking / unticking it:
protected void cbShowCompletedRecords_CheckedChanged(object sender, EventArgs e)
{
if (cbShowCompletedRecords.Checked)
CEDatabaseSource.SelectCommand = "SELECT * FROM [CERecord] ORDER BY [Priority]";
else
{
CEDatabaseSource.SelectCommand = "SELECT * FROM [CERecord] WHERE [Completed]='false' ORDER BY [Priority]";
}
}
Currently, when I check the box, I get all the records. But when I uncheck it, the GridView doesn't update, even though the code above executes. What I am missing?
Rebindmethod after theif..elseblockGrid.Rebind()DataBind();?CEDatabaseSource.DataBind()and it doesn't change anything. Completed is bool in the db (well bit).WHERE [Completed]=0?