Archive for the ‘Uncategorized’ Category

Zooomin, try it.. its cool.

zoomin!!! its cool

Cross Page posting in ASP.NET 2.0

Cross Page posting in ASP.NET 2.0

We always tend to post data from one page to another in a typical web application. For example, user name entered on login page getting displayed in welcome message on homepage.

How do you generally post values/data from one page to another page in ASP.NET 1.x? There are different ways in which you can exchange the data in ASP.NET 1.x like Query strings, Server.Transfer method, Response.Redirect method and session variables. All these techniques have their own merits and demerits like browser imposed character limit when passing parameters using Query Strings and indiscriminate usage of session variables can prove costly in terms of load on server and eventually impacts the performance of server.

Keeping in view above limitations in ASP.NET 1.x, Microsoft has reinstated Cross Page posting feature in ASP.NET 2.0. Many of us might not be aware of Cross Page posting feature in classic ASP. Cross Page posting feature allows a page to cross post to another page which in turn allows you to access all data in posted source page.

In ASP.NET 1.x , when you use look at page life level, you observe that a page can only submit to itself. Cross Page posting feature allows us post the form along with all its control values into another page.

Any server control which implements System.Web.UI.WebControls.IButtonControl interface can be used for Cross page posting. Examples of such controls include link button, Image button and submit button

By simply setting PostbackUrl property, we specify the destination page to which present page should post when post back occurs on present page.

Different methods to post data

There are several methods to post data from one page to another page depending on your needs. If you need to exchange simple insensitive data, you can give a try with existing techniques. So, let us revisit those different techniques which allow exchanging data from one page to another.

Response.Redirect method

We can use this method to allow client browser to do redirection from one page to another page. This technique is usually referred to as Client side redirection. When client browser redirects to DestinationPage.aspx, it involves Server sending a HTTP header informing that the user should redirect and the Client requests the DestinationPage.aspx. Server sends DestinationPage.aspx. Now the Client’s address bar shows DestinationPage.aspx. This entire series of steps incurs extra round trip to server which hits the performance. We usually associate Query Strings with Response.Redirect. There is always a client browser imposed limitation on the length of a query string; so you end up sending small amounts of data over the wire.

Session Variables

We can use session variable to store page information and use it across different pages for entire user session. However, this involves of consumption of costly server resources. This approach may prove disastrous when large numbers of users connect to server and things go pretty poor.

Server.Transfer Method

On flip side to Client side redirection, we have server doing the page transfer. In Server.Transfer, Http Context is preserved when moving from one page to another which means we can access the source page’s items collection in target page. The drawback of using this method is that the browser does not know that a different page was returned to it. It still displays the previous source page’s URL in the address bar. This can confuse the user. Transfer is not recommended since the operations typically flow through several different pages.

Technically speaking, Server.Transfer is faster since there is one less roundtrip, but you lose the URL of the page. Server.Transfer also allows for more flexibilty since you can use HTTPContext.Items to pass variables between pages.

Use Server.Transfer when you need to pass context items. Otherwise use Response.Redirect so the user will always see the correct URL in the address bar.

New Properties helping in Cross Page posting

The new PreviousPage property provides reference to the source page. When a cross page request occurs, the PreviousPage property of the current Page class holds a reference to the page that caused the post back. If the page is not the target of a cross-page posting or if the pages are in different applications, the PreviousPage property is not initialized. After cross-posts back from source page to the target page, the target page accesses information on the source page using this property.

Different ways of implementing Cross Page Posting

There are couples of ways of getting control values of the source page into the target page. First way being using FindControl method as discussed below

Using FindControl Method

In the below listing, we set the PostBackUrl property for Submit button. This property points to the location of the file to which this page should post. In this case, it is DestinationPage.aspx. This means that the DestinationPage.aspx receives the postback and all the values contained in CrossPostingPage.aspx page controls as shown below

<form id=”form1″ runat=”server”>
<div>
<h2> This page will cross post to another page by setting PostbackUrl property of submit button.</h2>
&nbsp;
<asp:Label ID=”lblName” runat=”server” Text=”LoginName” style=”left: 76px; position: relative; top: 20px”></asp:Label><br />
&nbsp;<asp:TextBox ID=”txtPassword” runat=”server” style=”z-index: 100; left: 160px; position: relative; top: 34px”></asp:TextBox>
<asp:TextBox ID=”txtName” runat=”server”></asp:TextBox><br />
<asp:Button ID=”btnSubmit” runat=”server” Text=”Submit”
PostBackUrl=”DestinationPage.aspx” style=”left: 208px; position: relative; top: 54px” />
<br />
<asp:Label ID=”lblPassword” runat=”server” Text=”Password” style=”left: 90px; position: relative; top: -12px” Height=”4px” Width=”43px”></asp:Label></div>
</form>


SourcePage which does Cross page post back to Destination page

You can see in below code how we are able to retrieve values from previous page using FindControl method and display them on Destination Page. Below given output should help you understand the funda.

Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
Label1.Text = “Name:” + CType(PreviousPage.FindControl(“txtName”), TextBox).Text
Label2.Text = “Password:” + CType(PreviousPage.FindControl(“txtPassword”), TextBox).Text
End Sub


Output listing

Using Control Property

Another way of exposing the control values from the Source Page to Destination Page is to create a public property of controls as shown below

Public Property UserName() As String
Get
Return UserName
End Get
Set(ByVal value As String)

End Set
End Property
Public Property Password() As String
Get
Return Password
End Get
Set(ByVal value As String)

End Set
End Property

In order to work with the properties described in FindControl page as shown above, PreviousPageType directive should be included in the destination page that is in DestinationPage.aspx. See below listing

<%@ PreviousPageType VirtualPath=”FindControl.aspx”%>

The above directive points to FindControl.aspx by specifying the VirtualPath attribute and when that is in place, one can see the properties exposed by FindControl page in DestinationPage using the PreviousPage property. It is always better to expose only the information we need as public properties to reduce the amount of information available to potentially malicious users.

IsCrossPagePostBack Property

IsCrossPostBack property, which is new in ASP.NET 2.0, enables us to check whether the page is participating in a cross page request. Using IsCrossPostBack property, we can check whether the request is coming from a particular page or not and act accordingly. As per above example, DestinationPage can include this property to specially process the FindControl.aspx cross page post back. Similarly, we can use the IsValid property of our previous page to make sure the page passed all client validations before it is cross posted to DestinationPage.

If Page.IsCrossPagePostBack Then
Label1.Text = “Name:” + CType(PreviousPage.FindControl(“txtName”), TextBox).Text
Label2.Text = “Password:” + CType(PreviousPage.FindControl(“txtPassword”), TextBox).Text
Else
Label1.Text = “No Name:Normal Postback”
Label2.Text = “No password: normal postback”
End If

Hence, Cross Page posting is very handy feature to implement very specific scenarios like displaying logged in user details on different pages and ensuring the request is coming from correct page. You can implement this feature in either two ways using FindControl method or exposing values as public properties. PreviousPage object will expose very useful properties like IsValid property and FindControl property to make Cross Page Posting more useful.

source: http://www.beansoftware.com

50 common questions asked in interviews

Review these typical interview questions and think about how you would
answer them. Read the questions listed; you will also find some
strategy suggestions with it.

1. Tell me about yourself:
The most often asked question in interviews. You need to have a short
statement prepared in your mind. Be careful that it does not sound
rehearsed. Limit it to work-related items unless instructed otherwise.
Talk about things you have done and jobs you have held that relate to
the position you are interviewing for. Start with the item farthest
back and work up to the present.

2. Why did you leave your last job?
Stay positive regardless of the circumstances. Never refer to a major
problem with management and never speak ill of supervisors, co-workers
or the organization. If you do, you will be the one looking bad. Keep
smiling and talk about leaving for a positive reason such as an
opportunity, a chance to do something special or other forward-looking
reasons.

3. What experience do you have in this field?
Speak about specifics that relate to the position you are applying for.
If you do not have specific experience, get as close as you can.

4. Do you consider yourself successful?
You should always answer yes and briefly explain why. A good
explanation is that you have set goals, and you have met some and are
on track to achieve the others.

5. What do co-workers say about you?
Be prepared with a quote or two from co-workers. Either a specific
statement or a paraphrase will work. Jill Clark, a co-worker at Smith
Company, always said I was the hardest workers she had ever known. It
is as powerful as Jill having said it at the interview herself.

6. What do you know about this organization?
This question is one reason to do some research on the organization
before the interview. Find out where they have been and where they are
going. What are the current issues and who are the major players?

7. What have you done to improve your knowledge in the last year?
Try to include improvement activities that relate to the job. A wide
variety of activities can be mentioned as positive self-improvement.
Have some good ones handy to mention.

8. Are you applying for other jobs?
Be honest but do not spend a lot of time in this area. Keep the focus
on this job and what you can do for this organization. Anything else is
a distraction.

9. Why do you want to work for this organization?
This may take some thought and certainly, should be based on the
research you have done on the organization. Sincerity is extremely
important here and will easily be sensed. Relate it to your long-term
career goals.

10. Do you know anyone who works for us?
Be aware of the policy on relatives working for the organization. This
can affect your answer even though they asked about friends not
relatives. Be careful to mention a friend only if they are well thought
of.

11. What kind of salary do you need?
A loaded question. A nasty little game that you will probably lose if
you answer first. So, do not answer it. Instead, say something like,
That’s a tough question. Can you tell me the range for this position?
In most cases, the interviewer, taken off guard, will tell you. If not,
say that it can depend on the details of the job. Then give a wide
range.

12. Are you a team player?
You are, of course, a team player. Be sure to have examples ready.
Specifics that show you often perform for the good of the team rather
than for yourself are good evidence of your team attitude. Do not brag,
just say it in a matter-of-fact tone. This is a key point.

13. How long would you expect to work for us if hired?
Specifics here are not good. Something like this should work: I’d like
it to be a long time. Or As long as we both feel I’m doing a good job.

14. Have you ever had to fire anyone? How did you feel about that?
This is serious. Do not make light of it or in any way seem like you
like to fire people. At the same time, you will do it when it is the
right thing to do. When it comes to the organization versus the
individual who has created a harmful situation, you will protect the
organization. Remember firing is not the same as layoff or reduction in
force.

15. What is your philosophy towards work?
The interviewer is not looking for a long or flowery dissertation here.
Do you have strong feelings that the job gets done? Yes. That’s the
type of answer that works best here. Short and positive, showing a
benefit to the organization.

16. If you had enough money to retire right now, would you?
Answer yes if you would. But since you need to work, this is the type
of work you prefer. Do not say yes if you do not mean it.

17. Have you ever been asked to leave a position?
If you have not, say no. If you have, be honest, brief and avoid saying
negative things about the people or organization involved.

18. Explain how you would be an asset to this organization
You should be anxious for this question. It gives you a chance to
highlight your best points as they relate to the position being
discussed. Give a little advance thought to this relationship.

19. Why should we hire you?
Point out how your assets meet what the organization needs. Do not
mention any other candidates to make a comparison.

20. Tell me about a suggestion you have made
Have a good one ready. Be sure and use a suggestion that was accepted
and was then considered successful. One related to the type of work
applied for is a real plus.

21. What irritates you about co-workers?
This is a trap question. Think real hard but fail to come up with
anything that irritates you. A short statement that you seem to get
along with folks is great.

22. What is your greatest strength?
Numerous answers are good, just stay positive. A few good examples:
Your ability to prioritize, Your problem-solving skills, Your ability
to work under pressure, Your ability to focus on projects, Your
professional expertise, Your leadership skills, Your positive attitude

23. Tell me about your dream job.
Stay away from a specific job. You cannot win. If you say the job you
are contending for is it, you strain credibility. If you say another
job is it, you plant the suspicion that you will be dissatisfied with
this position if hired. The best is to stay genetic and say something
like: A job where I love the work, like the people, can contribute and
can’t wait to get to work.

24. Why do you think you would do well at this job?
Give several reasons and include skills, experience and interest.

25. What are you looking for in a job?
See answer # 23

26. What kind of person would you refuse to work with?
Do not be trivial. It would take disloyalty to the organization,
violence or lawbreaking to get you to object. Minor objections will
label you as a whiner.

27. What is more important to you: the money or the work?
Money is always important, but the work is the most important. There is
no better answer.

28. What would your previous supervisor say your strongest point is?
There are numerous good possibilities:
Loyalty, Energy, Positive attitude, Leadership, Team player, Expertise,
Initiative, Patience, Hard work, Creativity, Problem solver

29. Tell me about a problem you had with a supervisor
Biggest trap of all. This is a test to see if you will speak ill of
your boss. If you fall for it and tell about a problem with a former
boss, you may well below the interview right there. Stay positive and
develop a poor memory about any trouble with a supervisor.

30. What has disappointed you about a job?
Don’t get trivial or negative. Safe areas are few but can include:
Not enough of a challenge. You were laid off in a reduction Company did
not win a contract, which would have given you more responsibility.

31. Tell me about your ability to work under pressure.
You may say that you thrive under certain types of pressure. Give an
example that relates to the type of position applied for.

32. Do your skills match this job or another job more closely?
Probably this one. Do not give fuel to the suspicion that you may want
another job more than this one.

33. What motivates you to do your best on the job?
This is a personal trait that only you can say, but good examples are:
Challenge, Achievement, Recognition

34. Are you willing to work overtime? Nights? Weekends?
This is up to you. Be totally honest.

35. How would you know you were successful on this job?
Several ways are good measures:
You set high standards for yourself and meet them. Your outcomes are a
success.Your boss tell you that you are successful

36. Would you be willing to relocate if required?
You should be clear on this with your family prior to the interview if
you think there is a chance it may come up. Do not say yes just to get
the job if the real answer is no. This can create a lot of problems
later on in your career. Be honest at this point and save yourself
future grief.

37. Are you willing to put the interests of the organization ahead ofyour own?
This is a straight loyalty and dedication question. Do not worry about
the deep ethical and philosophical implications. Just say yes.

38. Describe your management style.
Try to avoid labels. Some of the more common labels, like progressive,
salesman or consensus, can have several meanings or descriptions
depending on which management expert you listen to. The situational
style is safe, because it says you will manage according to the
situation, instead of one size fits all.

39. What have you learned from mistakes on the job?
Here you have to come up with something or you strain credibility. Make
it small, well intentioned mistake with a positive lesson learned. An
example would be working too far ahead of colleagues on a project and
thus throwing coordination off.

40. Do you have any blind spots?
Trick question. If you know about blind spots, they are no longer blind
spots. Do not reveal any personal areas of concern here. Let them do
their own discovery on your bad points. Do not hand it to them.

41. If you were hiring a person for this job, what would you look for?
Be careful to mention traits that are needed and that you have.

42. Do you think you are overqualified for this position?
Regardless of your qualifications, state that you are very well
qualified for the position.

43. How do you propose to compensate for your lack of experience?
First, if you have experience that the interviewer does not know about,
bring that up: Then, point out (if true) that you are a hard working
quick learner.

44. What qualities do you look for in a boss?
Be generic and positive. Safe qualities are knowledgeable, a sense of
humor, fair, loyal to subordinates and holder of high standards. All
bosses think they have these traits.

45. Tell me about a time when you helped resolve a dispute betweenothers.
Pick a specific incident. Concentrate on your problem solving technique
and not the dispute you settled.

46. What position do you prefer on a team working on a project?
Be honest. If you are comfortable in different roles, point that out.

47. Describe your work ethic.
Emphasize benefits to the organization. Things like, determination to
get the job done and work hard but enjoy your work are good.

48. What has been your biggest professional disappointment?
Be sure that you refer to something that was beyond your control. Show
acceptance and no negative feelings.

49. Tell me about the most fun you have had on the job.
Talk about having fun by accomplishing something for the organization.

50. Do you have any questions for me?
Always have some questions prepared. Questions prepared where you will be an asset to the organization are good. How soon will I be able to be productive? and What type of projects will I be able to assist on? are
examples.

source:  http://www.citehr.com/110299-50-common-questions-asked-interviews.html

Loads of eBooks…. downloads..!!!!

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!