Monday, April 21, 2008

Disabling treeview postback in ASP.NET 2.0

Sometimes you didn't need a postback when selecting a node in a treeview or you just use the treeview for displaying the data, but how can you do this when by default every treenode has an attribute value of javascript:__doPostBack in href which causes the postback.

To do this, all you have to do is set the NavigateUrl attribute to "javascript:void(0)" of the TreeNodeBinding.

<asp:TreeNodeBinding DataMember="item" Depth="1" NavigateUrl="javascript:void(0)" ValueField="name" />

Note that this only disable the postback in 2nd level of nodes as what i have set in the Depth attribute.

Works on IE and Firefox.
Attached here is the sample code.

Download Sample (8.39 kb)

Wednesday, April 16, 2008

Showing/Hiding controls using javascript

Showing and hiding controls is a common requirement for a web application. This is how you do it using javascript.

Snippets:

To show:
document.getElementById('<%= textboxToUse.ClientID %>').style.display = '';
To hide:
document.getElementById('<%= textboxToUse.ClientID %>').style.display = 'none';

Where in:
textboxToUse.ClientID returns the id of the control.

Works on IE and Firefox.

Attached is the sample code which includes static and dynamic version.
Dynamic version was created in ASP.Net 2.0.
To check the dynamic just run the Sample.sln file while default.htm for static.

Download Sample (11.83 kb)

Thursday, April 10, 2008

Be the First to Know and Save 40% on Select Visual Studio and SQL Server 2008 Exams (Worldwide)

Related Microsoft Certification exams will be available soon after the release of Microsoft SQL Server 2008 and the Microsoft Visual Studio 2008 development system. We would like you to be the first to know when these exams are available--helping you to be among the first to certify and get the attention of organizations that are eager to evaluate and deploy Visual Studio 2008 and SQL Server 2008. Register with us to be notified when related exams are available--and get a 40% savings code to use on any one of these exams.

Register now

Wednesday, April 9, 2008

Is this the right time to move on?

Most of us have to work for a living. Since we spend so many hours each week at our jobs, it’s very important that there is a good environment in your workspace. I've been feeling less enthusiastic about my work situation recently, maybe i've begun to wonder if it is time to move on. And, so i asked advice to Mr. Google and he gave me these signs.

Here are seven signs that your job is no longer the right one for you.

1. You no longer look forward to going to work in the morning. This may seem obvious, but many people overlook it because it happens gradually. Think about how you felt when you first started working at your company. Most people feel pretty excited about their work in the beginning, looking forward to each day and thinking about the projects they will be working on. It’s normal for that enthusiasm to tone down somewhat, but if you notice that you are feeling bored, indifferent, or actually wish you didn’t have to go, maybe it’s time for a change. This is especially true if you’re spending 60 hours a week at your job, which is not unusual in today’s workplace. You owe it to yourself to do something that gives you satisfaction.

Try to identify what part of your work situation is bothering you. Distinguish between the aspects that you can fix and the things that you can do nothing about. If you can figure out how to spend more time on the job doing things that you enjoy, you may once again find yourself more eager to get to work in the morning.

2. You have lowered your standards. Most of us take pride in our work and our careers, and therefore set high standards for ourselves. If you have begun to allow yourself to turn in work that’s just good enough to get the job done, you have let your standards slide. This is dangerous because when you compromise your personal standards, your self-esteem will fall.

To remedy this problem, think about why it is happening. Maybe this kind of work no longer presents a challenge to you. If that is true, identify the types of projects that will get you excited. Perhaps you can volunteer for assignments outside your department. But if you can’t figure out a way to jump-start your job, you may want to start thinking about a change.

3. You have lower self-esteem. If you no longer receive praise or acknowledgment for your work, it’s normal both to wonder if the company no longer values you and to second-guess your own abilities. If you feel like you can discuss this with your boss, do so. Ask for specific feedback about your performance. You will either learn that you are more valued than you thought, or you will find out what you need to work on.

Another option is to talk with a trusted coworker or with someone who knows your boss’s leadership style. Maybe he or she gives people feedback only when there is a problem. Some supervisors don’t understand that people need feedback when things are going well, not just when there is a problem. If this is true, you will have to decide whether you want to stay with a boss who keeps you in the dark. It may be worth it for you to stay where you are, since most bosses eventually move on.

4. Your supervisor doesn’t help you grow and develop. Without support for career development, you will eventually reach a dead end. There are a number of ways this may be evident. Perhaps you ask to attend professional conferences (including inexpensive local ones), but your requests are turned down because there are no budget dollars available. Or you are not allowed to participate in cross-functional teams that would enable you to develop new skills. These blocked opportunities may happen because your boss may feel threatened, or he or she may fear losing you if you develop too many skills. In some cases, the boss just doesn’t know how to develop people.

You may not have to leave your job to solve this problem. You can make a decision to manage your own career development. Take classes on your own time. Join a professional association and attend their meetings. Do everything you can to keep growing. Eventually, of course, if your boss continues to limit you, you will feel the effects on the job and you will have to decide when it is time to move on.

5. You get stuck with low-profile assignments. This happens to everyone at one time or another. It may be a one-time situation, where somebody needs to do the project, and it’s your turn. But what happens when one dead-end assignment follows another? This could become a problem if you feel like you are drifting along with a series of these projects. This could be a sign that you are perceived as less competent and less valuable.

If you think it is not too late to turn things around, then resolve to regain control of your place in the organization. Talk to your boss about what you want to do next. Ask what you need to do to participate in more challenging projects. Listen to your boss’s feedback and do what is suggested.

6. You have been pigeonholed. It is not uncommon to become identified with your first position or with a project that you managed earlier in your career. Even though you learn new skills and get promoted, people may associate you with your previous experiences. This happens often to people who start their careers in hourly or administrative jobs and earn promotions to management levels. Even though you are no longer a secretary, you are still asked to take minutes at the manager’s meeting. The challenge is to find a way out of the pigeonhole and keep your career from being stalled.

To resolve this problem, ask your boss to give you a chance to do a special project that will change the way people see you. This could be a unique assignment that will require just a small percentage of your time during a specified period. Offer to do the assignment as a test, and be sure to guarantee that you will do the rest of your job in a satisfactory way. If the project is successful, both you and the company will benefit. If your boss agrees to this project, you may be able to move beyond the role you have been typecast in. If not, you will have to decide whether you want to stay with the department or the company.

7. You no longer respect the company you work for. Most people want to be proud of the organization they work for. When you tell others what you do and you don’t mention the company’s name, that’s not a good sign. It could mean that your values are no longer in synch with the company’s values, and this is making you feel very uncomfortable. If this is the case, and if it is unlikely to change, the best strategy may be to begin to look for an employer who shares your values.

It's pretty obvious that I should go now..