Hello,
We are currently using a RadComboBox with loadOnDemand within our MasterPage. The SelectedValue of the ComboBox and the SelectedText are properly returned to the SelectedIndexChanged Event when a combobox item is selected from the drop down for the first time but not upon the second selection. To be more clear. If you have 3 ComboboxItems (in our case "projects") : Item 1, Item 2 and Item3. If Item 1 is selected the SelectedIndexChangedEvent works as expected. Both the Text and Value of the event are populated in the event handler as expected, If Item 2 is selected the same expected behavior occurs. If however a user were to RE select Item 1 after previously selecting Item 1 during the same session then ONLY the Text of the event handler is populated in the event value is not populated. To make matters slightly more confusing the SelectedValue of the combo Box is also returning an empty string only on the reselection but appears to be working properly for the initial selection.. I have no idea why everything seems to be working fine for the first iteration of a selection but not the second. Any advice would be sincerely appreciated. Relevant Code Below:
C#
protected void rcbCurrentProject_ItemsRequested(object sender, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
{
var projects = FluxPermissionManager.GetUserProjectAccess(Page.User.Identity.Name).Select(lkj => new { name = lkj.name, testProjectID = lkj.testProjectID });
rcbCurrentProject.DataSource = projects.ToList();
rcbCurrentProject.DataBind();
e.Message = "Displaying All Accessible Projects";
}
protected void rcbCurrentProject_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
try
{
//e.Text Is populated Properly.... no issues
string projectName = e.Text
//e.Value returns an empty string following the second time selected.
int val = Int32.Parse(e.Value);
. . . ...
}
}
ASPX
<telerik:RadComboBox ID="rcbCurrentProject" runat="server" ErrorMessage="None Selected" EnableLoadOnDemand="true"
ShowMoreResultsBox="false" AutoPostBack="true" EnableVirtualScrolling="false" OnPreRender="rcbCurrentProject_PreRender"
DataTextField="name" DataValueField="testProjectID" OnItemsRequested="rcbCurrentProject_ItemsRequested"
MarkFirstMatch="true" Filter="Contains" AllowCustomText="false" OnSelectedIndexChanged="rcbCurrentProject_SelectedIndexChanged"
OnClientDropDownOpening="cleanProjectDefaultSelection">
</telerik:RadComboBox>
function cleanProjectDefaultSelection(sender, args) {
if (sender.get_text() != "") {
sender.set_text("");
sender._filterText = "";
sender.requestItems("");
}
}
We are currently using a RadComboBox with loadOnDemand within our MasterPage. The SelectedValue of the ComboBox and the SelectedText are properly returned to the SelectedIndexChanged Event when a combobox item is selected from the drop down for the first time but not upon the second selection. To be more clear. If you have 3 ComboboxItems (in our case "projects") : Item 1, Item 2 and Item3. If Item 1 is selected the SelectedIndexChangedEvent works as expected. Both the Text and Value of the event are populated in the event handler as expected, If Item 2 is selected the same expected behavior occurs. If however a user were to RE select Item 1 after previously selecting Item 1 during the same session then ONLY the Text of the event handler is populated in the event value is not populated. To make matters slightly more confusing the SelectedValue of the combo Box is also returning an empty string only on the reselection but appears to be working properly for the initial selection.. I have no idea why everything seems to be working fine for the first iteration of a selection but not the second. Any advice would be sincerely appreciated. Relevant Code Below:
C#
protected void rcbCurrentProject_ItemsRequested(object sender, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
{
var projects = FluxPermissionManager.GetUserProjectAccess(Page.User.Identity.Name).Select(lkj => new { name = lkj.name, testProjectID = lkj.testProjectID });
rcbCurrentProject.DataSource = projects.ToList();
rcbCurrentProject.DataBind();
e.Message = "Displaying All Accessible Projects";
}
protected void rcbCurrentProject_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
try
{
//e.Text Is populated Properly.... no issues
string projectName = e.Text
//e.Value returns an empty string following the second time selected.
int val = Int32.Parse(e.Value);
. . . ...
}
}
ASPX
<telerik:RadComboBox ID="rcbCurrentProject" runat="server" ErrorMessage="None Selected" EnableLoadOnDemand="true"
ShowMoreResultsBox="false" AutoPostBack="true" EnableVirtualScrolling="false" OnPreRender="rcbCurrentProject_PreRender"
DataTextField="name" DataValueField="testProjectID" OnItemsRequested="rcbCurrentProject_ItemsRequested"
MarkFirstMatch="true" Filter="Contains" AllowCustomText="false" OnSelectedIndexChanged="rcbCurrentProject_SelectedIndexChanged"
OnClientDropDownOpening="cleanProjectDefaultSelection">
</telerik:RadComboBox>
function cleanProjectDefaultSelection(sender, args) {
if (sender.get_text() != "") {
sender.set_text("");
sender._filterText = "";
sender.requestItems("");
}
}