I have 3 DropDownLists on the page : one for a Month, second one for a Day, and the last one for a Year. How can I let the user choose the data and enter it to ‘datetime’ column in the database.
VB.NET Dim dt as DateTime = DateTime.Parse(ddlMonth.SelectedItem.Text & '/' & ddlDay.SelectedItem.Text & '/' & ddlYear.SelectedItem.Text ) C# DateTime dt = DateTime.Parse(ddlMonth.SelectedItem.Text & '/' & ddlDay.SelectedItem.Text & '/' & ddlYear.SelectedItem.Text );
How to programmatically set the width of the textbox control
VB.NET TextBox1.Width = Unit.Pixel(100) C# TextBox1.Width = Unit.Pixel(100);
How to clear all the textboxes in my form
VB.NET Dim ctl As Control For Each ctl In Page.Controls(1).Controls If TypeOf ctl Is TextBox Then CType(ctl, TextBox).Text = '' End If Next C# foreach (Control ctl in Page.Controls[1].Controls ) { TextBox tb = ctl as TextBox; if (tb!=null) { tb.Text = '' ; } } Note: Page.Controls[1]=> control is within the tag
How to align the Text property of the Textbox Control?
VB.NET TextBox1.Style('text-align')='right' C# TextBox1.Style['text-align']='right';
How to display only date part in the Datagrid if the Date is of DateTime datatype in the database
Set the DateFormatString as {0:d}