Skip to main content

Posts

To display the message box in asp.net

Use the namespace using System.Runtime.InteropServices; Then use DllImport " DllImportAttribute Class Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a static entry point." Use the lines below [ DllImport ( "user32.dll" , CharSet = CharSet .Unicode)] public static extern int MessageBox( IntPtr hWnd, String Text, String Caption, uint type); InPtr This type implements the ISerializable interface. And then put this code MessageBox( new IntPtr (0), "Hello World" , "Hello Dialog name" , 0); Note: The DllImportAttribute does not support marshaling of generic types.

To get the row number in SQL2000.

SELECT *, (SELECT COUNT(*) FROM Mas_Company e2 WHERE e2.Company_Code <= e.Company_Code) AS 'rownumber' , Mas_Company.*, Company_Code AS Expr1, Company_Name AS Expr2, Company_SName AS Expr3, Company_Add1 AS Expr4, Company_Add2 AS Expr5, Company_City AS Expr6, Company_Pincode AS Expr7, Company_ph_no AS Expr8, Company_Active_Flag AS Expr9 FROM Mas_Company e

Grid View CSS

The css for the grid view .grdFrame { border-style:solid; border-color:#BDCAD0; border-width:1px; } .grdHeaderStyle { font-family:"Trebuchet MS"; font-size:9pt; font-weight:bold; color:#015aad; text-decoration:none; background-color:#cfdfe9; border-bottom-style:solid; border-bottom-color:#BDCAD0; border-bottom-width:1px; height: 25px; padding-left:5px; text-align: left; } .grdRowStyle { font-family:Helvetica; font-size:9pt; color:#191A1C; font-weight:400; display:block; text-decoration:none; background-color:#FFFFFF; border-bottom-style:solid; border-bottom-color:#BDCAD0; border-bottom-width:1px; padding-left: 5px; padding-right: 5px; text-align:left; height: 30px; text-align:left; } .grdAltRowStyle { font-family:Helvetica; font-size:9pt; font-weight:400; display:block; color:#191A1C; text-decoration:none; background-color:#

ASP.NET Questions

Why are you more likely to use HtmlControls rather than WebControls when migrating from ASP? Choice 1 ASP pages are made from HTML elements, not controls, which map to the HtmlControls better. Choice 2 HtmlControls involve less development effort. Choice 3 HtmlControls have the same syntax as ASP HtmlControls. Choice 4 HtmlControls can be used to transfer ASP session state. Choice 5 ASP also uses HtmlControls. In a Web application, how many security-related events does the global.asax file provide? Choice 1 1 Choice 2 2 Choice 3 3 Choice 4 4 Choice 5 More than 4 Why does the Page object have an IsPostback property? Choice 1 It is used to know that control events need to be thrown. Choice 2 It is used in the Application_BeginRequest event to decide whether to authenticate a user. Choice 3 It is used so that the Page can determine whether to load Viewstate. Choice 4 It is used to determine whether to throw the Page_PostBack event. Choice 5 It is used so that the controls can be loaded wi

Multi Lingual page ASP.NET

Here the commented part would be the client side calling in ASP.NET file using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Resources; namespace NewMultiLingual { /// /// Summary description for WebForm1. /// public class WebForm1 : System.Web.UI.Page { protected System.Web.UI.WebControls.Literal usernameLabel; protected System.Web.UI.WebControls.TextBox username; protected System.Web.UI.WebControls.Literal passwordLabel; protected System.Web.UI.WebControls.TextBox password; protected System.Web.UI.WebControls.Button login; private void Page_Load(object sender, System.EventArgs e) { ResourceManager Rm1 = new ResourceManager("NewMultiLingual.Resource",System.Reflection.Assembly.GetExecutingAssembly()); usernameLabel.Text = Rm1.GetString("Username"); passwordLabe

ASP.NET

Blog on ASP.NET New in ASP .NET Better language support Programmable controls Event-driven programming XML-based components User authentication, with accounts and roles Higher scalability Increased performance - Compiled code Easier configuration and deployment Not fully ASP compatible Language Support ASP .NET uses the new ADO .NET. ASP .NET supports full Visual Basic, not VBScript. ASP .NET supports C# (C sharp) and C++. ASP .NET supports JScript as before.

C#

Namespaces Namespaces are C# program elements designed to help you organize your programs. They also provide assistance in avoiding name clashes between two sets of code.

SQL

*********************************************************************************** Deleting duplicate records in a table select DISTINCT * into #temp from table1 --apply where condition delete from table1 insert table1 select * from #temp drop table #temp table names starts with # will truncated and dropped after application end *********************************************************************************** get day from date sql datename("dw",getdate()) *********************************************************************************** select getdate() To convert a given date to normal format select convert(nvarchar(12),getdate(),103) ***********************************************************************************

To invoke a specified application at specified time

This is the windows service which will invoke a application at 5.30 pm Here I am invoking a web page using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.ServiceProcess; using System.Timers; using System.Configuration; using System.Globalization; namespace WinWin { public class WinService1 : System.ServiceProcess.ServiceBase { /// /// Required designer variable. /// /// // private System.Timers.Timer aTimer; private System.ComponentModel.Container components = null; //private System.Timers.Timer aTimer = new System.Timers.Timer(); //private System.ComponentModel.Container components = null; private System.Timers.Timer aTimer; public WinService1() { //System.Timers.Timer aTimer; // This call is required by the Windows.Forms Component Designer. InitializeComponent(); // TODO: Add any initialization after the InitComponent call } // The main entry point for the process //pr