Hi,
I have a small search page that dumps it's results to a RadGrid. My search routine looks like this:
My initial databind seems to have correct DataKeys values in the grid, but when I do another search with new search field values, my new data appears OK, but the old Datakeys are still there. I for example found out that on initial pageload I have a DataKey value of 2000 in the 3rd item row in the grid, and when I do an new search, and the grid loads with the new data, I still have DataKey value 2000 in the 3rd item row.
This is how I am retrieving the Datakeys:
I am sure this is a simple beginner mistake. Please help.
reg.
Axel
I have a small search page that dumps it's results to a RadGrid. My search routine looks like this:
var searchResults = db.AbsenceSearch(txtIndividualSearchBox.Text.ToUpper(), |
ddlEnterprises.SelectedValue == "-1" || ddlEnterprises.SelectedValue == "" ? null : (int?)Convert.ToInt32(ddlEnterprises.SelectedValue), ddlDivisions.SelectedValue == "-1" || ddlDivisions.SelectedValue == "" ? null : (int?)Convert.ToInt32(ddlDivisions.SelectedValue), |
dateFrom, |
dateTo, |
reevaluationPeriod, |
cbIsOpen.Checked, |
userid).ToList(); |
RadGrid1.DataSource = searchResults; |
My initial databind seems to have correct DataKeys values in the grid, but when I do another search with new search field values, my new data appears OK, but the old Datakeys are still there. I for example found out that on initial pageload I have a DataKey value of 2000 in the 3rd item row in the grid, and when I do an new search, and the grid loads with the new data, I still have DataKey value 2000 in the 3rd item row.
This is how I am retrieving the Datakeys:
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
{ |
if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item || e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem) |
{ |
int eID = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["id"]; |
Response.Redirect(<to some page>); |
} |
} |
I am sure this is a simple beginner mistake. Please help.
reg.
Axel