Showing posts with label job. Show all posts
Showing posts with label job. Show all posts

Wednesday, March 28, 2012

Programmatically defining the FilteredTextBoxExtender FilterType Property

Hi there!

I'm toying with the FilteredTextBoxExtender for a web portal we're developping at job, and thought it would simpler to define different data-entry textboxes.

With that objective in mind, I created a web user control that include a FilteredTextBoxExtender, its TextBox, some public properties to access underlying controls properties (like TextBox.Text, FilteredTextBoxExtender.FilterMode, etc.), plus a 'BoxType' private member (Type = internal enum) that's gonna define the different TextBoxes we might need (Postal codes, zip codes, money, Person namem email, and so on...)

Intended use is to simply drag the WUC on a page, define its _boxType member value, et voilĂ !

Problem is, I make a verification in the page_Load event of the WUC regarding the _boxType, and then would set the underlying extender's FilterType and ValidChars properties. But when I try to set a value for the FilterType property, I can't use more than one! The Toolkit references page says that you can use a '[...]comma-separated combination ofNumbers,LowercaseLetters,UppercaseLetters, andCustom[...]' but it won't accept the '+' operator for different FilterTypes, won't cast from string to FilterTypes (and vice versa)..

Anyone knows if that's intended?

Hi,

It's aflag enumeration. In ASP.NET's declarative markup you can specify multiple values with commas, but in C# you use the bitwise or operator |. For example, myExtender.FilterTypes = FilterTypes.UppercaseLetters | LowercaseLetters.

Thanks,
Ted


Thank you so very much, Ted. That did the trick!

And I'll most probably face that behavior a couple of times, thanks for the insight!

Saturday, March 24, 2012

Push to all user?

Hi all

It's my first visit to this forum and I must say it's a great job you all do for helping each others.

I'm also new to Atlas and want to build something that can push information to the user, and i wounder if atlas can help me.

I want to start a clock that count down from 1 minute to 0. When a user make a post that trigger this function. And I want all user that browsing the site see the exactly same countdown. And if another user hit a button it will restart and countdown from 1 minute again. Is this possible in Atlas, or were should i search for information to find the soulotion for this.

Cheers Johan

Well the problem is that you cannot send a response to the browser unless the browser has issued a request. Hence if you want to get information from the server without a user actually actively requesting something, you will need to use javascript to make repeated calls to the server (via XmlHttpRequest object) and handle the request.

The non-Atlas javascript function to use would be setTimeout() and XmlHttpRequest manually.

However, since you are using Atlas, it would make sense to use:
http://atlas.asp.net/docs/Client/Sys/Timer/default.aspx

You can then bind this to a pagemethod or web service (asmx). In your case i think an asmx would be the best solution.

The rest of the specifics of the server-side logic I'm sure you can work out ;-) The application Cache would probably be the best place to store your 'countdownLastResetAt' variable...

Hope that helps,
Carlos