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

OnItemsRequested Event Not Available on Server side

1 Answer 87 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Lynn
Top achievements
Rank 2
Lynn asked on 08 Jul 2011, 04:57 AM
I have 3 cascading combo boxes which may be populated when the page loads based upon request string item values or they may be populated by the user on the client side.

Because of this "dual personality", I am trying to "clear" the events on the combo boxes at page_load in case any of the combo boxes are loaded based on the incoming request string.  Then I want to restore the events as my code exits page_load (I hope this is the correct way of handling this problem).

The three (3) combo boxes are defined as:

<asp:TableRow>
<asp:TableCell>
<asp:Label ID="Label1" runat="server" Text="<% $GetLangString:NewTrans.InThisCountry %>"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<telerik:RadComboBox ID="SearchCountry" TabIndex="5" style="z-index: 9000;" Width="200px" EnableEmbeddedSkins="true" Skin="Sitefinity" runat="server" Height="150px" OnClientSelectedIndexChanging="LoadSearchStateProv">
</telerik:RadComboBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="Label3" runat="server" Text="<% $GetLangString:NewTrans.InThisState %>"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<telerik:RadComboBox ID="SearchStateProv" TabIndex="6" style="z-index: 9000;" Width="200px" EnableEmbeddedSkins="true" Skin="Sitefinity" runat="server" Height="150px" OnClientSelectedIndexChanging="LoadSearchCity" OnClientItemsRequested="SearchItemsLoaded" OnItemsRequested="SearchState_ItemsRequested">
</telerik:RadComboBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="Label4" runat="server" Text="<% $GetLangString:NewTrans.InThisCity %>"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<telerik:RadComboBox ID="SearchCity" TabIndex="7" style="z-index: 9000;" Width="200px" EnableEmbeddedSkins="true" Skin="Sitefinity" runat="server" Height="150px"  OnClientItemsRequested="SearchItemsLoaded" OnItemsRequested="SearchCity_ItemsRequested"></telerik:RadComboBox>
</asp:TableCell>
</asp:TableRow>

My problem is this...on the display page (pagename.aspx), the second and third cascading combo boxes have values entered for the "OnItemsRequested" event. But when I try to "clear" this value in the server side code at page_load I keep receiving a compilation error on the event.  You may refer to the attached screen capture that shows the error.

Why is this event property inaccessible on the server side?

Thanks in advance!

Lynn

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 13 Jul 2011, 01:13 PM
Hi Lynn,

Please use the following pattern showing how to attach or detach event handlers from code-behind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
    AddHandler RadComboBox1.SelectedIndexChanged, AddressOf RadComboBox1_SelectedIndexChanged
    RemoveHandler RadComboBox1.SelectedIndexChanged, AddressOf RadComboBox1_SelectedIndexChanged
 
End Sub
 
Sub RadComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
 
 
End Sub

I hope this would help you out.

Best wishes,
Dimitar Terziev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
ComboBox
Asked by
Lynn
Top achievements
Rank 2
Answers by
Dimitar Terziev
Telerik team
Share this question
or