Assume cmbSectionTitle is my RadComboBox. I need to do the following operations in JavaScript or with page post back.
cmbSectionTitle.DataSource =
null;
cmbSectionTitle.Text =
string.Empty;
Could you please help me out....
Thanks,
--Srinath
3 Answers, 1 is accepted
Apparently you are trying to clear your combo from items as we as clearing text from InputArea... I've done something similar (JavaScript) like this:
| function pageLoad() { |
| myCombo = $find("<%= rcb_TargetCombo.ClientID %>"); |
| myCombo.clearSelection(); // Reset InputArea, selectedItem, selectedIndex, etc... to null |
| myCombo.clearItems(); // Remove all combo items |
| } |
Hope this helps.
Regards,
Saed
Thanks for your previous post.
Sample Code: ascx
--------------------------
<
telerik:RadCodeBlock ID="rdAuthor" runat="server">
<div class="catalog">
<telerik:RadAjaxPanel ID="upnlAuthor" EnableHistory="true" EnableViewState="true" runat="server" LoadingPanelID="LoadingPanel2"
EnableOutsideScripts="true" EnableAJAX="true" >
<asp:HiddenField ID="hdnTest" runat="server" />
<td class="field" style="width: 105px;">
<asp:DropDownList runat="server" ID="ddlSearchAuthor" Width="100px" AutoPostBack="true" CssClass="selectinput" OnSelectedIndexChanged="ddlSearchAuthor_SelectedIndexChanged" >
<asp:ListItem Text="--Search on--" Value="Search on" ></asp:ListItem>
<asp:ListItem Text="First Name" Value="firstname"></asp:ListItem>
<asp:ListItem Text="Last Name" Value="lastname"></asp:ListItem>
<asp:ListItem Text="Display Name" Value="displayname"></asp:ListItem>
<asp:ListItem Text="Author ID" Value="authorID"></asp:ListItem>
</asp:DropDownList>
</td>
<td class="field" style="width: 310px;">
<telerik:RadComboBox id="cmbSectionTitle"
EnableLoadOnDemand="True"
EnableVirtualScrolling="false"
ShowToggleImage="false"
Runat="server"
Height="140px"
Width="250px"
OnItemsRequested="cmbSectionTitle_ItemsRequested"
ShowDropDownOnTextboxClick ="false"
CloseDropDownOnBlur = "true"
Filter="StartsWith"
OnSelectedIndexChanged="cmbSectionTitle_SelectedIndexChanged"
OnTextChanged="cmbSectionTitle_TextChanged" ShowMoreResultsBox="true" >
</telerik:RadComboBox>
</td>
</telerik:RadAjaxPanel >
</telerik:RadCodeBlock>
==========================================
ascx.cs
=========================================
protected void cmbSectionTitle_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{
try
{
if (hdnTest.Value != "Search on") /// This is empty always :(
{
///do some thing
}
}
}
The above hdnTest is set to chagned value in dropdown... ddlSearchAuthor in Javascript.
But in CS the value of hdnTest is showing up as EMPTY :(
What could be the reason. Please help me out.
Another thing: I noted you are using asp DropDownList. Handling PopoulateOnDemand is perfectly accomplished with RadComboBox. Consequently, utilising context is granted with RadComboBox but not sure about asp DDL. Why are you mixing controls like this? Couldn't you use RadCombos all the way?
Finally, an advice: When composing messages here, your could use Format Code Block button to insert your code, rather than just copy and paste code into message body. Try it and see how handy it is.
Hope this helps.
Regards,
Saed