This is something stupid on my side, but I can't figure it out....
I have given the user a checkbox - that when they check it, it will filter results in the entitygridview. It is set by default to be unchecked.
onCheckChanged event I run the code below. My problem is that it always seems to be one click behind. Thus, the first time I click the checkbox (cbToggleMappedDrugs.Checked = True)...the gridview data does not change (but in debug mode it does run the .Checked = true code). Then the next click is me unchecking the checkbox (cbToggleMappedDrugs.Checked = false)...and in debug mode it runs the else code. After the "else" logic runs, the gridview updates with the results from the first click...
if ( cbToggleMappedDrugs.Checked )
{
gvspSiteDrugs.Filter = "drugid is null";
gvspSiteDrugs.DataBind ();
gvSiteDrugs.DataBind ();
}
else
{
gvspSiteDrugs.Filter = "drugname like '%'";
gvspSiteDrugs.DataBind ();
gvSiteDrugs.DataBind ();
}
I hope I'm not confusing everyone too much... :) Basically it I'm
doing something wrong and the gridview update is always one click
behind. I've experienced this same issue in another page that i'm
filtering by certain keywords. It doesn't do anything with the first
keyword I filter by. But the second time a pass a keyword to filter
with...it will then update the gridview and display the results from
the 1st keyword filter. I know that the filter is working because if I
click on a gridview page number - it will then show the correctly
filtered gridview data...
ALSO, one more related question...
I'm using the gridviewsearchpanel as well with the entitygridview I spoke about before. What is the best way to handle filtering based on the checkbox above and the filter parameters the user provided in the search panel??
Thanks!!!
David