protected void RadComboBoxDiagnosis_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{
string app = string.Empty;
if (e.Text.Length > 0)
{
app =
"DESCRIPTION LIKE '" + e.Text.Replace("'", "''") + '%' + "' AND";
}
string diagnosisData = "select DESCRIPTION,FK_CODE_VALUE,PK_ALL_CODE_DESC_ID from M_ALL_CODES_DESC WHERE " + app + " STATUS=1 order by DESCRIPTION ";
DataTable rowsCount = SqlHelper.ExecuteDataset(new Connection().GetCon, CommandType.Text, diagnosisData).Tables[0];
int itemsPerRequest = 10;
int itemOffset = e.NumberOfItems;
int endOffset = itemOffset + itemsPerRequest;
string text = e.Text;
DataRow[] rows = rowsCount.Select();
if (endOffset > rows.Length)
{
endOffset = rows.Length;
}
RadComboBoxDiagnosis.ClearSelection();
RadComboBoxDiagnosis.Items.Clear();
string diagnosisData1 = "select top " + endOffset + " DESCRIPTION,FK_CODE_VALUE,PK_ALL_CODE_DESC_ID from M_ALL_CODES_DESC WHERE " + app + " STATUS=1 order by DESCRIPTION ";
DataTable dtData = SqlHelper.ExecuteDataset(new Connection().GetCon, CommandType.Text, diagnosisData1).Tables[0];
RadComboBoxDiagnosis.DataTextField =
"DESCRIPTION";
RadComboBoxDiagnosis.DataValueField =
"FK_CODE_VALUE";
RadComboBoxDiagnosis.DataSource = dtData;
RadComboBoxDiagnosis.DataBind();
e.Message = GetStatusMessage(endOffset, rowsCount.Rows.Count);
}
first 10 records shows in combo but when i click for next 10 then e.NumberOfItems changes 20 ,previous items will be there ,it shows duplicates values and NumberOfItems will be 40 due to that duplicate value.
Plz help me.