_ASP.NET
3351603
Assignment-1
1: What is Theme? How Themes work?
Answer:-
-You can create your own theme for your own look.
-Themes are made up of a set of elements: skins, cascading style sheets, images, and other resources.
-Themes are defined in special directories in your web site or on your web server.
-Themes are a way to counter the problems faced when creating a layout for server controls and giving
them the same look and feel with a little effort as possible.
-Default or global themes are contained in a special folder inside the framework.
-The essential parts of the themes are skin files with the .skin extension.\
-Beside a skin files, a theme can be composed of style sheet .css files as well as images for added for
support for a layout if the website.
In Visual web developer you can create themes at the machine level that can be used in multiple applications on the server.
Themes can be applied by using either the Theme or StyleSheetTheme attribute of the @ Page directive, or by setting the pages Element in the application configuration file.
2: List out validation controls in ASP.Net.
Answer:-
-RequiredFieldValidator Control
-CompareValidator Control
-RangeValidator Control
RegularExpressionValidator Control
CustomValidator Control
ValidationSummary Control
3: Explain Master Page.
Answer:-
Master page can be defined as a consistent layout for all your pages in your application.
A single page defines the look and feel that you want for all of the pages in your application.
You can then create individual content pages that contain the content you want to display.
When users request the content pages, they merge with the master page to produce output that combines the layout of the master pages with the content from the content page.
Basically it consist of two pieces, master page itself and one or more content pages.
4: What is CSS? Explain style sheet syntax & rules.
Answer:-
CSS is a simple design language intended to simplify the process of making web pages presentable.
CSS handles the look and feel part of a web page.
Using CSS, you can control the color of the text, the style of fonts, the spacing between paragraphs, how columns are sized and laid out, what background images or color used, as well as a variety of other effects
CSS is combined with the markup languages HTML and XHTML.
RULES:-
1)The rules can be defined in an individual element using style property of element/tag.
2)The rules can be written inside the elements/tags<style> ...</style>.
3)The rules can be written in separate file with an extension .css and this file can be linked to any web page.
SYNTAX:-
<ELEMENT STYLE="property: value; property: value; ..."></ELEMENT>
style may be applied to any HTML element, from <A> to <VAR>.
5: Explain all validators in brief.
Answer:-
-RequiredFieldValidator Control:-
This is the simplest and most used control from validation control series.
This control makes sure that the required field is entered by the user.
For making a control mandatory we just need to tie a RequirementFieldValidator to that control.
Leading and trailing spaces of the input value are removed before validation.
-CompareValidator Control:-
This control is used to compare the value entered in one control with another value.
If the input control value is empty then no validation will take place and will return Is Valid true for this validator. If it's a mandatory field then add a RequiredFieldValidator also to that input control.
-RangeValidator Control:-
The Range Validator server control is similar to the Compare Validator server control.
This control is used to check that the user enters an input value that falls between two values.
It is possible to check range within numbers, dates, and characters.
RegularExpressionValidator Control:-
This control check the user's input based on a pattern defined by a regular expression.
This validation control is very helpful when checking email address, phone number, zip code, minimum password complexity etc.
CustomValidator Control:-
The CustomerValidator server control enables you to develop your own custom server-side or client-side validations.
At times, you may want to compare the user's input to a value in a database, or to determine weather his input conforms to some arithmetic validation that you are looking for.
ValidationSummary Control:-
The Validation Summary control allows you to summarize the error messages from all validation controls on a web page in a single location.
The summary can be displayed as a list, a bulleted list, or a single paragraph, based on the value of the DisplayMode property.
6: Explain Regular Expression Validator.
Answer:-RegularExpressionValidator Control:-
This control check the user's input based on a pattern defined by a regular expression.
This validation control is very helpful when checking email address, phone number, zip code, minimum password complexity etc.
7: Explain Custom Validator with code.
Answer:-
The CustomerValidator server control enables you to develop your own custom server-side or client-side validations.
At times, you may want to compare the user's input to a value in a database, or to determine weather his input conforms to some arithmetic validation that you are looking for.
Two unique properties and one unique event handler are associated with CustomValidator. They are
--ClientValidationFunction
--ValidateEmptyText
8: What is use of validation summary.
Answer:-
The error message displayed in this control is specified by the ErrorMessage property of each validation control.
If the ErrorMessage property of the validation control is not set, no error message is displayed for that validation control.
The unique properties that offered by ValidationSummay control are follows:
1)Display Mode
2)HeaderText
3)ShowMessageBox
4)ShowSummary
9: How Nested Master page is different than Master page?
Answer:-
{if you have better answer of this question than this , you can suggest me at anmol.code 😊}
Master page defines the look and feel and standard behavior that you want for all of the pages in you application, while in Nested master page it allow you to create componentized master pages. for example, a large site might contain an overall master page that defines the look of the site.
In Master page there is two component one master page itself and another content page but in
Nested master page there is parent master pages and child master pages.
10: Explain RadioButtonList and CheckBoxList with code.
Answer:-
RadioButtonList:-
RadioButtonList derives from a base ListControl, and therefore works much like the ListBox, DropDownList, Bulleted List, and CheckBox list Web server controls.
Code:-
RadioButtonList.aspx
<%@ page Title ="RadioButtonList" Language="C#" CodeBehind="RadioButtonList.aspx.cs" Inherits="Web_Server_Controls.RadioButtonList" %>
<html>
<body>
<form runat="server">
Select your discipline:</br>
<asp:RadioButtonList id="radiolist1" runat="server">
<asp:ListItem selected="true">Civil Engineering</asp: ListItem>
<asp:ListItem selected="true">Electrical Engineering</asp: ListItem>
<asp:ListItem selected="true">Electronics and Communication </asp: ListItem>
<asp:ListItem selected="true">Computer Engineering</asp: ListItem>
<asp:ListItem selected="true">Information Technology</asp: ListItem>
<asp:ListItem selected="true">Mechanical Engineering</asp: ListItem>
<asp:RadioButtonList>
</br>
<asp:Button id="Button1" Text="SUBMIT" Onclick="submit" runat="server"/>
<p><asp:label id="Label1" runat="server"/> </p>
</form>
</body>
</html>
RadioButtonList.aspx.cs
using system;
using system.Collections.Generic;
using system.Linq;
using system.Web;
using system.Web.UI;
using system.Web.UI.WebControls;
namespace Web_Server_Controls
{
public partial class RadioButtonList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void submit(object sender, EventArgs e)
{
Label1.Text="You select" - radiolist1.SelectedItem.Text;
}
}
}
CheckBoxList:-
The CheckBoxList control is a better choice if we want to create a series of check boxes from data in database.
Code:-
CheckList.aspx
<%@ page Title="CheckBoxList" Language="C#"
CodeBehind="CheckList.aspx.cs"
Inherits="Web_Server_Controls.checklist" %>
<html>
<body>
<form runat="server">
Known Languages"<br/>
<asp:ListItem>Bengali</asp:ListItem>
<asp:ListItem>english</asp:ListItem>
<asp:ListItem>hindi</asp:ListItem>
<asp:ListItem>kannada</asp:ListItem>
<asp:ListItem>marathi</asp:ListItem>
<asp:ListItem>gujarati</asp:ListItem>
<asp:CheckBoxList><br/>
<asp:label id="lb" runat="server"/>
</form>
</body>
</html>
CheckList.aspx.cs
using system;
using system.Collections.Generic;
using system.Linq;
using system.Web;
using system.Web.UI;
using system.Web.UI.WebControls;
namespace Web_Server_Controls
{
public partial class CheckList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Check(object sender, EventArgs e)
{
int i;
lb.Text="<p>Selected Language(s):</p>";
for(i=0;i<=Check1.Items.Count-1;i++)
{
if (Check1.Items[i].Selected==true)
{
lb.Text += check1.Item[i].Text + ",";
}
}
}
}
}
11: Differentiate LinkButton and Hyperlink with code.
Answer:-
LinkButton:-
Renders as a hyperlink in the page. However it contains client-side script that causes the form to be posted back to the server.
Code:-
LinkButton.aspx
<%@ Page Title="LinkButton" Language="C#"
CodeBehind="LinkButton.aspx.cs"
Inherits="Web_Server_Controls.LinkButton" %>
<html>
<body>
<form runat="server">
<asp:LinkButton ID="LinkButton1" Text="Click me!"
OnClick="lblClick" runat="server" />
<p> <asp: Label id="Label" runat="server" /></p>
</form>
</body>
</html>
LinkButton.aspx.cs
using system;
using system.Collections.Generic;
using system.Linq;
using system.Web;
using system.Web.UI;
using system.Web.UI.WebControls;
namespace Web_Server_Controls
{
public partial class LinkButton : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void lblClick(object sender, EventArgs e)
{
Label1.Text="You clicked the LinkButton control";
}
}
}
HyperLink:-
The HyperLink Web server control creates links on Web page that allows users to move from page to page in your application.
Code:-
HyperLink.aspx
<%@ Page Title="HyperLink" Language="C#"
CodeBehind="HyperLink.aspx.cs"
Inherits="Web_Server_Controls.HyperLink" %>
<html>
<body>
<form runat="server">
<asp:HyperLink ID="HyperLink1"
ImageUrl="../image/bbit.png"
NavigatUrl="http://www.bbit.ac.in" Text ="Visit BBIT!"
Target="_Blank" runat="server"/>
</form>
</body>
</html>
Hyperlink.aspx.cs:-
no coding required
0 Comments