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

Adding a text box to splt button drop down

2 Answers 133 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 31 Jan 2007, 02:25 AM
Is it possible to display a text box in the drop down of a split button. I assume it is possible from the example of adding a custom element to the RadMenu. However, it is not clear how to.

My attempt at doing this
            RadMenuContentItem contentTextBox = new RadMenuContentItem();  
 
            RadTextBoxElement RadtextBoxNoteElement = new RadTextBoxElement();  
 
            RadtextBoxNoteElement.Size = new Size(139, 15);  
 
            contentTextBox.ContentElement = RadtextBoxNoteElement;  
              
 
            this.radSplitButton1.Items.Add(contentTextBox); 

I am using Q4 2006 SP1 version.

Thanks
Peter

2 Answers, 1 is accepted

Sort by
0
Peter
Top achievements
Rank 1
answered on 31 Jan 2007, 05:43 AM
I have been able to display the textbox however i cannot type in the textbox. I changed from splitbutton to dropdownbutton.

Current code is

RadTextBoxItem NoteTextBoxitem = new RadTextBoxItem();

NoteTextBoxitem.Name = "NoteTextBox";

radDropDownButton1.Items.Add(NoteTextBoxitem);

Do I have to create an instance of RadTextBoxElement? I tried but could not see how to associate NoteTextBoxitem with RadTextBoxElement.

0
Georgi
Telerik team
answered on 31 Jan 2007, 03:02 PM
Hi Peter,

The right approach to add a textbox in the split button item is as follows:

private void Form1_Load(object sender, EventArgs e)  
        {             
            RadMenuContentItem item1 = new RadMenuContentItem();      
            RadTextBoxElement text1 = new RadTextBoxElement();  
            text1.Text = "text1";  
            text1.MaxSize = new Size(50, 0); //here is set the desired width for the textbox
            item1.ContentElement = text1;  
            item1.ContentElement.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;  
            radSplitButton1.Items.Add(item1);  
 
            RadMenuContentItem item2 = new RadMenuContentItem();  
            RadTextBoxElement text2 = new RadTextBoxElement();  
            text2.Text = "text2";  
            text2.MaxSize = new Size(50, 0);  
            item2.ContentElement = text2;  
            item2.ContentElement.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;  
            radSplitButton1.Items.Add(item2);  
 
        } 
 
Unfortunately, there is a problem related to the focus behavior of the textbox when it is nested in other controls. Currently we're working on that issue and it will be finalized for the Q4 SP2 release. We're sorry for the inconvenience.
 

Sincerely yours,
Georgi
the telerik team
Tags
TextBox
Asked by
Peter
Top achievements
Rank 1
Answers by
Peter
Top achievements
Rank 1
Georgi
Telerik team
Share this question
or