ValidationExpression - Adding Text For No Spaces?
Jul 3, 2010I am using the expression to test for numbers and letters, what do I need to add to also text for "no spaces"?
View 3 RepliesI am using the expression to test for numbers and letters, what do I need to add to also text for "no spaces"?
View 3 RepliesUsing 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.
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 RepliesI am attempting to concatenate white spaces to a field value in a rdlc report.
I am using the following formula in the TextBox but it does not work as I'd like it to.
[Code]....
I have a feeling it's because it generates HTML, but I can not figure out any other way to do this. I have also attempted to simply enter an empty string (" " & field) as well as chr(10) (empty character), but these were also failures.
Also, I tested the comparisons, by manually entering fake data if the condition is met and this worked fine, so it is not the comparisons.
I have a grid. I am building and populating it dynamically in C#. Below mentioned is my issue:
string s1 = "string1";
string s2 = "string2";
And then I have a header cell text which needs to be populated like this.
headercell.text = s1 + new string(' ', 20) + s2;
I am not able to get the extra 20 spaces between s1 and s2. It gives me just one space instead of 20 spaces.
I tried using headercell.text = s1 + s2.padleft(' ', 30); even then I am not able to get more than one space between strings s1 and s2.
I am getting data straight from the database into a data source. The data is binded in a repeater with link buttons.
The problem I am having is that the data in the database might have multiple spaces in the middle of the string however when being displayed on the front end only space is being shown. After thinking about it this is standard HTML behavior to remove spaces, I would have assumed that asp.net would have handled this with the rendering of the webpage. What is also happening is that when reports are exported to excel it only has 1 space instead of two.
Example:
2 spaces: "South Africa - Cape Town"
single spaces: "South Africa - Cape Town"
This is an irrelevant example but my data has real use for multiple spaces.
I am doing project in .NET3.5(asp.net with c#.net) and Sqlserver2005.
I want to get Text as it is inputted from textbox with new lines and spaces from DB.
means do i change the datatypes in DB or should i store data in any textfile.
and also if put Richtextbox control as it is text also i should get as output in label.
and how to use rich textbox control.
like our asp.net forum witepost and getting post function.
In my ASP.NET application, I was trying to add few white spaces between two text boxes by typing space bar. The equivalent HTML source was instead of . So I just wanted to check: is this the new replacement for white space? If yes, why they changed?
View 3 Repliesi want to store some text to my database and show it later the problem is that i want to exactly store and show the way text is with breakline and spaces.what can i do?
View 2 RepliesI'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
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 RepliesI am using Editor in asp.net application.
View 3 RepliesRegularExpressionValidator.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?
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 RepliesI 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.
I have two text boxes starttimeInput and endtimeInput that have regularexpression validators to only accept input of time variables (11:00 am, 12:15 pm, etc) and then a durationLabel where I want to calculate between the start time and end time and present it to the user as minutes. I first convert the text to date and so I think I did that with the following:
[code].....
I am trying to search a list box by adding a text box next to it.
in the textbox_textchanged I added below code
'Retrieve the item's listindex
Dim i
As Integer = List1.FindString(Text1.Text)
'highligting the matched ones
List1.SelectedIndex = i
But I am getting Below error
Error 1 'FindString' is not a member of 'System.Web.UI.WebControls.ListBox'
I have an HtmlEditor from asp controltoolkit. That creates an iframe with a couple things i need (bold letter, etc). I need to add text to that iframe with jquery. so long i have this.
$('#<%= tbDescripcionInsert.ClientID %>').contents().text(textoMercancia.substring(15, textoMercancia.length));
My problem is that the things im using from the editor (bold letter etc) disappear when i add the text from jquery.
What can it be? What is the best way to add text into an iframe with jquery?
I have a question about Html.ActionLink.
Imagine:
@Html.ActionLink(item.title, "Singlet", new { id = item.blog_id })
produces http://[url]/[controller]/Singlet/[id]
But what if I want to suffix some more arbitrary data at the end? For example:
http://[url]/[controller]/Singlet/[id]/#comments
To jump to the comments div. I know I can just make the string myself with something like:
@( new HtmlString(String.Format("<a href="Blog/Singlet/{0}/#comments">link to comments</a>", item.blog_id)) )
But I am hoping there is a cleaner way, perhaps with ActionLink?
I have two text boxes called starttime and endtime which are datetime sqldbtypes that I want to subtract the value to show in a duration label. I know that you can do a subtraction with datediff in t-sql to find the time difference, and I'm wondering if that's the best way to approach this. Here is the code from my default.aspx.vb page:
[Code]....
I saw this thread but it doesnt quite cover what I'm looking for:[URL]I have two text boxes that will have a start time and an end time and what I want to do is to calculate the "duration" of the time between them while also accounting if a time starts before midnight on one day and ends on the next day (or any other day for that matter.) Then those values will be put into a SQL server database stating just the "duration."
View 4 RepliesI am trying to combine text and an image on a LinkButton:
<asp:LinkButton ID="btnTest" runat="server" Text="Book">
<asp:Image ID="imgTest" runat="server" Height="8px" ImageUrl="~/DropDownArrow.png" Width="10px" />
</asp:LinkButton>
So far, this works.
However, if I change the text of the LinkButton in the code-behind, I lose the image.
btnTest.Text = "New book name"
I have tried removing the LinkButton's controls in the code-behind and recreating the image along with changing the text, but it still doesn't work. I get either the image or the text but not both.
btnTest.Controls.Clear()
Dim NewImage As New Image
With NewImage
.Height = Unit.Pixel(8)
.ImageUrl = "~/DropDownArrow.png"
.Width = Unit.Pixel(10)
End With
btnTest.Controls.Add(NewImage)
btnTest.Text = "New book name"
How can I change the text in the code-behind and still retain the image as well?
I'm trying to add a text-only item to a databound menu control. So far all I'm capable of doing is adding more links, but no text. My goal is to have a leading item be part of the menu but not a link. I want it to be displayed as text...
I've tried adding items to the menu.items collection, but this adds links.
I've tried adding items to the menu.controls collection, but this doesn't get picked up at all, just ignored.
I have a text box for users to add their password and I want to prevent the user from adding one character in the text box ,How Can I do this?
View 1 Repliesam using ad rotator on my form. everything is working as planned. The image shows on the page.
Is it possible to have text as well to display over ( on top) of the image.
What are my options?