This question is locked. New answers and comments are not allowed.
Hi,
I am using telerik combo box in my application. I fill combo box using service. I want to restrict user to enter any characters in combo box after selecting from dropdown. please suggest me is there any properties to disable.
here is my code:
<telerik:RadComboBox ID="comsystemstatus" runat="server" EmptyMessage="Select" EnableLoadOnDemand="true"
ShowMoreResultsBox="true" AllowCustomText="false"
EnableVirtualScrolling="true">
<WebServiceSettings Method="GetFaci_SystemStatus" Path="CaseService.asmx" />
</telerik:RadComboBox>
and my service:
[WebMethod]
public RadComboBoxData GetFaci_SystemStatus(RadComboBoxContext context)
{
EDSMESS_User_Information EDSMESS_User = new EDSMESS_User_Information();
string query = "";
query += "SELECT distinct Faci_SystemStatus FROM FACI where Faci_SystemStatus LIKE '" + context.Text + "' + '%' and Faci_SystemStatus Is Not Null ";
DataSet ds = new DataSet();
ds = EDSMESS_User.GetEDSMESSData(query);
List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(context.NumberOfItems);
RadComboBoxData comboData = new RadComboBoxData();
try
{
int itemsPerRequest = 10;
int itemOffset = context.NumberOfItems;
int endOffset = itemOffset + itemsPerRequest;
if (endOffset > ds.Tables[0].Rows.Count)
{
endOffset = ds.Tables[0].Rows.Count;
}
if (endOffset == ds.Tables[0].Rows.Count)
{
comboData.EndOfItems = true;
}
else
{
comboData.EndOfItems = false;
}
result = new List<RadComboBoxItemData>(endOffset - itemOffset);
for (int i = itemOffset; i < endOffset; i++)
{
RadComboBoxItemData itemData = new RadComboBoxItemData();
itemData.Text = ds.Tables[0].Rows[i]["Faci_SystemStatus"].ToString();
itemData.Value = ds.Tables[0].Rows[i]["Faci_SystemStatus"].ToString();
result.Add(itemData);
}
if (ds.Tables[0].Rows.Count > 0)
{
comboData.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), ds.Tables[0].Rows.Count);
}
else
{
comboData.Message = "No matches";
}
}
catch (Exception e)
{
comboData.Message = e.Message;
}
comboData.Items = result.ToArray();
return comboData;
}
I am using telerik combo box in my application. I fill combo box using service. I want to restrict user to enter any characters in combo box after selecting from dropdown. please suggest me is there any properties to disable.
here is my code:
<telerik:RadComboBox ID="comsystemstatus" runat="server" EmptyMessage="Select" EnableLoadOnDemand="true"
ShowMoreResultsBox="true" AllowCustomText="false"
EnableVirtualScrolling="true">
<WebServiceSettings Method="GetFaci_SystemStatus" Path="CaseService.asmx" />
</telerik:RadComboBox>
and my service:
[WebMethod]
public RadComboBoxData GetFaci_SystemStatus(RadComboBoxContext context)
{
EDSMESS_User_Information EDSMESS_User = new EDSMESS_User_Information();
string query = "";
query += "SELECT distinct Faci_SystemStatus FROM FACI where Faci_SystemStatus LIKE '" + context.Text + "' + '%' and Faci_SystemStatus Is Not Null ";
DataSet ds = new DataSet();
ds = EDSMESS_User.GetEDSMESSData(query);
List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(context.NumberOfItems);
RadComboBoxData comboData = new RadComboBoxData();
try
{
int itemsPerRequest = 10;
int itemOffset = context.NumberOfItems;
int endOffset = itemOffset + itemsPerRequest;
if (endOffset > ds.Tables[0].Rows.Count)
{
endOffset = ds.Tables[0].Rows.Count;
}
if (endOffset == ds.Tables[0].Rows.Count)
{
comboData.EndOfItems = true;
}
else
{
comboData.EndOfItems = false;
}
result = new List<RadComboBoxItemData>(endOffset - itemOffset);
for (int i = itemOffset; i < endOffset; i++)
{
RadComboBoxItemData itemData = new RadComboBoxItemData();
itemData.Text = ds.Tables[0].Rows[i]["Faci_SystemStatus"].ToString();
itemData.Value = ds.Tables[0].Rows[i]["Faci_SystemStatus"].ToString();
result.Add(itemData);
}
if (ds.Tables[0].Rows.Count > 0)
{
comboData.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), ds.Tables[0].Rows.Count);
}
else
{
comboData.Message = "No matches";
}
}
catch (Exception e)
{
comboData.Message = e.Message;
}
comboData.Items = result.ToArray();
return comboData;
}