How can I use Session variables in a class
Use HttpContext.Current.Session VB.NET HttpContext.Current.Session(‘Value1’) = ‘1’ C# HttpContext.Current.Session[‘Value1’] = ‘1’; In similar manner you can use Application Variables too.
Is there a TextArea in ASP.NET
You can use the TextBox webserver control and set the TextMode = MultiLine
How can I show what page the user is on using in-built paging functionality. CurrentPageIndex Property Shows Up as 0
In PageIndexChanged event write VB.NET Dim pageindex As Integer = DataGrid1.CurrentPageIndex + 1 LblPageInfo.Text = ‘Page ‘ + pageindex.ToString() + ‘ of ‘ + DataGrid1.PageCount.ToString() C# int pageindex = DataGrid1.CurrentPageIndex + 1 ; LblPageInfo.Text = ‘Page ‘ + pageindex.ToString() + ‘ of ‘ + DataGrid1.PageCount.ToString() ;
When I try to enter a null value for DataTime in Database I get error message ‘String was not recognized as a valid DateTime’ or ‘Value of type ‘System.DBNull’ cannot be converted to ‘String”
Use namespace System.Data.SqlTypes VB.NET Dim sqldatenull As SqlDateTime sqldatenull = SqlDateTime.Null If (txtDate.Text = ”) Then cmd.Parameters(‘@Date’).Value = sqldatenull ’cmd.Parameters(‘@Date’).Value = DBNull.Value Else cmd.Parameters(‘@Date’).Value = DateTime.Parse(txtDate.Text) End If C# if (txtDate.Text == ”) { cmd.Parameters [‘@Date’].Value =sqldatenull ; //cmd.Parameters[‘@Date’].Value = DBNull.Value; } else { cmd.Parameters[‘@Date’].Value = DateTime.Parse(txtDate.Text); }
How to open a browser window with maximum size on click of a button
VB.NET Button1.Attributes.Add(‘onclick’, ‘window.open(’page2.aspx’,’’,’fullscreen=yes’)’) C# Button1.Attributes.Add(‘onclick’, ‘window.open(’page2.aspx’,’’,’fullscreen=yes’)’);