I dynamically create Textboxes with C# in my Sharepoint project like so:
boxRequestDate = new TextBox
{
CssClass = "dplatypus-webform-field-input",
Text = DateTime.Today.ToShortDateString()
};
...but I need ComboBoxes (or their HTML equivalent), too, at times. How is that done? "ComboBox" is not recognized in Sharepoint. Surely there's a way to create a TextBox (input element of type text) that "acts like" a combo box.
Specifically, I need to create controls that act as the elements (no pun intended) of a date, namely a "Month" combo box containing the vals January...December, a "Days of Month" control containing vals from 1..[28...31], and a "Year" combobox with say, 2000 to 2016.
How is this done, programmatically, in C#?
UPDATE
It may turn out that this, or something like it, will work:
boxReturnDateMonth = new TextBox
{
CssClass = "dplatypus-webform-field-input",
TextMode = TextBoxMode.MultiLine,
Rows = 12
};
boxReturnDateMonth.Text.Insert(0, "Jan");
boxReturnDateMonth.Text.Insert(1, "Feb");
boxReturnDateMonth.Text.Insert(2, "Mar");
boxReturnDateMonth.Text.Insert(3, "Apr");
boxReturnDateMonth.Text.Insert(4, "May");
boxReturnDateMonth.Text.Insert(5, "Jun");
boxReturnDateMonth.Text.Insert(6, "Jul");
boxReturnDateMonth.Text.Insert(7, "Aug");
boxReturnDateMonth.Text.Insert(8, "Sep");
boxReturnDateMonth.Text.Insert(9, "Oct");
boxReturnDateMonth.Text.Insert(10, "Nov");
boxReturnDateMonth.Text.Insert(11, "Dec");
IOW, use a Textbox, but sets its TextMode to Multiline, assing a count of rows (entries), and then add those entries.