Invalid string in FileUpload control prevents form postback

by neo_savvy 6/10/2009 8:37:00 AM

Discovered this problem in IE7 (probably exists in IE6 too) where the FileUpload control textbox allows invalid user input that prevents the form from posting back to the server. This is not a problem in IE8 and FF where the FileUpload control textbox renders properly in readonly mode. You can work around this problem by adding javascript  to the 'onkeypress' and 'onkeydown' event handler to prevent users from typing any potentially invalid string. The javascript function (which uses cross-browser javascript keycode detection) below will block all typing except tabs - this should allow users to still tab over controls.

function blockAllExceptTab(e) {
   
    if (!e) var e = window.event
    if (e.keyCode) code = e.keyCode;
    else if (e.which) code = e.which;
   
    var result = (code == 9);
    return result;
}

Add this code to your page OnInit event handler:

this.myFileUpload.Attributes.Add("onkeypress", "return blockAllExceptTab(event);");
this.myFileUpload.Attributes.Add("onkeydown", "return blockAllExceptTab(event);");

Hope this helps.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

AjaxControlToolkit DropDownExtender flicker

by neo_savvy 6/4/2009 8:51:00 AM

To prevent flickering on client load, set the "display: none" on the panel set as the DropDownControlID on the DropDownExtender.

<ajaxToolkit:DropDownExtender runat="server" ID="dropDownExtender" TargetControlID="dropDownLabel" DropDownControlID="dropDownPanel" />
<asp:Label ID="dropDownLabel" runat="server" Text="Label" Width="109"><a>{Drop Down Label goes here}</a></asp:Label>
<asp:Panel ID="dropDownPanel" runat="server" CssClass="modalDropdown" style="display: none">
   <ul>
       <li>DropDownListItem #1</li>
       <li>DropDownListItem #2</li>
   </ul>
</asp:Panel>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

HTML | ASP.net

New Job Search website - SearchableJobs.com

by neo_savvy 6/3/2009 1:45:00 PM
Check out this cool job search website - SearchableJobs.com. It's powered by Indeed.com's API. You can find job listings for the top 100 cities in the United States.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

General

HttpException in page with ScriptManager using Virtual Path Provider

by neo_savvy 5/29/2009 4:21:00 PM

This bug is related to System.Web.Extensions.dll.

Sharepoint uses a Virtual Provider to retrieve content from the database or the file system depending on the type of page (customized or common) and forwards the retrieved page to the asp.net runtime.  When using a ScriptManager (with page methods enabled) on a page that runs in Sharepoint, the ScriptManager maps virtual directories to the file system - and tries to establish a CacheDependency (which uses a FileChangesMonitor to monitor) that specific path/directory. This is what causes the HttpException reported below:

Exception error message when you use a virtual path provider to serve a Web page that has a ScriptManager control: "Directory '<file directory>' does not exist. Failed to start monitoring file changes."

You may refer to the Microsoft Knowledge Base article KB957661 for more details.

There's a hotfix available to resolve this issue. You can obtain it here.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

ASP.net

Membership.CreateUser: "The E-mail supplied is invalid"

by neo_savvy 4/5/2008 5:55:00 PM

Are you getting this exception with this code?

MembershipUser user = Membership.CreateUser([username], [password]);

That exception message is a very poor description of the actual problem. You definitely have set requiresUniqueEmail = "true" in your web.config. The issue at hand is the method you have chosen. If you have requiresUniqueEmail set to true, then you must supply a unique email when you create a user. So you should use the appropriate overloaded method:

MembershipUser user = Membership.CreateUser([username], [password], [email]);

That should solve the problem, hopefully Laughing.

Currently rated 4.5 by 4 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

ASP.net

Introducing Keep The ATM Fee

by neo_savvy 3/1/2008 10:44:00 PM

Still ponying up for ATM fees at other bank ATMs?  Let me introduce the Keep the Change® Keep the ATM fee™ program by E*Trade Financial (not officially called that...but I think it sticks). If you can believe it, all E*Trade account holders with checking accounts enjoy unlimited ATM fee refunds at every ATM nationwide (over 383,000 of them). Before I lose your attention, please save some money by opening a modern account with E*Trade just to take advantage of this feature. If you're like me, you'll frequently find yourself in situations where you have to make a withdrawal from another bank ATM. And if you're like me, I'm sure you hate paying extra for the convenience. That's why I joined E*Trade about two years ago. Before I forget to mention, their trading platform rocks bunkers. And you can transfer money between accounts in different banks thru E*Trade online banking. I know this is not the stone age but Wachovia doesn't offer bank-to-bank transfers via online banking (I think). They are still in the stone age. Just a little history before I get to the substance of my current beef with Wachovia.

Disclaimer: I don't work for E*Trade and they have not approved this message. I just love 'em. E*Trade, if you're listening, maybe you can sweep my ATM fee savings into my savings account. That's money I never had. Big ups to Bank of America for matching Keep the Change® transfer up to $250.

Ironically, when I started writing this blog entry, I didn't plan on endorsing E*Trade. I was going to bash Wachovia for their borderline scam operations regarding their ATM deposit $100 credit. On a positive note, it's very thoughtful to give a $100 instant credit to your account when you make a deposit over ...I'm guessing $100. If you're a Wachovia customer and you make frequent deposits to their ATMs, I'm sure you know what I'm talking about. An example for those that don't know what I'm talking about:

Let's say you have $200 in the bank already when you make a deposit for $700 through the ATM. Your available balance is immediately increased to $300.

So what's the catch? If you're like me, you're like "Cool, maybe I can do some shopping over $200". Let me say that nowhere on the ATM machine balance request notification screen did it say that even though your current balance is $300, you can only spend the $200 in the account till the check has cleared. And even if it did say that, why credit $100 that's not really available? That, totally defeats the whole credit concept. It's like giving with your left hand and stealing with your right when I'm not looking. Long story short, I made 2 transactions over my current balance but still within the stated available balance but I got hit with overdraft fees.

I called Wachovia to dispute the charges and the nice lady (she was just doing her job when I chewed her out --politely with no profanity) gave me a courtesy credit for one of the overdraft fee charges. But still, this can't be legal. If the funds are not really available for use, why give me a false sense of security then pull a "bait and switch type thing" according to Rich from Willow Springs, North Carolina in his February 2, 2008 post on RipOffReport.com. He had the same complaints. Who knows how many Americans have been baited by this false convenience? I'm thinking about starting an online petition or something to maybe get them to inform consumers better. I'm not really sure how to approach this.

If you're reading this, please let me know what your ideas are. And get an E*Trade account and Keep the ATM Fees™ people.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

General

2008 - The Year of the Underdog.

by neo_savvy 2/10/2008 8:40:00 PM

Loud bangs and flashes of fireworks ushered in an air of inevitability in 2008 in the sports and political landscape. It was a foregone conclusion that the New England Patriots were going to cruise to their fourth Superbowl title in 7 years. And then the New York Giants happened to the Patriots (18-1). I can still replay that whole offensive drive leading up to the perfect spiral touchdown pass by QB Eli Manning to WR Plaxico Burress. The New York Giants achieved an impossible feat when they won the Superbowl and prevented the "inevitable" coronation of the Patriots that almost everyone predicted would happen with ease.

Remember when John McCain's campaign was declared dead when he laid off a bunch of his campaign staff when money got tight? We all know what has happened since then. McCain is now the presumptive nominee of the Republican party. Along those lines, when Hillary Clinton started running for president, I assumed she would cruise all the way to the Democratic party nomination. But Barack Obama and America has a different plan. Hillary Clinton has taken all the big delegate states winning 8 states along the way so far. However, Barack has racked up 13 very impressive wins in states all across America while getting young people from different races and backgrounds involved in the political process. Even though he trails in the total count of pledged delegates, his campaign is gaining momentum.

By uniting people across all states - Democrats, Republicans, and Independents, he will provide the leadership necessary to bring about change desperately needed to lead our dear country off the abyssmal path we're charting on. There's no doubt that Obama is sailing through on the wave for political change in America because we are ready for something different. Take a stand for Universal Healthcare, Education, Peace, Diplomacy, Clean Energy and Civil Rights. If you're in one of the upcoming primary states, vote Barack Obama for change and make your voice heard. Only time will tell the exact sequence of events leading to a happy fairy tale ending - just like President Clinton predicted (he just didn't know it was going to be a happy ending Smile).

Join Barack Obama - Change We Can Believe In

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Politics | General | Politics

ASP.net Paypal button HTML Form Post Issues.

by neo_savvy 2/9/2008 11:07:00 AM

Have you followed all the instructions on Paypal when trying to setup a Paypal button in ASP.NET but get nothing but a page refresh (without a redirect) when you click the button? The answer is very simple. HTML forms cannot be nested. You need to add some javascript that will modify the form's "action" property. This will allow the page to the submitted to Paypal.

Here's the sample of the HTML generated on the Paypal site for the encrypted HTML code button:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHVwYJKoZIhCCB0QCAQExggEwMIIBLAIBADCBlDCCSqGSIb3DQE=-----END PKCS7-----">
</form>

Here's a modified version of the above HTML code that solves the nested HTML form problem:

<input type="hidden" name="cmd" value="_s-xclick" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" onclick="document.getElementById('aspnetForm').action='https://www.paypal.com/cgi-bin/webscr';" />
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHVwYJKoZIhCCB0QCAQExggEwMIIBLAIBADCBlDCCSqGSIb3DQE=-----END PKCS7-----"/>

By eliminating the "form" tag and adding an onClick attribute to the input tag for the Paypal button image, we can use javascript to modify the action property of the HTML form.

document.getElementById('aspnetForm').action='https://www.paypal.com/cgi-bin/webscr';

Make sure that the form id matches what you have. I hope this helps.

Currently rated 5.0 by 7 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Throw me another "Curve Ball"

by neo_savvy 11/5/2007 5:30:00 PM

60 minutes on CBS featured a story of the Iraqi defector known as "Curve Ball" a.k.a Rafid Ahmed Alwan. According to the story, "Curve Ball" provided intelligence about one of Saddam Hussein's "non-existent" WMD programs. This so-called compelling story helped forge the case Colin Powell gave before the United Nations weeks prior to invading Iraq.

I can start off by saying how incompetent our government is but I'll take a different approach to this. If you ask me, I believe Bush and his croonies always planned an invasion of Iraq. They never found any evidence to substantiate WMD claims. Even intelligence reports from other foreign agencies discredited any analysis that suggested that Saddam was brewing lethal weapons in his back yard. And I don't believe that you're stupid enough to think that some unknown Iraqi character (probably paid by the U.S. government to concoct fake intelligence) was so compelling that he brainwashed the whole intelligence community. This war has never been about WMD's so let's stop beating around the bush.

This war is about oil. Crude oil. If you're not living on Mars, you know that Crude oil is headed for $100. And with the growing demand for oil in the US, India and China, $100 barrel oil is here to stay so get comfy. I'm cranking up my plans to purchase a power bike as we speak. President Bush is just doing us a favor by invading Iraq (and lining the pockets of his warmonger buddies in one fell swoop). As Commander-in-Chief, he has to take step to secure our future. Our future as we see it: Big gas guzzling SUVs and monstrous homes in surburbia among other things. We just wish that lil' Bush had a bit of an imagination. If he did, he certainly would have been more diplomatic with the land grab in Iraq.

Ultimately, we got what we wanted: a secure oil supply. What we didn't want: No goodwill in the world, soaring deficits, and a depressed U.S dollar. What everyone knows but won't admit: The U.S. is never leaving Iraq. And no matter what the presidential candidates say now about leaving Iraq. They're lying through their teeth. Bookmark this post and contact me in 5 years. Those U.S. oil fields in Iraq...oops...I meant Iraqi oil fields are not switching hands anytime soon. And that's what this war is about. Don't fret. You voted for him or didn't do enough not to get him elected. If you want to do something about it, start by curbing your energy consumption. Then, vote for a more diplomatic and fiscally responsible land grabber.

"Curve Ball"...yeah right. Whatever!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

General | Politics

The Beginning

by neo_savvy 11/3/2007 2:47:00 PM

First, I want to thank all the geeks and visionaries for the pace of development and innovation in the Software Industry. Thanks to all the moderators, contributors, and developers for all the questions (including the very stupid ones!) and answers provided in dev forums. And also thanks to Google and Yahoo! (is MSN still in Search? Smile) for making my life very easy. As a .NET Developer, search engines have become an indispensable tool in my arsenal. The myriad blogs, forums, and API documentation indexed for easy access over the years have definitely made life a lot easier. For the longest, I've been at the receiving end, merely leaching and consuming all the helpful tutorials on obscure software problems and never contributing anything.

That's all about to change. Henceforth, I'll make a conscious effort to write helpful tutorials and provide sample code for problems that I encounter that may be helpful to other. You can expect to read about the .NET Framework, ASP.NET, SQL Server, UI Design, and Software Engineering (Patterns and Best Practices) on this blog. You can also check out my favorite blogs.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Powered by BlogEngine.NET 1.2.0.0
Theme by Mads Kristensen

About the author

Chyke Ucheya Chyke Ucheya
I'm a Software Engineer at a leading Technology Consulting firm in Atlanta, GA.

E-mail me Send mail

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Recent comments

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

Sign in