Web Forms :: ValidationExpression To Just Accept A-Z, 0-9 / Hyphens / Underscores / Spaces?

May 11, 2010

Using a RegularExpressionValidator, I want my textbox to accept a max of 20 chars, and only English characters A-Z (upper and lowercase), 0-9, hyphens (-), underscores (_), and spaces. That's it.

Now that I think about it, since this text will be used by a proprietary software to create a file of the same name, and will also be included in the querystring when the page is redirected (so that I can find the file so the user can download it), I'm not sure if I should keep it safe and not accept spaces.

View 4 Replies


Similar Messages:

MVC :: Converting Underscores In Anonymous Objects To Hyphens?

Dec 2, 2010

anonymous attributes with underscores are supposed to render as hyphens to allow unobtrusive ajax attributes.

It works fine for this:

@Html.TextBox("Name","Value", new {data_unobtrusive_attr="attrValue"})

gets correctly rendered as this:

<input type="text" name="Name" value="Value" data-unobtrusive-attr="attrValue" />

However, it doesn't work for the Ajax.BeginForm helper (kinda the most important place for that to work!) -- the underscores just stay as underscores.

View 5 Replies

ValidationExpression - Adding Text For No Spaces?

Jul 3, 2010

I am using the expression to test for numbers and letters, what do I need to add to also text for "no spaces"?

View 3 Replies

Web Forms :: Notation Of ValidationExpression (of A RegularExpressionValidator)?

May 10, 2010

I am currently working on a web form where you need to make your own account. One of the required fields is where you need to fill in your postal code. I work with an RegularExpressionValidator. This exists out of 4 numbers. The first number may not be a zero. I know that I need the ValidationExpression (propertie of RegularExpressionValidator) but I don't know what to fill in.

View 1 Replies

How To Allow Hyphens In URLs For Mvc 2 Controller Names

Mar 12, 2011

[ActionName("about-us")]
public ActionResult EditDetails(int id)
{
// your code
}

The above works for actions but I would like to be able to do the same (or similar) for controllers, ie have a hyphen in the URL name too. Is there any easy way to achieve this (I tried the ActionName attribute but no luck)

View 2 Replies

DataSource Controls :: How To Hyphens In Field Data

Apr 13, 2010

Once again, I find myself stuck!

I am attempting to compare one of ASP.NET's membership userID's with the current userID in an SQL query, however because of the "hyphens -" in the uniqueidentifier field type of userID, i am unable to compare the ids. is there a way around this? (in my example, family_id from tblFamily is the userID that has type uniqueidentifier). my code as it stands is:

Dim UserID As String = New String(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString())
Response.Write(UserID)
Dim strConn As String = ConfigurationManager.ConnectionStrings("ApplicationServices").ConnectionString
Dim SQLI As New Data.SqlClient.SqlCommand("SELECT family_name FROM tblFamily WHERE [family_id] IS " & UserID & "")
Dim sqlCon As New Data.SqlClient.SqlConnection(strConn)
sqlCon.Open()
SQLI.Connection = sqlCon
Dim RSI As Data.SqlClient.SqlDataReader = SQLI.ExecuteReader()
RSI.Read()
Dim FamilyName As String = "0"
While RSI.Read
FamilyName = Convert.ToString(RSI("family_name"))
End While
Response.Write(FamilyName)
RSI.Close()
sqlCon.Close()

View 6 Replies

MVC2 Not Replacing Underscores With Dashes In HtmlAttributes?

Nov 9, 2010

I've heard from a couple of different sources that when using HTML helpers in ASP.NET MVC2, one can create custom attributes with dashes in them (e.g. <a data-rowId="5">) by using an underscore in place of the dash, and when the HTML is written to the page the underscores will be replaced by dashes.

So, something like this:

<%= HtmlActionLink(Model.Name, "MyView", null, new {data_rowId = Model.id}) %>

should render as

<a data-rowId="0" href="myURL">Row Name</a>

But... it's not. I think that maybe this feature is only enabled in the MVC3 Beta preview (as it's mentioned in the MVC3 preview release notes), but this thread is about the same thing, and it's regarding MVC2.

I know I can use the other solution presented in that thread, but I'd rather not have to resort to using the dictionary if a more elegant solution exists.

View 2 Replies

WCF / ASMX :: Svcutil Generates Underscores In Enum With Type Int?

Feb 8, 2011

i am generating a wcf data contract from a schema, using svcutil /d: option, however the enum of type xsd:int in schema is generating all the values as ints, with underscores, obviously to make valid code. How can i get the actual value of 1000

E.g Enum Impact with values 1000,2000,3000 generates code

public enum Impact : int
{
[System.Runtime.Serialization.EnumMemberAttribute(Value = "1000")]
_1000 = 1,
[System.Runtime.Serialization.EnumMemberAttribute(Value = "2000")]
_2000 = 2,
[System.Runtime.Serialization.EnumMemberAttribute(Value = "3000")]
_3000 = 3
}

View 2 Replies

Encrypt ValidationExpression In VB.net?

Jan 20, 2011

I'm very new to asp and vb.net, I've just learned about regular expression validation but one thing is bugging me: How can I hide my expression from being viewed on my source code?

The plan is to make a very simple 'login' type of page. I know this goes against all that is holy in this kind of operations, but it's just something I'd like to try out.

Also, after the expression has been validated, I want to load another page, I was thinking of achieving this with:

<asp:TextBox ID="txtcp" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="CP Errada"
Display="Dynamic" ControlToValidate="txtcp" ValidationExpression="admin"></asp:RegularExpressionValidator>

and in vb:

If txtcp is validated then Response.Redirect("mypage.aspx") end if

But the syntax on this IF is obviously not right

View 1 Replies

Vb.net - Adding ValidationExpression To Customvalidator?

Dec 30, 2010

i have this ValidationExpression="(d{1,}.{0,2} .{2,})|(.{2,} d{1,}.{0,2})" used in regularexpression validator. I want to use the same one in a customvalidator. But customvalidator does not have option validationexpression. how can i add this in code or in tag.

View 1 Replies

.net - RegularExpressionValidator.ValidationExpression To Force Length In 10 Or 12 Symbols?

Feb 25, 2010

RegularExpressionValidator.ValidationExpression="d{10}" means only digits - 10 max.

RegularExpressionValidator.ValidationExpression="d{10,12}" means only digits - 10, 11 or 12.

How to force strictly 10 or 12 symbols?

View 4 Replies

Implement A RequiredFieldValidator With A ValidationExpression Which Is Fail Validation?

Jun 8, 2010

I'm trying to implement a RequiredFieldValidator with a ValidationExpression which is fail validation if the value is -I'm guessing there will probably be a very simple RegEx for it but I am still trying to get my head around it.

View 7 Replies

RegularExpressionValidator Always Fails, But ValidationExpression Works In Testing?

May 21, 2010

I found the answer to this, but it's a bit of a gotcha so I wanted to share it here.

I have a regular expression that validates passwords. They should be 7 to 60 characters with at least one numeric and one alpha character. Pretty standard. I used positive lookaheads (the (?= operator) to implement it:

(?=^.{7,60}$)(?=.*[0-9].*)(?=.*[a-zA-Z].*)

I checked this expression in my unit tests using Regex.IsMatch(), and it worked fine. However, when I use it in a RegularExpressionValidator, it always fails.

View 2 Replies

Web Forms :: Blank Spaces After Zip And Why Do They Causes?

May 3, 2010

I've finally figured out an issue I'm have with a zip code field being entered in a text box of a details view in edit mode. I'm trying to understand why i have the issue though. I don't understand why it keeps occurring.his what happens with the zip code field. I've been able to make it reoccur numerous times. If the details view is put in edit mode and the record is updated with the original 5 digit zip code, unaltered in any way, my regular expression validator catches it and doesn't let the update happen. If I change the replace the 5 digit zip code with a new one the update goes through fine. This new value can be a different or the same 5 digits and the update will work. If I don't change the value at all though the update will not go through.

View 8 Replies

Web Forms :: Regex With Min Characters And No Spaces

Oct 14, 2010

How can I make this regex not accept spaces?: [0-9a-zA-Z' ']{3,}

Everything I'm reading says to put a * or a + after the [] , but I get an invalid expression error when I do. The end result I'm looking for is a string of letters and numbers only - no spaces inbetween.

View 5 Replies

Web Forms :: Get Rid Of Empty Spaces Before String?

Oct 18, 2010

I have a textbox where email addresses are displayed at the click of a button. There is one problem, before the first email address there are two empty spaces. Is there any way of getting rid of them? The result looks like this: " emailaddress; emailaddress; emailaddress;"

Here's my button click:

[Code]....

View 2 Replies

Web Forms :: How Add White-spaces In HtmlTextWriter

Jan 11, 2010

I am trying to add white-spacess before showing my hyperlink.

Data

{space} {space}HyperLink1

{space} {space}HyperLink1

[Code]....

View 1 Replies

Web Forms :: Asp Menu Spaces And Error In IE And FF

Jun 2, 2010

I have asp menu. My code:

<div> class="menu"
<asp:Image ID="Image9" runat="server" ImageUrl="~/Images/logout.png" ImageAlign="Middle" /><asp:HyperLink ID="HyperLink9" class ="Mymenu" runat="server">Moj račun</asp:HyperLink>
<asp:Image ID="Image10" runat="server" ImageUrl="~/Images/logout.png" ImageAlign="Middle" /><asp:HyperLink ID="HyperLink10" class ="Mymenu" runat="server">Izplačila</asp:HyperLink>
<asp:Image ID="Image8" runat="server" ImageUrl="~/Images/logout.png" ImageAlign="Middle" /><asp:HyperLink ID="HyperLink8" class ="Mymenu" runat="server">Vplačila</asp:HyperLink>
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/logout.png" ImageAlign="Middle" /><asp:HyperLink ID="HyperLink2" class ="Mymenu" runat="server">Odprte stave</asp:HyperLink>
<asp:Image ID="Image7" runat="server" ImageUrl="~/Images/logout.png" ImageAlign="Middle" /><asp:LoginStatus ID="LoginStatus2" class ="Mymenu" runat="server">
</asp:LoginStatus>
</div>

I have two questions

- Images are displayed OK, but in IE and FF the images move down? Why so?
- I want the menu to make spaces between words. What do you do?

View 9 Replies

Web Forms :: Allow Blank Spaces In Textbox?

Sep 14, 2010

I have a simple issue..the user types his/her name in a textbox. Accidentally if a space is entered after a name or before, is it possible for me to trim it while accepting and not raise any error (which actually arises when the textbox is empty)?

View 5 Replies

Web Forms :: Text Box Should Accept Only Numbers?

Oct 19, 2010

i want a text box in asp that should take only numbers if we enter alphabets or special characters that should give an error how can i achive this

View 8 Replies

Web Forms :: How To Text Box Accept Only Numerics In .net

Jul 15, 2010

i have text box, i want to enter age in to that,if i enter "Text" into that that text should not enter into that.only numerics only enter. Alphabetic key must be disable for that text box.

View 9 Replies

Web Forms :: Sitemap Does Not Accept Path?

Feb 14, 2011

site map doesnot accept pat with ?id=2,etc.

eg:-

www.aabc.com/search.aspx?id=3 is not accepted nad gives error.

whereas, www.aabc.com/search.aspx works fine.what should i do.

View 6 Replies

Web Forms :: Accept Textbox Value Even If It's Null?

Jun 14, 2010

I have a javascript to validate and avoid null values for my form but there are some textboxes that I need to be 'optional'. I tried erasing the validation for province address and province contact in javascript to make it optional, but the problem is whenever I add the values in the database, an error message appears "Input string was not in a correct format". It's in C# This is my present code wherein the provincial address and provincial contact must only be optional:

protected void submitButton_Click(object sender, EventArgs e)

View 15 Replies

Web Forms :: Only Three Email Domain Accept

Sep 20, 2015

In my registration form, there is field to enter emailid of member, i want to restrinct user, so that he would able to enter to only three domain name like gmail, hotmail, yahoo like this emailids.

View 1 Replies

Web Forms :: How To Query String Texts With Spaces In URL

Apr 22, 2010

Here is my SQLServerDataSource control:

[Code]....

The data in the database contains spaces like this "My Social Network". However, when the url is like this:

[URL]

It does not work. Why is spaces causing problem here? How do I get it work?

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved