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

Can we to pass more than one querystring parameter with hyperlink in .aspx file?

Yes we can.
For an example code can be like,

<asp:HyperLink ID="hlClientId" runat="server"                                                 NavigateUrl='<%# "Page.aspx?param1=" & _

DataBinder.Eval(Container.DataItem, "param1") & _
"&param2=" & DataBinder.Eval(Container.DataItem, "param2") %>' >Hyperlink</asp:HyperLink>

Which method is used to rewriting/redirecting server-side execution?

NOTE: This is objective type question, Please click question title for correct answer.
It is possible to get class or struct indexed just like arrays using…

NOTE: This is objective type question, Please click question title for correct answer.
What is difference between TransferRequest and Transfer method?

Transfer: Terminates execution of the current page and starts execution of provided URL.
TransferRequest: Performs an asynchronous execution of the provided URL.
Base class for classes accessing session-state values, session-level settings, and lifetime management methods is…

NOTE: This is objective type question, Please click question title for correct answer.
Difference between Eval() and Bind()?

Eval(): -Eval() method proviedes only for displaying data from a datasource in a control.
Bind(): Bind() methods provides for two-way binding which means that it cannot be used to dispaly as well update data from a datasource
Which of the following method is correct to send an Email Message?

NOTE: This is objective type question, Please click question title for correct answer.
What is IsPostback property in asp.net and how does it work?

IsPostBack property indicates that whether this is the first time user has requested fort the page or it is reloaded based on any response on postback.

This property checks for __VIEWSTATE or __EVENTTARGET parameter in Request object. if these parameters are absent that means it is requested for the first time and if these parameters are present then this request is not first request.
What are the different level of settings are available for configure cookies in browser ?

Below are the listed Cookies setting available on Browser.
1. Accept All Cookies
2. Low
3. Medium
4. Medium High
5. Block All Cookies

We can reached there by Tool -> Internet Option -> Go To Privacy Tab . [ IE ]
How can we disabled session for an ASP.NET Application ?

We can easily do it by following configuration in web.config
<SessionState Mode="Off"> in System.Web Section.
How can we disable session in Page Level ?

We can disable session state in page level using EnableSessionState attributes with in Page directive
<%@ page Langauge="C#" EnableSessionState="False" ...
Process Used for Maintain State Server Session ?

NOTE: This is objective type question, Please click question title for correct answer.
is it possible to add APP_Code folder in web application project in Visual Studio 2005 or later?

No. It's not possible. Web application project does not allow users to add app_code folder where website project does.
Justify : Custom validator gets executed only at client side.

The answer is true and false both. Its as per specifications provided in the code. If you want to perform client side validation then it almost becomes browser specific. You can handle such situation by specifying server side validation with “OnServerValidate” tag.

But in case of server side validation with custom validator, you need to be assured that the control being validated is visible and having value.

For an example,

<asp:TextBox ID="txt" runat="server"></asp:TextBox>

<asp:CustomValidator ControlToValidate="txt" OnServerValidate="test" ClientValidationFunction="test()" ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator"></asp:CustomValidator>
<asp:button id="btnSubmit" runat="server"
OnClick="btnSubmit_Click" Text="Submit" />


Public Function test(ByVal obj As Object, ByVal objArgs As ServerValidateEventArgs) As Boolean

If Not obj Is Nothing Then
Return true
End If
End Function
Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs)

End Sub

Is it possible to maintain scroll bar positions during postbacks ?

Yes, it is.
You just need to set “MaintainScrollPositionOnPostback” attribute value to “true”.

<%@ Page Language="vb" AutoEventWireup="false" … MaintainScrollPositionOnPostback="true" %>

How will you set focus to the control?

You can do it either using JS, for attribute or control method.
With JS, you will have to use focus method.
function focustest()

{
document.getElementById("TextBox5").focus();
}

With form, you can add attribute called “defaultfocus” to the desired control.
defaultfocus="TextBox5
" sets focus to textbox5.
And programatically, you can set it by :
TextBox5.Focus()

Does defaultbutton of form tag works with ImageButton?

No. It does not.
You need to handle such scenarios using code or JavaScript (This will be preferrable as defaultbutton doesn’t work also for FireFox)
What is the lifetime of ViewState?

ViewState exists for the current requested page including post backs to the same page.
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