Skip to main content

Posts

Showing posts with the label asp.net

To change the background color or to change the inner text of a item in dropdown

To change the background color or to change the inner text of a item in dropdown // Loop around the dropdown for (row = 0; row < ddlUserName.Items.Count; row++) { // To color a particular user name if (ddlUserName.Items[row].Value == this.USERID.ToString()) ddlUserName.Items[row].Attributes.Add("style", "background-color:" + "#663333;color:#ffffff;"); }

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.

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.