Hi,
i read about the new AccessibilityMode and wonder if there is a possibility to always render a RadComboBox as a standard Dropdown, even if there is javascript enabled on browser.. Can this be done now or is in planning for future releases?
Thanks
Achim
i read about the new AccessibilityMode and wonder if there is a possibility to always render a RadComboBox as a standard Dropdown, even if there is javascript enabled on browser.. Can this be done now or is in planning for future releases?
Thanks
Achim
17 Answers, 1 is accepted
0
Hello Achim,
This cannot be done and currently we don't have plans to enable such behavior. Why do you need such behavior? Why don't you use the built-in DropDownList control in this case?
Kind regards,
Albert
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
This cannot be done and currently we don't have plans to enable such behavior. Why do you need such behavior? Why don't you use the built-in DropDownList control in this case?
Kind regards,
Albert
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Achim
Top achievements
Rank 1
answered on 20 Jan 2009, 01:55 PM
Hi Albert,
the situation is that i have developed a web application which uses lots of RadDropDowns and other RadControls. Currently i am planning to make a version for mobile devices (iphone and some others). So i thought of simply copy&paste code from existing web or even reuse some .ascx files for the mobile version.. Problem then is that iphone has better feel with standard dropdowns..
Best case i thought, would be to reuse existing code with RadDropDowns and tell them to render as normal Comboboxes on iphone.. On other mobile devices and browsers (opera mini, firefox) perhaps then it will be possible to render as RadDropDowns (if tests shows that this makes sence), so switching rendering mode for different browsers is or was what i wanted to do..
Greetings
achim
the situation is that i have developed a web application which uses lots of RadDropDowns and other RadControls. Currently i am planning to make a version for mobile devices (iphone and some others). So i thought of simply copy&paste code from existing web or even reuse some .ascx files for the mobile version.. Problem then is that iphone has better feel with standard dropdowns..
Best case i thought, would be to reuse existing code with RadDropDowns and tell them to render as normal Comboboxes on iphone.. On other mobile devices and browsers (opera mini, firefox) perhaps then it will be possible to render as RadDropDowns (if tests shows that this makes sence), so switching rendering mode for different browsers is or was what i wanted to do..
Greetings
achim
0
Jeremy Schaab
Top achievements
Rank 1
answered on 26 Aug 2010, 12:39 PM
We would also like something like this for RadGrid or any 'standard' ui component that would help us make mobile enabled sites with the same code. Currently we have to code twice for things like DropDowns and Grids. Any other approach that we are missing would be very helpful!
0
Hello Jeremy,
There's no easy way to replace RadComboBox or RadGrid with the regular asp controls and use the same code.
Currently we are working on improving RadControls' mobile browser support, so if you have any concrete issues, please report them and we'll try to fix them.
Regards,
Yana
the Telerik team
There's no easy way to replace RadComboBox or RadGrid with the regular asp controls and use the same code.
Currently we are working on improving RadControls' mobile browser support, so if you have any concrete issues, please report them and we'll try to fix them.
Regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Orin Book
Top achievements
Rank 1
answered on 09 Sep 2010, 02:41 AM
I also hope you make these improvements for mobile. We support US Military. If there is mobile service, then we can get to web. Southwest Asia and other low Internet bandwidth areas force application to mobile phones. Applications to provide simply status and other feedback become critical. Coding twice is what we have had to do. Drop downs have to be degraded. I would not profess to know the inner workings of Telerik rendering, but the concept of degrading to standard Select drop down, by setting a value on the Telerik code would not seem that difficult. When Telerik renders, than all features are removed that make your controls the best. No load on demand, and all other features are not used. Just use the CSS skin, and standard Select option outputs. Believe me, if you do this alone, with basic components, will make you stars!!! I completely understand that more complicated components can not get to this level, but a standard drop down is an extremely simple control to render.
0
Hi Orin,
Thank you for your suggestions, they will be reviewed and considered.
All the best,
Yana
the Telerik team
Thank you for your suggestions, they will be reviewed and considered.
All the best,
Yana
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Orin Book
Top achievements
Rank 1
answered on 10 Sep 2010, 03:35 PM
Thank you for the reply, but I do not believe this is going to be a Telerik priority as this ticket shows an almost 2 year request. We will create our own switch. Your company is truly missing an opportunity here with a graceful degrade on a simple HTML element that has a large impact in mobile devices. We will brief this issue to our commands and create our own to give this support.
0
Hello Orin Book,
Actually mobile devices support is one of our major goals for this Q so this suggestion makes a lot of sense. We will definitely consider its implementation.
Thank you for sharing your thoughts on the matter.
Kind regards,
Simon
the Telerik team
Actually mobile devices support is one of our major goals for this Q so this suggestion makes a lot of sense. We will definitely consider its implementation.
Thank you for sharing your thoughts on the matter.
Kind regards,
Simon
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Ryan
Top achievements
Rank 1
answered on 18 Mar 2011, 06:05 PM
Hello -
I am interested in the same functionality. In order to comply with federal usability laws, certain screen readers must be able to read through the contents of a drop down list. Since the RadComboBox is rendered as a table of read-only inputs, our screen reader as SSA (JAWS) cannot read through it like a normal drop down list.
I have set AccessibilityMode="true", but this only goes as far as creating a parrallel standard drop down list, only to be used if the browser doesn't have javascript enabled. I (and any application released in my agency) would require that all RadComboBoxes have the capability of being fully rendered as standard drop down lists.
Please let me know your thoughts on the matter. Thank you!
I am interested in the same functionality. In order to comply with federal usability laws, certain screen readers must be able to read through the contents of a drop down list. Since the RadComboBox is rendered as a table of read-only inputs, our screen reader as SSA (JAWS) cannot read through it like a normal drop down list.
I have set AccessibilityMode="true", but this only goes as far as creating a parrallel standard drop down list, only to be used if the browser doesn't have javascript enabled. I (and any application released in my agency) would require that all RadComboBoxes have the capability of being fully rendered as standard drop down lists.
Please let me know your thoughts on the matter. Thank you!
0
Orin Book
Top achievements
Rank 1
answered on 18 Mar 2011, 06:19 PM
In our last review we briefed the Government that Telerik controls do not support this and after repeated requests, seem to not understand or choose to ignore the situation. We have submitted a cost proposal to create our own switch to render the dropdown as standard so that the mobile OS will render as designed. Furthermore, The US ARMY CIO has placed Telerik and other 3rd party vendor controls on a tickler to inform all agencies and contractors to avoid using controls that do not render appropriately to mobile OS. They are setting up a group to establish and analyze performance of applications in a mobile environment. AGAIN, such a simple request to render in classic mode would have prevented us in briefing this.
0
Ryan
Top achievements
Rank 1
answered on 18 Mar 2011, 06:26 PM
Interesting. Perhaps now that they are aware that federal applications cannot use the RadComboBox in order to comply with a federal law, more accomodations might be made.
0
Hi Ryan, Orin,
During this Q we will be working on both making the RadComboBox JAWS-readable and providing a property that will switch its rendering to a standard DropDownList.
Kind regards,
Simon
the Telerik team
During this Q we will be working on both making the RadComboBox JAWS-readable and providing a property that will switch its rendering to a standard DropDownList.
Kind regards,
Simon
the Telerik team
0
Ryan
Top achievements
Rank 1
answered on 23 Mar 2011, 04:12 PM
Thank you, kindly. Our license no longer supports downloading new releases. What can I do to take advantage of the JAWS compliant features?
0
Hi Ryan,
In your case the only option is to upgrade to the new release containing the feature. If we manage to implement it for a Service Pack of Q1 2011, then you will get the feature without getting the Q2 2011 release, however the chances for this are slim.
Best wishes,
Simon
the Telerik team
In your case the only option is to upgrade to the new release containing the feature. If we manage to implement it for a Service Pack of Q1 2011, then you will get the feature without getting the Q2 2011 release, however the chances for this are slim.
Best wishes,
Simon
the Telerik team
0
Ryan
Top achievements
Rank 1
answered on 21 Apr 2011, 05:57 PM
Project pressures have forced me to put other requirements to the side and come up with my own solution to this, so here's a user control that essentially accomplishes the behavior we're looking for. You'll just add this user control to your page, and specify RenderMode = DropDownList in order for the RadComboBox to be rendered as a DropDownList on your page.
ComboBox.ascx:
ComboBox.ascx:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ComboBox.ascx.vb" Inherits="UserControls_ComboBox" %> <!-- Create the RadComboBox and DropDownList --><telerik:RadComboBox runat="server" ID="ddlRadComboBox" /> <asp:PlaceHolder runat="server" ID="placeholderDropDownList" />ComboBox.ascx.vb:
Imports Telerik.Web.UI Partial Class UserControls_ComboBox Inherits System.Web.UI.UserControl #Region "Global Variables" 'Enumerator for render mode Private objRenderMode As RenderingMode = RenderingMode.RadComboBox Public Enum RenderingMode RadComboBox DropDownList End Enum #End Region #Region "Properties" ''' <summary>RenderMode</summary> ''' <remarks></remarks> Public Property RenderMode() As RenderingMode Get Return objRenderMode End Get Set(ByVal value As RenderingMode) objRenderMode = value End Set End Property ''' <summary>RadComboBox</summary> ''' <remarks></remarks> Public ReadOnly Property RadComboBox() As RadComboBox Get Return ddlRadComboBox End Get End Property ''' <summary>AutoPostBack</summary> ''' <remarks></remarks> Public Property AutoPostBack() As Boolean Get Return ddlRadComboBox.AutoPostBack End Get Set(ByVal value As Boolean) ddlRadComboBox.AutoPostBack = value End Set End Property ''' <summary>Enabled</summary> ''' <remarks></remarks> Public Property Enabled() As Boolean Get Return ddlRadComboBox.Enabled End Get Set(ByVal value As Boolean) ddlRadComboBox.Enabled = value End Set End Property ''' <summary>SelectedValue</summary> ''' <remarks></remarks> Public Property SelectedValue() As String Get Return ddlRadComboBox.SelectedValue End Get Set(ByVal value As String) ddlRadComboBox.SelectedValue = value End Set End Property ''' <summary>SelectedIndex</summary> ''' <remarks></remarks> Public Property SelectedIndex() As Integer Get Return ddlRadComboBox.SelectedIndex End Get Set(ByVal value As Integer) ddlRadComboBox.SelectedIndex = value End Set End Property ''' <summary>SelectedItem</summary> ''' <remarks></remarks> Public ReadOnly Property SelectedItem() As RadComboBoxItem Get Return ddlRadComboBox.SelectedItem End Get End Property ''' <summary>Text</summary> ''' <remarks></remarks> Public Property Text() As String Get Return ddlRadComboBox.Text End Get Set(ByVal value As String) ddlRadComboBox.Text = value End Set End Property ''' <summary>DataTextField</summary> ''' <remarks></remarks> Public Property DataTextField() As String Get Return ddlRadComboBox.DataTextField End Get Set(ByVal value As String) ddlRadComboBox.DataTextField = value End Set End Property ''' <summary>DataValueField</summary> ''' <remarks></remarks> Public Property DataValueField() As String Get Return ddlRadComboBox.DataValueField End Get Set(ByVal value As String) ddlRadComboBox.DataValueField = value End Set End Property ''' <summary>DataSource</summary> ''' <remarks></remarks> Public Property DataSource() As Object Get Return ddlRadComboBox.DataSource End Get Set(ByVal value As Object) ddlRadComboBox.DataSource = value End Set End Property ''' <summary>DataTextFormatString</summary> ''' <remarks></remarks> Public Property DataTextFormatString() As String Get Return ddlRadComboBox.DataTextFormatString End Get Set(ByVal value As String) ddlRadComboBox.DataTextFormatString = value End Set End Property ''' <summary>Width</summary> ''' <remarks></remarks> Public Property Width() As Unit Get Return ddlRadComboBox.Width End Get Set(ByVal value As Unit) ddlRadComboBox.Width = value End Set End Property ''' <summary>Items</summary> ''' <remarks></remarks> Public ReadOnly Property Items() As RadComboBoxItemCollection Get Return ddlRadComboBox.Items End Get End Property ''' <summary>onclick</summary> ''' <remarks></remarks> Public Property onclick() As String Get Return ddlRadComboBox.Attributes("onclick") End Get Set(ByVal value As String) ddlRadComboBox.Attributes("onclick") = value End Set End Property #End Region #Region "Public Events" Public Event DataBinding As EventHandler Public Event DataBound As EventHandler Public Event Disposed As EventHandler Public Event Init As EventHandler Public Event ItemCreated As EventHandler Public Event ItemDataBound As EventHandler Public Event ItemsRequested As EventHandler Public Event Load As EventHandler Public Event TextChanged As EventHandler Public Event Unload As EventHandler Public Event PreRender As EventHandler Public Event SelectedIndexChanged As EventHandler #End Region #Region "Event Handlers" ''' <summary>Page_Load</summary> ''' <remarks></remarks> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Register the JavaScript that ties the DropDownList onchange event to the RadComboBox SelectedIndexChanged event If (Me.RenderMode = RenderingMode.DropDownList) Then Dim strJavaScript As New StringBuilder strJavaScript.Append("function DropDownList_IndexChanged(thisSender, thisEvent) {") strJavaScript.Append("var objRadComboBox = $find(thisSender.id.replace(""_DropDownList"", """"));") strJavaScript.Append("objRadComboBox.trackChanges();") strJavaScript.Append("objRadComboBox.findItemByValue(thisSender.value).select();") strJavaScript.Append("objRadComboBox.updateClientState();") strJavaScript.Append("objRadComboBox.commitChanges();") strJavaScript.Append("}") ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType, "DropDownList_IndexChanged", strJavaScript.ToString, True) End If End Sub ''' <summary>ddlRadComboBox_PreRender</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.PreRender 'Render the RadComboBox as a DropDownList, if requested If (Me.RenderMode = RenderingMode.DropDownList) Then 'Transfer the values Dim ddlDropDownList As New DropDownList ddlDropDownList.ID = ddlRadComboBox.ID & "_DropDownList" For Each objComboBoxItem As RadComboBoxItem In ddlRadComboBox.Items ddlDropDownList.Items.Add(New ListItem(objComboBoxItem.Text, objComboBoxItem.Value)) Next 'Transfer the selected index and other attributes ddlDropDownList.SelectedIndex = ddlRadComboBox.SelectedIndex ddlDropDownList.Enabled = ddlRadComboBox.Enabled ddlDropDownList.Attributes("onclick") = ddlRadComboBox.Attributes("onclick") 'Wire the selected index change event ddlDropDownList.Attributes("onchange") = "DropDownList_IndexChanged(this, event)" 'Replace the ComboBox with the DropDownList ddlRadComboBox.Attributes("style") = "display: none;" placeholderDropDownList.Controls.Add(ddlDropDownList) End If 'Raise the event on the reffering ASP page RaiseEvent PreRender(sender, e) End Sub ''' <summary>ddlRadComboBox_DataBinding</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.DataBinding RaiseEvent DataBinding(sender, e) End Sub ''' <summary>ddlRadComboBox_DataBound</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.DataBound RaiseEvent DataBound(sender, e) End Sub ''' <summary>ddlRadComboBox_Disposed</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.Disposed RaiseEvent Disposed(sender, e) End Sub ''' <summary>ddlRadComboBox_Init</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.Init RaiseEvent Init(sender, e) End Sub ''' <summary>ddlRadComboBox_ItemCreated</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles ddlRadComboBox.ItemCreated RaiseEvent ItemCreated(sender, e) End Sub ''' <summary>ddlRadComboBox_ItemDataBound</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles ddlRadComboBox.ItemDataBound RaiseEvent ItemDataBound(sender, e) End Sub ''' <summary>ddlRadComboBox_ItemsRequested</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_ItemsRequested(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles ddlRadComboBox.ItemsRequested RaiseEvent ItemsRequested(o, e) End Sub ''' <summary>ddlRadComboBox_Load</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.Load RaiseEvent Load(sender, e) End Sub ''' <summary>ddlRadComboBox_SelectedIndexChanged</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles ddlRadComboBox.SelectedIndexChanged RaiseEvent SelectedIndexChanged(o, e) End Sub ''' <summary>ddlRadComboBox_TextChanged</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.TextChanged RaiseEvent TextChanged(sender, e) End Sub ''' <summary>ddlRadComboBox_Unload</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.Unload RaiseEvent Unload(sender, e) End Sub #End Region #Region "Functions" ''' <summary>FindItemByText</summary> ''' <remarks></remarks> Public Function FindItemByText(ByRef strItemText As String) As RadComboBoxItem Return ddlRadComboBox.FindItemByText(strItemText) End Function ''' <summary>FindItemIndexByText</summary> ''' <remarks></remarks> Public Function FindItemIndexByText(ByRef strItemText As String) As Integer Return ddlRadComboBox.FindItemIndexByText(strItemText) End Function ''' <summary>FindItemIndexByText</summary> ''' <remarks></remarks> Public Function FindItemIndexByText(ByRef strItemText As String, ByRef boolIgnoreCase As Boolean) As Integer Return ddlRadComboBox.FindItemIndexByText(strItemText, boolIgnoreCase) End Function ''' <summary>FindItemIndexByValue</summary> ''' <remarks></remarks> Public Function FindItemIndexByValue(ByRef strItemValue As String) As Integer Return ddlRadComboBox.FindItemIndexByValue(strItemValue) End Function ''' <summary>FindItemIndexByValue</summary> ''' <remarks></remarks> Public Function FindItemIndexByValue(ByRef strItemValue As String, ByRef boolIgnoreCase As Boolean) As Integer Return ddlRadComboBox.FindItemIndexByValue(strItemValue, boolIgnoreCase) End Function #End Region End ClassThere are probably better ways to accomplish this, but this will do for now. Hope this helps!
0
Ryan
Top achievements
Rank 1
answered on 25 Apr 2011, 03:31 PM
Updated code (now supports the 508 requirement to place focus back on the control after a postback)...
ComboBox.ascx:
ComboBox.ascx:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ComboBox.ascx.vb" Inherits="UserControls_ComboBox" %> <!-- Create the RadComboBox and DropDownList --><telerik:RadComboBox runat="server" ID="ddlRadComboBox" /> <asp:PlaceHolder runat="server" ID="placeholderDropDownList" />ComboBox.ascx.vb:
Imports Telerik.Web.UI Partial Class UserControls_ComboBox Inherits System.Web.UI.UserControl #Region "Global Variables" 'Enumerator for render mode Private objRenderMode As RenderingMode = RenderingMode.RadComboBox Public Enum RenderingMode RadComboBox DropDownList End Enum #End Region #Region "Properties" ''' <summary>RenderMode</summary> ''' <remarks></remarks> Public Property RenderMode() As RenderingMode Get Return objRenderMode End Get Set(ByVal value As RenderingMode) objRenderMode = value End Set End Property ''' <summary>RadComboBox</summary> ''' <remarks></remarks> Public ReadOnly Property RadComboBox() As RadComboBox Get Return ddlRadComboBox End Get End Property ''' <summary>DropDownList</summary> ''' <remarks></remarks> Public ReadOnly Property DropDownList() As DropDownList Get If (placeholderDropDownList.Controls.Count > 0) Then Return placeholderDropDownList.Controls(0) Else Return Nothing End If End Get End Property ''' <summary>AutoPostBack</summary> ''' <remarks></remarks> Public Property AutoPostBack() As Boolean Get Return ddlRadComboBox.AutoPostBack End Get Set(ByVal value As Boolean) ddlRadComboBox.AutoPostBack = value End Set End Property ''' <summary>Enabled</summary> ''' <remarks></remarks> Public Property Enabled() As Boolean Get Return ddlRadComboBox.Enabled End Get Set(ByVal value As Boolean) ddlRadComboBox.Enabled = value End Set End Property ''' <summary>SelectedValue</summary> ''' <remarks></remarks> Public Property SelectedValue() As String Get Return ddlRadComboBox.SelectedValue End Get Set(ByVal value As String) ddlRadComboBox.SelectedValue = value End Set End Property ''' <summary>SelectedIndex</summary> ''' <remarks></remarks> Public Property SelectedIndex() As Integer Get Return ddlRadComboBox.SelectedIndex End Get Set(ByVal value As Integer) ddlRadComboBox.SelectedIndex = value End Set End Property ''' <summary>SelectedItem</summary> ''' <remarks></remarks> Public ReadOnly Property SelectedItem() As RadComboBoxItem Get Return ddlRadComboBox.SelectedItem End Get End Property ''' <summary>Text</summary> ''' <remarks></remarks> Public Property Text() As String Get Return ddlRadComboBox.Text End Get Set(ByVal value As String) ddlRadComboBox.Text = value End Set End Property ''' <summary>DataTextField</summary> ''' <remarks></remarks> Public Property DataTextField() As String Get Return ddlRadComboBox.DataTextField End Get Set(ByVal value As String) ddlRadComboBox.DataTextField = value End Set End Property ''' <summary>DataValueField</summary> ''' <remarks></remarks> Public Property DataValueField() As String Get Return ddlRadComboBox.DataValueField End Get Set(ByVal value As String) ddlRadComboBox.DataValueField = value End Set End Property ''' <summary>DataSource</summary> ''' <remarks></remarks> Public Property DataSource() As Object Get Return ddlRadComboBox.DataSource End Get Set(ByVal value As Object) ddlRadComboBox.DataSource = value End Set End Property ''' <summary>DataTextFormatString</summary> ''' <remarks></remarks> Public Property DataTextFormatString() As String Get Return ddlRadComboBox.DataTextFormatString End Get Set(ByVal value As String) ddlRadComboBox.DataTextFormatString = value End Set End Property ''' <summary>Width</summary> ''' <remarks></remarks> Public Property Width() As Unit Get Return ddlRadComboBox.Width End Get Set(ByVal value As Unit) ddlRadComboBox.Width = value End Set End Property ''' <summary>Items</summary> ''' <remarks></remarks> Public ReadOnly Property Items() As Object Get Return ddlRadComboBox.Items End Get End Property ''' <summary>onclick</summary> ''' <remarks></remarks> Public Property onclick() As String Get Return ddlRadComboBox.Attributes("onclick") End Get Set(ByVal value As String) ddlRadComboBox.Attributes("onclick") = value End Set End Property #End Region #Region "Public Events" Public Event DataBinding As EventHandler Public Event DataBound As EventHandler Public Event Disposed As EventHandler Public Event Init As EventHandler Public Event ItemCreated As EventHandler Public Event ItemDataBound As EventHandler Public Event ItemsRequested As EventHandler Public Event Load As EventHandler Public Event TextChanged As EventHandler Public Event Unload As EventHandler Public Event PreRender As EventHandler Public Event SelectedIndexChanged As EventHandler #End Region #Region "Event Handlers" ''' <summary>Page_Load</summary> ''' <remarks></remarks> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Render the RadComboBox as a DropDownList, if requested If (Me.RenderMode = RenderingMode.DropDownList) Then 'Transfer the items Dim ddlDropDownList As New DropDownList ddlDropDownList.ID = ddlRadComboBox.ID & "_DropDownList" For Each objComboBoxItem As RadComboBoxItem In ddlRadComboBox.Items ddlDropDownList.Items.Add(New ListItem(objComboBoxItem.Text, objComboBoxItem.Value)) Next 'Transfer the selected index and other attributes ddlDropDownList.SelectedIndex = ddlRadComboBox.SelectedIndex ddlDropDownList.Enabled = ddlRadComboBox.Enabled ddlDropDownList.Attributes("onclick") = ddlRadComboBox.Attributes("onclick") 'Wire the selected index change event ddlDropDownList.Attributes("onchange") = "DropDownList_IndexChanged(this, event)" 'Replace the ComboBox with the DropDownList ddlRadComboBox.Attributes("style") = "display: none;" placeholderDropDownList.Controls.Add(ddlDropDownList) 'Register the JavaScript that ties the DropDownList onchange event to the RadComboBox SelectedIndexChanged event Dim strJavaScript As New StringBuilder strJavaScript.Append("function DropDownList_IndexChanged(thisSender, thisEvent) {" & vbCrLf) strJavaScript.Append("var objRadComboBox = $find(thisSender.id.replace(""_DropDownList"", """"));" & vbCrLf) strJavaScript.Append("objRadComboBox.trackChanges();" & vbCrLf) strJavaScript.Append("objRadComboBox.findItemByValue(thisSender.value).select();" & vbCrLf) strJavaScript.Append("objRadComboBox.updateClientState();" & vbCrLf) strJavaScript.Append("objRadComboBox.commitChanges();" & vbCrLf) strJavaScript.Append("}" & vbCrLf & vbCrLf) ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType, "DropDownList_IndexChanged", strJavaScript.ToString, True) End If End Sub ''' <summary>ddlRadComboBox_PreRender</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.PreRender RaiseEvent PreRender(sender, e) End Sub ''' <summary>ddlRadComboBox_DataBinding</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.DataBinding RaiseEvent DataBinding(sender, e) End Sub ''' <summary>ddlRadComboBox_DataBound</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.DataBound RaiseEvent DataBound(sender, e) End Sub ''' <summary>ddlRadComboBox_Disposed</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.Disposed RaiseEvent Disposed(sender, e) End Sub ''' <summary>ddlRadComboBox_Init</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.Init RaiseEvent Init(sender, e) End Sub ''' <summary>ddlRadComboBox_ItemCreated</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles ddlRadComboBox.ItemCreated RaiseEvent ItemCreated(sender, e) End Sub ''' <summary>ddlRadComboBox_ItemDataBound</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles ddlRadComboBox.ItemDataBound RaiseEvent ItemDataBound(sender, e) End Sub ''' <summary>ddlRadComboBox_ItemsRequested</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_ItemsRequested(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles ddlRadComboBox.ItemsRequested RaiseEvent ItemsRequested(o, e) End Sub ''' <summary>ddlRadComboBox_Load</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.Load RaiseEvent Load(sender, e) End Sub ''' <summary>ddlRadComboBox_SelectedIndexChanged</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_SelectedIndexChanged(ByVal o As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.SelectedIndexChanged 'Set the ID to the user control's ID, and raise the event with the appropriate control Dim strOriginalID As String If (Me.RenderMode = RenderingMode.RadComboBox) Then strOriginalID = ddlRadComboBox.ID ddlRadComboBox.ID = Me.ID RaiseEvent SelectedIndexChanged(ddlRadComboBox, Nothing) ddlRadComboBox.ID = strOriginalID ElseIf (Me.RenderMode = RenderingMode.DropDownList) Then strOriginalID = placeholderDropDownList.Controls(0).ID placeholderDropDownList.Controls(0).ID = Me.ID RaiseEvent SelectedIndexChanged(placeholderDropDownList.Controls(0), Nothing) placeholderDropDownList.Controls(0).ID = strOriginalID End If End Sub ''' <summary>ddlRadComboBox_TextChanged</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.TextChanged RaiseEvent TextChanged(sender, e) End Sub ''' <summary>ddlRadComboBox_Unload</summary> ''' <remarks></remarks> Protected Sub ddlRadComboBox_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlRadComboBox.Unload RaiseEvent Unload(sender, e) End Sub #End Region #Region "Sub Procedures" ''' <summary>Focus</summary> ''' <remarks></remarks> Public Overrides Sub Focus() If (Me.RenderMode = RenderingMode.RadComboBox) Then ddlRadComboBox.Focus() ElseIf (Me.RenderMode = RenderingMode.DropDownList) Then placeholderDropDownList.Controls(0).Focus() End If End Sub ''' <summary>ClearSelection</summary> ''' <remarks></remarks> Public Sub ClearSelection() If (Me.RenderMode = RenderingMode.RadComboBox) Then ddlRadComboBox.ClearSelection() ElseIf (Me.RenderMode = RenderingMode.DropDownList) Then CType(placeholderDropDownList.Controls(0), DropDownList).ClearSelection() End If End Sub #End Region #Region "Functions" ''' <summary>FindItemByText</summary> ''' <remarks></remarks> Public Function FindItemByText(ByRef strItemText As String) As RadComboBoxItem Return ddlRadComboBox.FindItemByText(strItemText) End Function ''' <summary>FindItemIndexByText</summary> ''' <remarks></remarks> Public Function FindItemIndexByText(ByRef strItemText As String) As Integer Return ddlRadComboBox.FindItemIndexByText(strItemText) End Function ''' <summary>FindItemIndexByText</summary> ''' <remarks></remarks> Public Function FindItemIndexByText(ByRef strItemText As String, ByRef boolIgnoreCase As Boolean) As Integer Return ddlRadComboBox.FindItemIndexByText(strItemText, boolIgnoreCase) End Function ''' <summary>FindItemIndexByValue</summary> ''' <remarks></remarks> Public Function FindItemIndexByValue(ByRef strItemValue As String) As Integer Return ddlRadComboBox.FindItemIndexByValue(strItemValue) End Function ''' <summary>FindItemIndexByValue</summary> ''' <remarks></remarks> Public Function FindItemIndexByValue(ByRef strItemValue As String, ByRef boolIgnoreCase As Boolean) As Integer Return ddlRadComboBox.FindItemIndexByValue(strItemValue, boolIgnoreCase) End Function #End Region End Class0
Orin Book
Top achievements
Rank 1
answered on 25 Apr 2011, 03:36 PM
Bravo. Great job. We are awaiting a final decision from the ARMY whether to dropped Telerik because of this requirement. We gave them the cost estimate for redesign and they choked. They are quickly moving to smartphone web applications on the premise of code once use on multiple devices.