This is a migrated thread and some comments may be shown as answers.
Problems with version upgrade
3 Answers 34 Views
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 22 Oct 2009, 02:57 PM
I have an ASP.NET 2.0 web application that was using RadAjaxManager and RadComboBox from Q3 2007. I recently upgraded those controls to the Q3 2008 version. The only code I had to change was with the Ajax components, which is why I put most post here and not in the combobox forum. I think my problem is an interaction with the updated Ajax components.

My problem is with a few RadComboBoxes. I had developed them as multi-select containing checkboxes. After the upgrade, the checkboxes appear, but the text of the checkbox item does not.

Here is the relavent page code and javascript that is attached to the RadComboBoxes. Thanks.

 

<script type="text/javascript">

 

 

function stopPropagation(e)

 

{

e.cancelBubble =

true;

 

 

 

if (e.stopPropagation)

 

{

e.stopPropagation();

}

}

 

var supressDropDownClosing = false;

 

 

 

function OnClientDropDownClosing(sender, eventArgs)

 

{

eventArgs.set_cancel(supressDropDownClosing);

}

 

 

function OnClientSelectedIndexChanging(sender, eventArgs)

 

{

eventArgs.set_cancel(supressDropDownClosing);

}

 

 

function OnClientDropDownOpening(sender, eventArgs)

 

{

supressDropDownClosing =

true;

 

}

 

 

function OnClientBlur(sender)

 

{

supressDropDownClosing =

false;

 

 

sender.toggleDropDown();

}

 

 

function checkboxClick()

 

{

collectSelectedItems();

}

 

 

function getItemCheckBox(item)

 

{

 

//Get the 'div' representing the current RadComboBox Item.

 

 

var itemDiv = item.get_element();

 

 

 

//Get the collection of all 'input' elements in the 'div' (which are contained in the Item).

 

 

var inputs = itemDiv.getElementsByTagName("input");

 

 

 

for (var inputIndex = 0; inputIndex < inputs.length; inputIndex++)

 

{

 

var input = inputs[inputIndex];

 

 

 

//Check the type of the current 'input' element.

 

 

if (input.type == "checkbox")

 

{

 

return input;

 

}

}

 

 

return null;

 

}

 

 

function collectSelectedItems()

 

{

 

var combo = $find("<%# ddlRace.ClientID %>");

 

 

var items = combo.get_items();

 

 

 

var selectedItemsTexts = "";

 

 

var selectedItemsValues = "";

 

 

 

var itemsCount = items.get_count();

 

 

 

for (var itemIndex = 0; itemIndex < itemsCount; itemIndex++)

 

{

 

var item = items.getItem(itemIndex);

 

 

 

var checkbox = getItemCheckBox(item);

 

 

 

//Check whether the Item's CheckBox) is checked.

 

 

if (checkbox.checked)

 

{

selectedItemsTexts += item.get_text() +

", ";

 

selectedItemsValues += item.get_value() +

", ";

 

}

}

selectedItemsTexts = selectedItemsTexts.substring(0, selectedItemsTexts.length - 2);

selectedItemsValues = selectedItemsValues.substring(0, selectedItemsValues.length - 2);

 

 

//Set the text of the RadComboBox with the texts of the selected Items, separated by ','.

 

combo.set_text(selectedItemsTexts);

 

//Set the comboValue hidden field value with values of the selected Items, separated by ','.

 

document.getElementById(

"comboValue").value = selectedItemsValues;

 

 

 

//Clear the selection that RadComboBox has made internally.

 

 

if (selectedItemsValues == "")

 

{

combo.clearSelection();

}

}

 

</script>

 

 

<script type="text/javascript">

 

 

function RequestStart(sender, args)

 

{

args.EventTargetElement.disabled =

true;

 

}

 

function ResponseEnd(sender, args)

 

{

args.EventTargetElement.disabled =

false;

 

}

 

</script>

 



 

 

<

 

input type="hidden" id="comboValue" value="" runat="server" />

 

 

 

 

 

<rad:RadComboBox ID="ddlRace" runat="server" Skin="Vista" Width="290px" AllowCustomText="True"

 

 

 

 

 

OnClientDropDownOpening="OnClientDropDownOpening" OnClientSelectedIndexChanging="OnClientSelectedIndexChanging"

 

 

 

 

 

OnClientBlur="OnClientBlur">

 

 

 

 

 

<Items>

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem7" runat="server" Text="Select..." Value="" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem8" runat="server" Text="Alaskan Native" Value="Alaskan Native" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem9" runat="server" Text="American Indian"

 

 

 

 

 

Value="American Indian" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem10" runat="server" Text="Asian" Value="Asian" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem11" runat="server" Text="Black or African American"

 

 

 

 

 

Value="Black or African American" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem12" runat="server" Text="Native Hawaiian/Other Pacific Islander"

 

 

 

 

 

Value="Native Hawaiian/Other Pacific Islander" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem13" runat="server" Text="White" Value="White" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem14" runat="server" Text="Hispanic/Latino"

 

 

 

 

 

Value="Hispanic/Latino" />

 

 

 

 

 

</Items>

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

<asp:CheckBox runat="server" ID="cbxRace" onclick="stopPropagation(event);" Text="" />

 

 

 

 

<%

# DataBinder.Eval(Container, "Text") %>

 

 

</ItemTemplate>

 

 

 

 

 

</rad:RadComboBox>

 

 

 



 

 

 

<input type="hidden" id="comboValue2" value="" runat="server" />

 

 

 

 

 

<rad:RadComboBox ID="ddlWorkSettings" runat="server" Skin="Vista" Width="290px" AllowCustomText="True"

 

 

 

 

 

OnClientDropDownOpening="OnClientDropDownOpening" OnClientSelectedIndexChanging="OnClientSelectedIndexChanging"

 

 

 

 

 

OnClientBlur="OnClientBlur">

 

 

 

 

 

<Items>

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem15" runat="server" Text="Select..." Value="" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem16" runat="server" Text="Academic Institution"

 

 

 

 

 

Value="Academic Institution" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem17" runat="server" Text="Government - Federal"

 

 

 

 

 

Value="Government - Federal" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem18" runat="server" Text="Government - State"

 

 

 

 

 

Value="Government - State" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem19" runat="server" Text="Government - Local"

 

 

 

 

 

Value="Government - Local" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem20" runat="server" Text="Government - Territory"

 

 

 

 

 

Value="Government - Territory" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem21" runat="server" Text="Government - Tribal"

 

 

 

 

 

Value="Government - Tribal" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem22" runat="server" Text="Healthcare Services"

 

 

 

 

 

Value="Healthcare Services" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem23" runat="server" Text="Non-profit Organization"

 

 

 

 

 

Value="Non-profit Organization" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem24" runat="server" Text="Private Industry"

 

 

 

 

 

Value="Private Industry" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem25" runat="server" Text="Other" Value="Other" />

 

 

 

 

 

</Items>

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

<asp:CheckBox ID="cbxWorkSettings" runat="server" onclick="stopPropagation(event);"

 

 

 

 

 

Text="" /><%# DataBinder.Eval(Container, "Text") %>

 

 

</ItemTemplate>

 

 

 

 

 

</rad:RadComboBox>

 

 

 


 

 

<input type="hidden" id="comboValue3" value="" runat="server" />

 

 

 

 

 

<rad:RadComboBox ID="ddlProfessionalRoles" runat="server" Skin="Vista" Width="290px"

 

 

 

 

 

AllowCustomText="True" OnClientDropDownOpening="OnClientDropDownOpening" OnClientSelectedIndexChanging="OnClientSelectedIndexChanging"

 

 

 

 

 

OnClientBlur="OnClientBlur">

 

 

 

 

 

<Items>

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem26" runat="server" Text="Select..." Value="" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem27" runat="server" Text="Allied Health Professional"

 

 

 

 

 

Value="Allied Health Professional" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem28" runat="server" Text="Administrator/Director/Manager"

 

 

 

 

 

Value="Administrator/Director/Manager" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem29" runat="server" Text="Administrative Support Staff"

 

 

 

 

 

Value="Administrative Support Staff" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem30" runat="server" Text="Computer Specialist"

 

 

 

 

 

Value="Computer Specialist" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem31" runat="server" Text="Epidemiologist/Biostatistician/Statistician"

 

 

 

 

 

Value="Epidemiologist/Biostatistician/Statistician" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem32" runat="server" Text="Emergency Responder"

 

 

 

 

 

Value="Emergency Responder" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem33" runat="server" Text="Faculty/Educator"

 

 

 

 

 

Value="Faculty/Educator" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem34" runat="server" Text="Environmental Health Specialist"

 

 

 

 

 

Value="Environmental Health Specialist" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem35" runat="server" Text="Health Educator"

 

 

 

 

 

Value="Health Educator" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem36" runat="server" Text="Informatician" Value="Informatician" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem37" runat="server" Text="Laboratory Professional"

 

 

 

 

 

Value="Laboratory Professional" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem38" runat="server" Text="Nurse" Value="Nurse" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem39" runat="server" Text="Physician" Value="Physician" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem40" runat="server" Text="Public Health Service Provider (non-clinical)"

 

 

 

 

 

Value="Public Health Service Provider (non-clinical)" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem41" runat="server" Text="Veterinarian" Value="Veterinarian" />

 

 

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem42" runat="server" Text="Other" Value="Other" />

 

 

 

 

 

</Items>

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

<asp:CheckBox ID="cbxProfessionalRoles" runat="server" onclick="stopPropagation(event);"

 

 

 

 

 

Text="" /><%# DataBinder.Eval(Container, "Text") %>

 

 

</ItemTemplate>

 

 

 

 

 

</rad:RadComboBox>

 

 

 


3 Answers, 1 is accepted

Sort by
0
SamJ
Top achievements
Rank 1
answered on 24 Oct 2009, 06:48 AM
Hi,

Your code looks fine to me. However, you can try migrating the code used in the RequestStart and ResponseEnd client-side events of the manager, as the methods you used are obsolete (use this link for a reference).

Also, can you tell if the page works fine if you disable ajax, e.g. set EnableAjax property to false?
0
Joe
Top achievements
Rank 1
answered on 26 Oct 2009, 04:12 PM
Thanks for the reply. I looked at the link, but I couldn't figure out what was obsolete with that javascript. So I just commented it out and commented out the corresponding ClientEvents section in the AjaxManager. I tested with EnableAjax=false and I get the same results. The comboboxes display the checkboxes, but not the text of the checkbox item. It appears my problem has nothing to do with the Ajax component, but rather the combobox component. I'll post there. Thanks.
0
Veselin Vasilev
Telerik team
answered on 29 Oct 2009, 01:25 PM
Hello Joe,

Call the DataBind() method of the combobox in Page_Load event.

Greetings,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Ajax
Asked by
Joe
Top achievements
Rank 1
Answers by
SamJ
Top achievements
Rank 1
Joe
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or