How to find out what version of ASP.NET I am using on my machine?
VB.NET Response.Write(System.Environment.Version.ToString() ) C# Response.Write(System.Environment.Version.ToString() );
How to Format and display currency with n decimal points in a BoundColumn.
Set the Dataformatstring of the boundcolumn to {0:Nn} where n=> number of decimal points For more details refer Format Function
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