4 Answers, 1 is accepted
0
OD
Top achievements
Rank 1
answered on 07 Sep 2011, 09:55 AM
up !
0
Hello Nermond,
The SelectedValue property contains the value represented by the DisplayMember property. That is why its value contains HTML tags. You can strip all HTML tags by using the following code:
The HTML-like formatting is a feature integrated in our Telerik Presentation Framework. However, RadMultiColumnComboBox uses the default WinForms TextBox to allow editing. It cannot present rich text and HTML tags should be striped. You can do this by handling the TextChanged event. Please consider the code snippet below:
I hope this helps. If you need further assistance, please do not hesitate to ask.
All the best,
Peter
the Telerik team
The SelectedValue property contains the value represented by the DisplayMember property. That is why its value contains HTML tags. You can strip all HTML tags by using the following code:
string
strResult = Regex.Replace(strInput,@
"<(.|\n)*?>"
,
string
.Empty);
The HTML-like formatting is a feature integrated in our Telerik Presentation Framework. However, RadMultiColumnComboBox uses the default WinForms TextBox to allow editing. It cannot present rich text and HTML tags should be striped. You can do this by handling the TextChanged event. Please consider the code snippet below:
radMultiColumnComboBox1.MultiColumnComboBoxElement.TextBoxElement.TextBoxItem.HostedControl.TextChanged +=
new
EventHandler(HostedControl_TextChanged);
void
HostedControl_TextChanged(
object
sender, EventArgs e)
{
TextBox textbox = (TextBox)sender;
textbox.Text = Regex.Replace(textbox.Text, @
"<(.|\n)*?>"
,
string
.Empty);;
}
I hope this helps. If you need further assistance, please do not hesitate to ask.
All the best,
Peter
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
0
OD
Top achievements
Rank 1
answered on 08 Sep 2011, 10:23 AM
Cool that works :)
Thanks
I've tried many times with the SelectedIndexChanged event, but was not the good event ^^
Nother question: now i don't see the html tags, that's good, but the selected item is not html formated. Is there a way to enable html rendering without seeing the tags ?
Thanks
I've tried many times with the SelectedIndexChanged event, but was not the good event ^^
Nother question: now i don't see the html tags, that's good, but the selected item is not html formated. Is there a way to enable html rendering without seeing the tags ?
0
Hi Nermond,
You cannot show an HTML formatted text in the TextBox. However, there is a work around which covers the case when you do not need to edit the text. You can hide the RadTextBox which is inside RadMultiColumnComboBox and put there a LightVisualElement that supports HTML-like formatting. Please consider the code snippet below:
Do not hesitate to contact us if you have other questions.
Regards,
Peter
the Telerik team
You cannot show an HTML formatted text in the TextBox. However, there is a work around which covers the case when you do not need to edit the text. You can hide the RadTextBox which is inside RadMultiColumnComboBox and put there a LightVisualElement that supports HTML-like formatting. Please consider the code snippet below:
LightVisualElement lve =
new
LightVisualElement();
private
void
Form_Load(
object
sender, EventArgs e)
{ radMultiColumnComboBox1.MultiColumnComboBoxElement.TextBoxElement.TextBoxItem.HostedControl.TextChanged +=
new
EventHandler(HostedControl_TextChanged);
lve.TextAlignment = ContentAlignment.MiddleLeft;
lve.Alignment = ContentAlignment.MiddleLeft;
lve.MaxSize =
new
Size(radMultiColumnComboBox1.Size.Width - 15, radMultiColumnComboBox1.Size.Height);
radMultiColumnComboBox1.MultiColumnComboBoxElement.TextBoxElement.Visibility = ElementVisibility.Hidden;
radMultiColumnComboBox1.MultiColumnComboBoxElement.Children.Add(lve);
}
private
void
HostedControl_TextChanged(
object
sender, EventArgs e)
{
TextBox textbox = (TextBox)sender;
lve.Text = textbox.Text;
}
Do not hesitate to contact us if you have other questions.
Regards,
Peter
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>