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.
I use some Javascript in this page and in my page_prerender event I call the javascript.
I call this Javascript in the onclick event of the RadComboCheckbox like this -
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
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