Browsed by
Tag: Interview Questions on ASP.NET

What is ViewState?

What is ViewState?

ViewState is used to retain the state of server-side objects between page post backs. In ASP.NET, ViewState is a client-side state management technique used to preserve the state of server-side controls (such as textboxes, dropdown lists, etc.) across postbacks. When a web page is posted back to the server, ViewState stores the values of those controls in a hidden field on the page. When the page is reloaded, ASP.NET uses the ViewState to restore the state of the controls to…

Read More Read More

Can we have multiple web config files for an asp.net application?

Can we have multiple web config files for an asp.net application?

Yes. In ASP.NET applications, typically, only one web.config file is used per application. However, you can have multiple web.config files in different directories within the application’s folder structure. These additional web.config files can be used to override or supplement settings specified in the root web.config. For example, if you have a subdirectory within your ASP.NET application that needs specific configurations different from the root web.config, you can place a web.config file in that subdirectory to provide those configurations. This allows…

Read More Read More

Which data type does the RangeValidator control support?

Which data type does the RangeValidator control support?

The data types supported by the RangeValidator control are Integer, Double, String, Currency, and Date. The RangeValidator control in ASP.NET supports the following data types: Integer: Validates that the input falls within a specified range of integer values. Double: Validates that the input falls within a specified range of double-precision floating-point values. Currency: Validates that the input falls within a specified range of currency values. Date: Validates that the input falls within a specified range of dates. String length: Validates…

Read More Read More

What is view state in ASP.NET?

What is view state in ASP.NET?

View state is where data is used to preserve page values and control values of Web Forms during postback event handling. Data can be stored as hidden fields on the client web page. In ASP.NET, the view state is a client-side state management technique used to persist the state of a web page across postbacks. When a web form is submitted to the server and a response is sent back to the client, the view state ensures that the state…

Read More Read More

What is Razor in ASP.NET

What is Razor in ASP.NET

Razor is a markup syntax that lets you embed server-based code (Visual Basic and C#) into web pages. The server-based code can create dynamic web content on the fly, while a web page is written to the browser. When a web page is called, the server executes the server-based code inside the page before it returns the page to the browser. By running on the server, the code can perform complex tasks, like accessing databases. Razor is based on ASP.NET,…

Read More Read More

Describe login Controls in ASP?

Describe login Controls in ASP?

The Login control provides the user interface to log a user into a web site. The Login control uses the Membership service to authenticate the user in your membership system. The default Membership service from your configuration file will be used automatically, however you can also set the Membership provider that you would like used as a property on the control. The Login Control consists of, Username Label and Textbox: Collects the string used to identify the user in the…

Read More Read More

Where the viewstate is stored after the page postback?

Where the viewstate is stored after the page postback?

ViewState is stored in a hidden field on the page at client side. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. In ASP.NET, after a page postback, the ViewState is stored in the __VIEWSTATE hidden field. This hidden field is automatically generated by ASP.NET and is sent to the client along with the page’s HTML. Upon postback, the contents of the ViewState are sent back…

Read More Read More

What is the difference between web config and machine config?

What is the difference between web config and machine config?

Web config file is specific to a web application where as machine config is specific to a machine or server. There can be multiple web config files into an application where as we can have only one machine config file on a server. In an ASP.NET interview, if you’re asked about the difference between web.config and machine.config, you can provide the following explanation: Scope: machine.config: This file is located in the CONFIG directory of the .NET Framework installation and applies…

Read More Read More

What is the difference between an HtmlInputCheckBox control and an HtmlInputRadioButton control?

What is the difference between an HtmlInputCheckBox control and an HtmlInputRadioButton control?

In HtmlInputCheckBoxcontrol, multiple item selection is possible whereas in HtmlInputRadioButton controls, we can select only single item from the group of items. The main difference between an HtmlInputCheckBox control and an HtmlInputRadioButton control lies in their functionality and purpose in web forms: HtmlInputCheckBox Control: Represents a checkbox input element in HTML. Allows users to select multiple options from a list of choices. Each checkbox operates independently, meaning users can select or deselect each checkbox individually. Suitable for scenarios where users…

Read More Read More

What is the difference between custom controls and user controls?

What is the difference between custom controls and user controls?

Custom controls are basically compiled code, i.e., DLLs. These can be easily added to the toolbox, so it can be easily used across multiple projects using a drag-and-drop approach. These controls are comparatively hard to create. But User Controls (.ascx) are just like pages (.aspx). These are comparatively easy to create but tightly coupled with respect to User Interface and code.