RADCombobox is used in user control.
<telerik:RadComboBox ID="ddlCustomerName"
runat="server"
Width ="300px"
AllowCustomText="false"
HighlightTemplatedItems="true"
OnClientSelectedIndexChanging="PopulateContract"
EnableLoadOnDemand="true"
OnItemsRequested="ddlCustomerName_ItemsRequested"
MarkFirstMatch="true"
AutoPostback="true">
</telerik:RadComboBox>
This user control is registered in an aspx page.
<%
@ Register TagPrefix="uc"
TagName="TestFooter"
Src="~/UserControl/ParameterSetFooterGrid.ascx" %>
The Radcombobox in the user control is a mandatory field. The user should be alerted with message "Please enter xxx to proceed further" but this is not getting fired.
function
fn_Validation(Customer)
{
if(document.getElementById(Customer).selectedIndex==0)
{
alert(
'Please select a Customer Name to proceed further')
document.getElementById(Customer).focus();
return false;
}
}
This function is called on button click as
btnSubmit.Attributes.Add(
"onClick", "return fn_Validation('" & TH1.Customer.ClientID & "' );")
This event is not getting fired.
| <telerik:RadSplitter ID="MainSplitter" runat="server" Height="100%" Width="100%" HeightOffset="60"> | |
| <telerik:RadPane ID="NavigationPane" runat="server" Width="200px" MaxWidth="200"> | |
| Navigation Goes Here! | |
| </telerik:RadPane> | |
| <telerik:RadSplitBar ID="NavigationContentSplitBar" runat="server" CollapseMode="Forward" /> | |
| <telerik:RadPane ID="RadPane1" runat="server"> |
|
| <asp:ContentPlaceHolder ID="mainContent" runat="server"></asp:ContentPlaceHolder> | |
| </telerik:RadPane> | |
| </telerik:RadSplitter> |

| <table> |
| <tr> |
| <td> |
| <telerik:RadComboBox ID="rcbGenContractor" runat="server" Width="450px" |
| DropDownWidth="510px" HighlightTemplatedItems="True" EnableLoadOnDemand="True" |
| OnItemsRequested="rcbGenContractor_ItemsRequested" ShowMoreResultsBox="True" |
| EnableVirtualScrolling="True" Skin="Sunset"> |
| <HeaderTemplate> |
| <ul> |
| <li class="col1">Name</li> |
| <li class="col2">City/St</li> |
| <li class="col3">Signatory</li> |
| <li class="col4">ID</li> |
| </ul> |
| </HeaderTemplate> |
| <ItemTemplate> |
| <ul> |
| <li class="col1"><%# DataBinder.Eval(Container, "Text") %></li> |
| <li class="col2"><%# DataBinder.Eval(Container, "Attributes['CitySt']") %></li> |
| <li class="col3"><%# DataBinder.Eval(Container, "Attributes['Signatory']")%></li> |
| <li class="col4"><%# DataBinder.Eval(Container, "Attributes['Id']") %></li> |
| </ul> |
| </ItemTemplate> |
| </telerik:RadComboBox> |
| </td> |
| </tr> |
| <tr valign="top"> |
| <td> |
| <telerik:RadComboBox ID="rcbSubContractor" runat="server" Width="450" |
| DropDownWidth="510px" HighlightTemplatedItems="true" EnableLoadOnDemand="true" |
| OnItemsRequested="rcbSubContractor_ItemsRequested" ShowMoreResultsBox="true" |
| EnableVirtualScrolling="true" Skin="Sunset"> |
| <HeaderTemplate> |
| <ul> |
| <li class="col1">Name</li> |
| <li class="col2">City/St</li> |
| <li class="col3">Signatory</li> |
| <li class="col4">ID</li> |
| </ul> |
| </HeaderTemplate> |
| <ItemTemplate> |
| <ul> |
| <li class="col1"><%# DataBinder.Eval(Container, "Text") %></li> |
| <li class="col2"><%# DataBinder.Eval(Container, "Attributes['CitySt']") %></li> |
| <li class="col3"><%# DataBinder.Eval(Container, "Attributes['Signatory']")%></li> |
| <li class="col4"><%# DataBinder.Eval(Container, "Attributes['Id']") %></li> |
| </ul> |
| </ItemTemplate> |
| </telerik:RadComboBox> |
| </td> |
| </tr> |
| </table> |
| protected void rcbGenContractor_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) |
| { |
| if (e.Text.Length < 3) |
| { |
| e.Message = "Enter at least 3 letters..."; |
| } |
| else |
| { |
| SearchContractors(e); |
| } |
| } |
| protected void rcbSubContractor_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) |
| { |
| if (e.Text.Length < 3) |
| { |
| e.Message = "Enter at least 3 letters..."; |
| } |
| else |
| { |
| SearchContractors(e); |
| } |
| } |
| private void SearchContractors(Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) |
| { |
| int totalItems = default(int); |
| int endItem = e.NumberOfItems; |
| int ITEM_BATCH_SIZE = 20; |
| List<JobDataLayer.ContractorItem> data = |
| dataLayer.SearchContractors(e.Text, e.NumberOfItems, ITEM_BATCH_SIZE, out totalItems); |
| e.EndOfItems = e.NumberOfItems + ITEM_BATCH_SIZE >= totalItems; |
| foreach (JobDataLayer.ContractorItem contractor in data) |
| { |
| RadComboBoxItem item = new RadComboBoxItem(); |
| item.Text = contractor.Name; |
| item.Value = contractor.Id.ToString(); |
| string CitySt = contractor.City; |
| if (!String.IsNullOrEmpty(contractor.State)) |
| { |
| if (CitySt.Length > 0) |
| CitySt += ", "; |
| CitySt += contractor.State; |
| } |
| item.Attributes.Add("CitySt", CitySt); |
| item.Attributes.Add("Signatory", contractor.Signatory ? "X" : ""); |
| item.Attributes.Add("Id", contractor.Id.ToString()); |
| rcbGenContractor.Items.Add(item); |
| item.DataBind(); |
| endItem++; |
| } |
| e.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endItem.ToString(), totalItems.ToString()); |
| } |
var
editor = GetRadEditor(txt);
editor.innerHTML += selectedText;
If I check the editor.innerHtml value before I set it, it does get the value that is already in there. However, it doesn't change it to the selectedText. Any ideas?
