Nick Gebbett
Top achievements
Rank 1
Nick Gebbett
asked on 28 Sep 2010, 01:41 PM
this.RadDropDownList_LocationType.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList;
this.RadDropDownList_LocationType.Location = new System.Drawing.Point(4, 4);
this.RadDropDownList_LocationType.Name = "RadDropDownList_LocationType";
this.RadDropDownList_LocationType.NullText = "Please Select";
this.RadDropDownList_LocationType.Size = new System.Drawing.Size(123, 18);
this.RadDropDownList_LocationType.TabIndex = 0;
14 Answers, 1 is accepted
0
Emanuel Varga
Top achievements
Rank 1
answered on 29 Sep 2010, 07:46 AM
Hello Alexander,
Yes, this is true, when the DropDownStyle is set to DropDownList the null text is no longer visible, but the Text property should work fine as a NullText until a fix will be issued.
Best Regards,
Emanuel Varga
Yes, this is true, when the DropDownStyle is set to DropDownList the null text is no longer visible, but the Text property should work fine as a NullText until a fix will be issued.
Best Regards,
Emanuel Varga
0
Indeed, Emanuel is correct.
By design the text defined by the NullText property is displayed in the editor's input box when the editor is not in DropDownList mode. We actually set RadTextBox's Null Text property but in DropDownList mode this textbox is not visible. This is why you can't see the Null text.
I hope this explanation clarifies the situation.
the Telerik team
By design the text defined by the NullText property is displayed in the editor's input box when the editor is not in DropDownList mode. We actually set RadTextBox's Null Text property but in DropDownList mode this textbox is not visible. This is why you can't see the Null text.
I hope this explanation clarifies the situation.
Sincerely yours,
Peterthe 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
Nick Gebbett
Top achievements
Rank 1
answered on 05 Oct 2010, 09:47 AM
I definitely not understand why this is designed and how to show user "Please select" option when SelectedValue = null
0
Emanuel Varga
Top achievements
Rank 1
answered on 06 Oct 2010, 05:52 PM
Hello Alexander,
The solution I've offered would do the trick, like i said, assign to the Text property the text you want to show when no item is selected, after the user selects something from the list, that text will no longer be visible. One downside of that is the fact that it's not a faded text and it's not italic.
In my point of view, if and until that NullText property will work for the DropDownList style, this is the way to go (or create a dummy first element in your collection, handle the selected index changed event, and when new index != 0 remove that element from the collection)
Hope this helps, if you have any other questions, please let me know,
Best Regards,
Emanuel Varga
The solution I've offered would do the trick, like i said, assign to the Text property the text you want to show when no item is selected, after the user selects something from the list, that text will no longer be visible. One downside of that is the fact that it's not a faded text and it's not italic.
In my point of view, if and until that NullText property will work for the DropDownList style, this is the way to go (or create a dummy first element in your collection, handle the selected index changed event, and when new index != 0 remove that element from the collection)
Hope this helps, if you have any other questions, please let me know,
Best Regards,
Emanuel Varga
0
Nick Gebbett
Top achievements
Rank 1
answered on 07 Oct 2010, 02:52 PM
In case of my application it is not an option to use DropDownStyle.DropDown
So you are right, the only way I see is to create a dummy objects in all DropDowns. Thank you.
But it is not useful.
I'm trying to understand why RadDropDown works like that. What so bad will happene if RadDropDown.NullText shows the string I need in DropDownList mode? =)
So you are right, the only way I see is to create a dummy objects in all DropDowns. Thank you.
But it is not useful.
I'm trying to understand why RadDropDown works like that. What so bad will happene if RadDropDown.NullText shows the string I need in DropDownList mode? =)
0
Emanuel Varga
Top achievements
Rank 1
answered on 07 Oct 2010, 03:06 PM
Hello Alexander,
I completely agree with you that the null text should be shown whenever there is no item selected in a DropDownList, but until they will fix this, i would suggest you try this workaround:
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
I completely agree with you that the null text should be shown whenever there is no item selected in a DropDownList, but until they will fix this, i would suggest you try this workaround:
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
Telerik.WinControls.UI;
namespace
TestDropDownListNullText
{
public
partial
class
Form1 : Form
{
public
RadDropDownList radDropDownList1;
public
Form1()
{
InitializeComponent();
this
.Load +=
new
EventHandler(Form1_Load);
}
void
Form1_Load(
object
sender, EventArgs e)
{
radDropDownList1 =
new
RadDropDownList();
radDropDownList1.Dock = DockStyle.Top;
this
.Controls.Add(radDropDownList1);
radDropDownList1.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList;
radDropDownList1.PopupClosing +=
new
RadPopupClosingEventHandler(radDropDownList1_PopupClosing);
radDropDownList1.DataSource =
new
TestsCollection(10);
radDropDownList1.DisplayMember =
"Name"
;
radDropDownList1.Text =
"Please select something..."
;
}
void
radDropDownList1_PopupClosing(
object
sender, RadPopupClosingEventArgs args)
{
if
(
string
.IsNullOrEmpty(radDropDownList1.Text))
{
radDropDownList1.Text =
"Please select something..."
;
}
}
}
#region Business Objects
public
class
Test
{
public
int
Id
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
Test(
int
id,
string
name)
{
this
.Id = id;
this
.Name = name;
}
}
public
class
TestsCollection : List<Test>
{
public
TestsCollection(
int
noItems)
{
for
(
int
i = 0; i < noItems; i++)
{
this
.Add(
new
Test(i,
"test"
+ i));
}
}
}
#endregion Business Objects
}
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
0
François
Top achievements
Rank 1
answered on 30 Nov 2011, 04:44 PM
Is this feature in telerik roadmap? To see nulltext with null value as first item when DropDownStyle is set to DropDownList?
0
Hello Alexander,
Peter
the Telerik team
Thanks for writing back.
You can easily workaround this by setting the Text property instead of NullText property in this mode.
Please refer to the attached project. Also, you can use the Emanuel's solution.
I hope this helps.
Peter
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
Jared
Top achievements
Rank 2
answered on 10 May 2018, 02:28 PM
Please vote to have this feature added to DropDownList here:
https://feedback.telerik.com/Project/154/Feedback/Details/249059-add-nulltext-functionality-to-raddropdownlist-when-in-dropdownstyle-is-dropdownli
0
Hello Jared,
As my colleague has written earlier in the thread the NullText property is rendered by the input text box. Having the control set up in DropDownList mode will not render the null text. To achieve a similar behavior you can follow the approach already discussed in the thread.
Regards,
Hristo
Progress Telerik
As my colleague has written earlier in the thread the NullText property is rendered by the input text box. Having the control set up in DropDownList mode will not render the null text. To achieve a similar behavior you can follow the approach already discussed in the thread.
Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Mehdi
Top achievements
Rank 1
answered on 23 Aug 2018, 10:37 PM
Hi guys.
I'm read thread. but cannot find my solution.
need to wait for new update?
0
Hi Mehdi,
We have a feature request logged on our feedback portal, here: ADD. RadDropDownList - NullText functionality to RadDropDownList when in DropDownStyle is DropDownList.. Please subscribe to the item so that you can be updated when its status changes.
Regards,
Hristo
Progress Telerik
We have a feature request logged on our feedback portal, here: ADD. RadDropDownList - NullText functionality to RadDropDownList when in DropDownStyle is DropDownList.. Please subscribe to the item so that you can be updated when its status changes.
Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Mehdi
Top achievements
Rank 1
answered on 24 Aug 2018, 08:01 AM
Hi Hristo.
I'm Subscribe and wait for update.
but i can to solve this problem by this snipped code.
i'm add this code to Public and after InitializeComponent. this work correctly.
may another can use this. ;-)
if
(txtbadge.SelectedIndex == -1)
{
txtbadge.Text =
"please select an item ... "
;
txtbadge.ForeColor = Color.FromArgb(0, 77, 64);
}
else
{
txtbadge.ForeColor = Color.White;
}
0
Hi Mehdi,
Thank you for sharing your solution with the community.
Regards,
Hristo
Progress Telerik
Thank you for sharing your solution with the community.
Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.