I have a search function that searches the item inside the database and display the list of items in the rad grid.
The Grid has a edit (which generate by grid option). Everything is ok with the first page. When I click edit, it edits the right item.
When click to the second page, then click edit , the its edit the wrong item (keep edit the item on the first page instead of the second page).
for example
The grid show 25 items per page.
When click edit on the first item. It does the right item.
I go to the second page. Click on the 26th items. (first item of page 2). It show the edit form with the item to edit is the first one, not the 26th one.
Any ideas?
This is my search function:
protected void btnSearch_Click(object sender, EventArgs e)
{
String cmdString = null;
if (lstCat.SelectedValue == "All")
{
cmdString = "Select * FROM tblFood WHERE " + searchString(txtSearch.Text);
lblKeyword.Text = "";
}
else
{
cmdString = "Select * FROM tblFood WHERE (" + searchString(txtSearch.Text) + ") AND category = '" + lstCat.SelectedValue + "'";
lblKeyword.Text = "" ;
}
SqlDataSourceFood.SelectCommand = cmdString;
SqlDataSourceFood.DataBind();
GridFood.DataBind();
}
The Grid has a edit (which generate by grid option). Everything is ok with the first page. When I click edit, it edits the right item.
When click to the second page, then click edit , the its edit the wrong item (keep edit the item on the first page instead of the second page).
for example
The grid show 25 items per page.
When click edit on the first item. It does the right item.
I go to the second page. Click on the 26th items. (first item of page 2). It show the edit form with the item to edit is the first one, not the 26th one.
Any ideas?
This is my search function:
protected void btnSearch_Click(object sender, EventArgs e)
{
String cmdString = null;
if (lstCat.SelectedValue == "All")
{
cmdString = "Select * FROM tblFood WHERE " + searchString(txtSearch.Text);
lblKeyword.Text = "";
}
else
{
cmdString = "Select * FROM tblFood WHERE (" + searchString(txtSearch.Text) + ") AND category = '" + lstCat.SelectedValue + "'";
lblKeyword.Text = "" ;
}
SqlDataSourceFood.SelectCommand = cmdString;
SqlDataSourceFood.DataBind();
GridFood.DataBind();
}