This is a migrated thread and some comments may be shown as answers.

An usercontrol with Radcombobox and RadWindo

1 Answer 7 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kalyani
Top achievements
Rank 1
Kalyani asked on 08 Oct 2014, 02:59 AM
Hello,

I am hoping someone can help me with my code.  I have an user control which contains a single RadCombobox.  This is the code.

<tlrk:RadComboBox
 ID="InternalComboBox"
 runat="server"
 HighlightTemplatedItems="true"  >
 <ItemTemplate>
 <div onclick="StopPropagation(event)" >                                   
  <asp:CheckBox ID="ComboCheckBox" runat="server" CssClass="formTextElevenPx" style="vertical-align: middle;" />
  <span id="CheckBoxLabel" runat="server"><%# DataBinder.Eval(Container, "Text")%></span>
 </div>
 </ItemTemplate>
</tlrk:RadComboBox>

I use some Javascript in this page and in my page_prerender event I call the javascript.

<script type="text/javascript">
 
function StopPropagation(e) {
  //cancel bubbling
  e.cancelBubble = true;
  if (e.stopPropagation) {
   e.stopPropagation();
  }
 }
 
 function onCheckBoxClick_<% =uniqueKey %>() {
  var combo = $find("<%= InternalComboBox.ClientID %>");
   UpdateMessage(combo);
 }
 function UpdateMessage(combo) {  
  var items = combo.get_items();
  var text = "";
  for (var i = 1; i < items.get_count(); i++) {
   var item = items.getItem(i);
   var chk1 = $get(combo.get_id() + '_i' + i + '_ComboCheckBox');
   if (chk1.checked)
    text+= item.get_text() + ", ";
  }
  return text.trim();
 }
 
</script>

I call this Javascript in the onclick event of the RadComboCheckbox like this -
protected string uniqueKey;
 protected void Page_PreRender(object sender, EventArgs e)
 
  this.uniqueKey = Guid.NewGuid().ToString("N");
  foreach (RadComboBoxItem i in InternalComboBox.Items)
  {
   CheckBox cbx = i.FindControl("ComboCheckBox") as CheckBox;
   if (cbx != null)
   {
    cbx.Attributes["onclick"] = "return onCheckBoxClick_" + uniqueKey + "()";
   }
  }

So I call the javascript in the cbx.Attributes["onclick"] event.  

This user control when placed in a normal page works without any issues.  But when I place the usercontrol inside a Radwindow then the javascript associated with the usercontrol -onCheckBoxClick will not load and it shows an Reference not found javascript error.  Why does this happen and how would I fix it.  Would appreciate any help you can provide me.

Thanks

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 10 Oct 2014, 03:16 PM
Hello,

I am afraid that I am not able to replicate such issue. Could you please send us a sample page that replicates the issue? This way we can investigate it thoroughly and find the problem.

Regards,
Boyan Dimitrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ComboBox
Asked by
Kalyani
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or