ASP.NET Interview Questions and Answers (1544) - Page 62

What is the best place to write content or controls in the HTML file?

Body tag is the best place to write content or controls in the HTML files.

<body>

<p>
Hello
</p>
<asp:textbox id="txt_name" runat="server"></asp:textbox>
</body>

How do we define hyperlinks in Asp.Net?

We have an HTML control called Anchor tag <a>,which is used for defining hyperlinks in the Asp.Net.

For Example:-
<a href="http://www.dotnetfunda.com">Visit Dotnetfunda.com</a>

How to make Textbox text in BOLD letter?

We use Font-Bold property to make text in bold letter.
Font-Bold property has True/False value.

For Example:-
<asp:TextBox ID="TextBox1" runat="server" Font-Bold="true" Text="Vishal"></asp:TextBox>

Alternate way of making bold style in asp.net?

We can use font-weight inline CSS property to make font bold.

For Example:-
<asp:TextBox ID="TextBox3" runat="server" style="font-weight:bold;" Text="Vishal"></asp:TextBox>

How can we give aline break in Asp.Net?

We can use <BR> tag to set any texts or controls in new line in Asp.Net application.

For Example:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

</br>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

How can we show Horizontal Line in a page?

We use <HR> tag to show Horizontal Line in a page.

For Example:-
This is a dot net funda

<HR>
This is a dot net funda
Output:
This is a dot net funda

____________________________________________________

This is a dot net funda

How can we restrict users to allow limited number of characters in the text box?

We can have MaxLength property of TextBox which is used for allowing no. of characters in the Textbox.

For Example:-
<asp:TextBox ID="txt_PAN_number" runat="server" MaxLength="10"></asp:TextBox>

How can we display any images or pictures on asp.net applications?

We can use Asp.Net Image control to show images or pictures on asp.net applications.

For Example :-
<asp:Image ID="img_go" runat="server" ImageUrl="~/Images/go.png" />

Which property of Image control do we have to set images on Asp.Net pages?

There is an ImageUrl property of Image control to set Images or Pictures on html pages.

For Example:-
<asp:Image ID="img_view" runat="server" ImageUrl="~/Images/img_view.jpeg"  />

Which property is used for aligning Images to our choice i.e. middle,left and so on?

We can use ImageAlign property to align any image in Image control.
For Example:-
<asp:Image ID="img_go" runat="server" ImageUrl="~/Images/go.png" ImageAlign="Middle"  />

What are the options available in ImageAlign property of Image control?

There are a lots of options available in ImageAlign property, some are listed below:-
-> AbsBottom
-> Bottom
-> Middle
-> Left
-> Top
-> Right
What is an alternate way of showing images on the form?

We have an html <img> tag which is used for showing images on the form.This <img> tag is same as Asp.Net image control.
For Example:-
<img id="img_go" src="Images/go.png" />

What is the difference between Image and ImageButton control in Asp.Net?

Although Image and ImageButton control both are used for showing images on the form but there is a little difference between them.
Image control is just for showing images but ImageButton control also has an event means when we can also perform some logic on ImageButton event.
Which control is used for showing images in Windows application?

PictureBox control is the one which is used for showing images on windows forms.This control has an Image property from which we have to select any images from any location,then that image will show on PictureBox control.PictureBox control is available in System.Windows.Forms namespace.
In which place we write meta tags and script tags in html pages?

We can write page title,our own CSSs,meta tag,script in <Head> tag.
For Example:-
<head>

<script type="text/javascript">
</script>
</head>

How can we show a paragraph in Asp.Net pages?

<P> tag is used for giving paragraphs in Asp.Net pages.It starts with <P> and ends with </P>.We can write any static contents inside paragraph tags.It will treat as one paragraph.
We can take multiple we want.
For Example:-
<body>

<p>
write any static contents
</p>
</script>
</body>

What is the use of display CSS property?

Display as name suggests used for hiding or showing controls or elements on the form.It's in-built CSS property.Either we can write this on an in-line CSS or directly write inside any Style classes.
What is the use of display:none CSS property?

display:none CSS property is used for Hiding any controls or elements from form or page.

Syntax:
document.getElementById('div_employee_grid').style.display = 'none';
Here is my Div control:
<div id="div_employee_grid">Hello</div>

Now div_employee_grid will be hidden from page.
What is the use of display:block CSS property?

display:block CSS property is used for showing any HIDDEN controls or elements on the page.

Syntax:
document.getElementById('div_employee_grid').style.display = 'block';
Here is my Div control-
<div id="div_employee_grid">Hello</div>

Now div_employee_grid will be again shown on page.
What is an alternate way of displaying controls on the form instead of block value of display property?

We can write Single Quote('') or Double Quote(" ") in display property.It's same as block option.
For Example:
document.getElementById('div_employee_grid').style.display = '';

document.getElementById('div_employee_grid').style.display = " ";

Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories