1. Explain about validation controls in asp.net?
There are 6 Validator Controls. They are
- Requiredfield Control
- Compare validator
- Range validator
- Regular Expression validator
- Custom validator
- Validation summary
2. When we will go for custom validator control?
Whenever our validation requirement is unable to achieve with the help of
Existing validation controls then we have to go for CUSTOM VALIDATOR
CONTROL.
3. What are the 2 types of controls that you can use on a webform in ASP.NET?
Web Server Controls
HTML Controls
Web Server Controls
HTML Controls
4. What’s the difference between Server controls and HTML controls?
- Server controls can trigger control-specific events on the server.HTML controls can trigger only page-level events on the server (postback).
- Data entered in a server control is maintained across requests. The server controls the retain state. Data is not maintained in an HTML control. Data must be saved and restored using page-level scripts.
- The Microsoft .NET Framework provides a set of properties for each server control. Properties allow you to change the server control’s appearance and behavior within server-side code.HTML controls have HTML attributes only.
- Server controls automatically detect the browser and adapt display as appropriate.HTML controls do not adapt automatically. You must detect browser in code or write for the least common denominator.
5. Give 3 reasons why we use HTML controls over Server Controls?
Migration from earlier versions of Active Server Pages (ASP) :
We can load an ASP application into Visual Studio and revise it gradually, rather than rewrite it completely. Earlier versions of ASP supported only HTML elements, and these elements become HTML controls when we load the project in Visual Studio .NET.
Not all controls require server-side events or state management :
This is particularly true when we are doing the data binding. Bound items are usually refreshed from the data source with each request, so it’s more efficient not to maintain state information for bound controls. This means that we can use HTML controls or turn off state management for bound server controls.
We have complete control over what is rendered with HTML controls: ASP.NET adjusts the appearance of server controls based on the browser making the request. HTML controls are not adjusted, so we have direct control over their appearance.
Migration from earlier versions of Active Server Pages (ASP) :
We can load an ASP application into Visual Studio and revise it gradually, rather than rewrite it completely. Earlier versions of ASP supported only HTML elements, and these elements become HTML controls when we load the project in Visual Studio .NET.
Not all controls require server-side events or state management :
This is particularly true when we are doing the data binding. Bound items are usually refreshed from the data source with each request, so it’s more efficient not to maintain state information for bound controls. This means that we can use HTML controls or turn off state management for bound server controls.
We have complete control over what is rendered with HTML controls: ASP.NET adjusts the appearance of server controls based on the browser making the request. HTML controls are not adjusted, so we have direct control over their appearance.
6. How can you prevent users from editing Text in TextBox control on a web form?
By making the TextBox a readonly TextBox. To make a TextBox readonly set the ReadOnly property to True.
By making the TextBox a readonly TextBox. To make a TextBox readonly set the ReadOnly property to True.
7. How do you convert an ASP.NET TextBox to accept passwords?
To convert and ASP.NET TextBox to accept passwords set the TextMode property to "Password"
To convert and ASP.NET TextBox to accept passwords set the TextMode property to "Password"
8. What happens when you set the AutoPostBack property of a TextBox to true?
When AutoPostBack property is set to True, the TextBox control fires a TextChanged postback event when the user leaves the TextBox control after changing the contents. By default, this property is set to False and the TextChanged event is cached until some other postback event occurs.
When AutoPostBack property is set to True, the TextBox control fires a TextChanged postback event when the user leaves the TextBox control after changing the contents. By default, this property is set to False and the TextChanged event is cached until some other postback event occurs.
9. What are the 3 values that a TextMode property of TextBox can have?
SingleLine : Single Line TextBox
MultiLine : Multi Line TextBox(scrollable)
Password: When setting to Password, the text box displays dots in place of the characters typed.
SingleLine : Single Line TextBox
MultiLine : Multi Line TextBox(scrollable)
Password: When setting to Password, the text box displays dots in place of the characters typed.
10. How do you limit the number of characters entered by a user in the ASP.NET TextBox?
By setting the MaxLength property of the TextBox. If you set the MaxLength property to 10, a user can enter only 10 characters into the TextBox.
By setting the MaxLength property of the TextBox. If you set the MaxLength property to 10, a user can enter only 10 characters into the TextBox.
11. Which is the parent class of the Web server control?
The System.Web.UI.Control class is the parent class for all Web server controls.12. Can you explain AutoPostBack?
If we want the control to automatically post back in case of an event, we will need to check this attribute as true. For example, on a ComboBox change, we need to send the event immediately to the server side then set the AutoPostBack attribute to true.
13. Can you set which type of comparison you want to perform by the CompareValidator control?
Yes, by setting the Operator property of the CompareValidator control.
14. What is the base class from which user controls derive?
User controls derive from System.Web.UI.UserControl base class. This base class provides the base set of properties and methods you use to create the control.
15. Explain login controls.
Login controls are built-in controls in ASP.Net for providing a login solution to ASP.NET application. The login controls use the membership system to authenticate user credentials for a Web site.
There are many controls in login controls.
There are many controls in login controls.
- ChangePassword control - Allows users to change their password.
- CreateUserWizard control - Provides an interface to the user to register for that Web site.
- Login control - Provides an interface for user authentication. It consists of a set of controls, such as TextBox, Label, Button, CheckBox, HyperLink.
- LoginView control - Displays appropriate information to different users according to the user's status.
- LoginStatus control - Shows a login link to users, who are not authenticated and logout link, who are authenticated
- LoginName control - Displays a user name, if the user logs in.
- password recovery control - Allows users to get back the password through an e-mail if they forget.
16. What is the use of PlaceHolder control? Can we see it at runtime?
The PlaceHolder control acts as a container for those controls that are dynamically generated at runtime. We cannot see it at runtime because it does not produce any visible output. It used only as a container.
17. Make a list of all templates of the Repeater control.
The Repeater control contains the following templates:
- ItemTemplate
- AlternatingltemTemplate
- SeparatorTemplate
- HeaderTemplate
- FooterTemplate
18. What does the WebPart file do?
The .WebPart file explains the settings of a Web Parts control that can be included in a specified zone on a Web page.
19. What is a round trip?
The trip of a Web page from the client to the server and then back to the client is known as a round trip.
20. How can you dynamically add user controls to a page?
User controls can be dynamically loaded by adding a Web User Control page in the application and adding the control on this page.
21. Which event determines that all the controls are completely loaded into memory?
The Page_Load event determines that all the controls on the page are fully loaded. We can also access the controls in the Page_Init event; however, the ViewState property does not load completely during this event.22. What is the difference between an HtmlInputCheckBox control and an HtmlInputRadioButton control?
We can select more than one HtmlInputCheckBox control from a group of HtmlInputCheckBox controls; whereas, We can select only a single HtmllnputRadioButton control from a group of HtmlInputRadioButton controls.
23. Explain the AdRotator Control.
The AdRotator is an ASP.NET control that is used to provide advertisements to Web pages. The AdRotator control associates with one or many advertisements, which randomly displays one by one at a time when the Web page is refreshed. The AdRotator control advertisements are associated with links; therefore, when we click on an advertisement, it redirects us to other pages. The AdRotator control is associated with a data source, which is normally an xml file or a database table. A data source contains all the information, such as advertisement graphics reference, link, and alternate text. Therefore, when we use the AdRotator control, we should first create a data source and then associate it with the AdRotator control.
24. What is the difference between a Label control and a Literal control?
The Label control's final html code has an HTML tag, whereas, the Literal control's final html code contains only text, which is not surrounded by any HTML tag.
25. Which control will you use to ensure that the values in two different controls match?
You should use the CompareValidator control to ensure that the values in two different controls match.
26. Which class is inherited when an ASP.NET server control is added to a Web form?
The System.Web.UI.WebControls class is inherited when an ASP.NET server control is added to a Web form.27. What are navigation controls? How many navigation controls are there in ASP.NET 4.0?
Navigation controls help us to navigate in a Web application easily. These controls store all the links in a hierarchical or drop-down structure; thereby facilitating easy navigation in a Web application.
There are three navigation controls in ASP.Net 4.0.
- SiteMapPath
- Menu
- TreeView
28. What happens if an ASP.NET server control with event-handling routines is missing from its definition?
The compilation of the application fails.
29. How can we provide the WebParts control functionality to a server control?
We can provide the functionality of the WebParts control to a server control by setting the CreateWebPart property of WebPartManger.
30. How do you prevent validation control from validating data at the client end?
We can prohibit a validation control to validate data at the client side by setting the EnableClientScript property to False.
31. What are Web server controls in ASP.NET?
The ASP.NET Web server controls are objects on the ASP.NET pages that run when the Web page is requested. Many Web server controls, such as button and text box, are similar to the HTML controls. In addition to the HTML controls, there are many controls, which include complex behavior, such as the controls used to connect to data sources and display data.
32. What is the difference between a HyperLink control and a LinkButton control?
A HyperLink control does not have the Click and Command events; whereas, the LinkButton control has these events, which can be handled in the code-behind file of the Web page.
33. Namespace and assembly of webcontrols?
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
34. What is the Inheritance Hierarchy?
- System.Object
- System.Web.UI.Control
- System.Web.UI.WebControls.WebControl
35. How To Allow Only Numbers In TextBox Control?
set properties textmode=number
58. If you are using ajax contol in the program which control is first to place
scriptManager is the first to control to place in the program.
59. Why we use Ajax controls.
Updating (refreshing selected parts of the page instead of refreshing the whole page with a postback) and displaying updates progress during asynchronous postbacks. Asynchronous partial-page updates avoid the overhead of full-page postbacks.
60.What is Solution for error “WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery error “.
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
No comments:
Post a Comment