Wednesday, July 22, 2009

Minimun and Maximum Text Box length Regular Expression

Today i had to use a minimum and maximum TextBox length RegEx,

so here it is, simple and handy, in my context i had a password field which we require the user to have at least 8 characters and the user can only have as many as 34 characters.

on your aspx page place the following RegEx where you want it to show the Error,

as you notice in the asp:RegularExpressionValidator control above, the attribute, ValidationExpression is equal to [\S\s]{8,34} , in the context of this example it is important to notice that enforced number of minimum characters and 34 is the number of maximum allowed characters.

The ToxtBox which the RegEx is hooked up to,

Please let me know, in case of more explanation needed

Tuesday, July 21, 2009

Here we go...

I am really pleased to write my first post on 'dot net Engineering',

I think it would be appropriate to introduce myself a little bit (Please excuse grammatical and spelling mistakes in posts on this blog (I will try to catch most of them at the Code Level ;) ) but i must say , the idea is to use "as long as you can understand" approach.

I am software Engineer and have been working in the industry since 2000/2001.

My first few programing languages from 1994 to 1999 were, GWBasic, Fortran, Fox Pro.
I started of as a vb6 developer.
Studied Borland C, C++, Visual C during my pursuit of B.S.C.S
Worked with Computer Networks and Infrastructure, specializing in WindowsNT, Windows Server 2000, Windows Server 2003 and ISA Server
Taught at a local Computer College and worked there as a Network Administrator
Then worked as a Web Developer (using asp Classic and heavy on photoshop, Adobe ImageStyler, Adobe Photoshop, MS FrontPage, Dreamweaver, MS Visual Web Developer)
Did some work with 3DMax
Worked with ASP 1.1
Then came the good times :) ,

ASP.Net 2.0 Came out .. yay.. for the last three odd years i have, been working as a full .Net Developer.

I work at a local Company and my position, encompasses,
Planning, designing, implementation and to maintain web applications using both VB.Net and C#.Creating user interface objects, business objects, and writing stored procedures and triggers.Unit testing and documentation as required by the established systems development life cycle.
My major responsibilities are,
Create requirements for web applications, Convert basic or full requirements into working web applications. Design database schemas, business rules, and database objects via SQL Server. Follow security and best practices to ensure stability and security. Participate in Analysis and design of Web Architecture

In this blog,
I will be writing to share and discus primarily,
Software / Web Engineering (Mostly sticking to .Net Architecture as the name of the blog suggests) Problems and topics.
But i will be open to answer any question, regardless of the difficulty level, to share knowledge and to even train new comers
(As many developers/teachers/colleagues helped me a lot during the time i needed help, and i am really thankful to all they have imparted in me by helping me and are still there whenever i need support, namely,
Arthur Anab Shams,
Bob Swanston,
Derek Woods,
James Nelson,
Nabeel Riaz,
Robert Schaefer and many others
)

* All the material in the posts of this blog are my own and can be reproduced (unless otherwise mentioned), changed and reused for the purpose of propagation of knowledge and to the benefit of all Moral && Ethical && Legal Purposes (Abiding by US and International Law).
* I am not responsible for any any un-expected (unintended) results from the posted code and code mentioned should only be used on personal risk.
* I will explicitly mention and properly cite references to Authors when i use their materials, and permission must be acquired from the mentioned author or source to use that linked or cited material.

P.S. If you are looking for my personal blog, please use the link below,

Second Post

Following Post is imported from,
http://salmonriaz.blogspot.com/

which is not my non .Net Programing blog, just for personal thoughts and writings,

---------------------------------------

OK So finally i thought i should write my first post, so there it goes,

Sometimes small problems end up taking way longer time that you would think,

I have been trying to set selected value of rad combo box to a value matching my DataBase value,

as follows,

DataSet ds = cs.GetUserID(new Guid(Session["CompanyID"].ToString()));
if (!(ds.Tables[0].Rows[0]["UserID"].Equals(DBNull.Value)))
ddlContact.SelectedValue = ds.Tables[0].Rows[0]["UserID"].ToString();

Did'nt realise that C# on the most part is case sensative and Guids are saved in CAPS in SQL Database, so this wasnt working...

==> Just Added .ToUpper() and it work as follows,

DataSet ds = cs.GetUserID(new Guid(Session["CompanyID"].ToString()));
if (!(ds.Tables[0].Rows[0]["UserID"].Equals(DBNull.Value)))
ddlContact.SelectedValue = ds.Tables[0].Rows[0]["UserID"].ToString().ToUpper();

Thought i should share :)