If i use DataAnnotations on my Model and my model have something like this:
[Code]....
and in my View, i have a textbox WITHOUT client side validation. If the user enter non-numbers caracters in this field, i would like to validate on the server side that the user have entered non-authorized caracters and message him back on that. But since that my Model's Days property is a INT, the ModelBinder can't parse the string in the int property and generate an error in the ModelState with no message at all. And if the user doesnt enter anything on this field, the ModelBinder also try to put an empty string in a int property and generate an error in the ModelState with the message "a value is required". This is not the message that is written within the DataAnnotation. I have no control on the message that is generated.
So my question is:how can i valide the users input for int properties (or DateTime, etc...) and if the user enter a bad value i can put in the ValidationSummary something like this: "You can't only enter a numeric value for Days".
I have two lines of dropdown menus. There are 3 dropdown in each line (together 6). First dropdown in each line is "independent". The second and third are dependent. If user selects second, page loads and user can then selects item in third. So user have option to select first OR second and third in each line.
.ASPX code:
[Code]....
Since I've found out that you can't validate dropdown controls directly with CustomValidator I've wrote few lines of code for each of dropdowns to insert some values in txtBx_Cln1n2 which will be hidden when the page will be finished.
[Code]....
Unfortunately the code for CustomValidator have some bugs. If user doesn't select anything error message is shown. But if he choose 1 employee and then second and then select (I doubt that anybody will do this but I want to be sure and prevent as much exceptions as possible) the first item in one of the dropdowns ("all employees" or "employees by group") the custom Validator will allow execution of code for link button although the validation code should prevent this.
[Code]....
I know I could this a little better since code is quite complicated if I want to tell the user which employee he/she forget to enter. I've tried instead of SelectedItem.Value also SelectedIndex != 0 but the problems are the same.
I couldn't validate this without the use of textbox. But this method is also making complications since user can select 2 employees and then in one of the selected dropdown change selection to index = 0. Maybe I have to disable viewstate on all dropdowns? But this would probably affect INSERT of data?
I'm making a website in ASP.NET 4.0 where I make use of the RequiredFieldValidator control to validate a wizardstep.It works perfectly with Javascript enabled, but when I turn it off (in my Firefox) it just goes to the next step.We don't do a Page.IsValid check, but we don't do much on the "next button clicked" event either.Certainly not something that is forcing it to go to the next step.
I have an application in ASP.NET that uses forms authentication. It has the following code.
if (User.Identity.IsAuthenticated) ViewStateUserKey = User.Identity.Name;
Stepping through I see this code executes on each page load. When a logged in user requests the page, the ViewStateUserKey is filled in with their username. If you let the page sit till forms auth times out, the user is no longer logged in, and a post back fails on validation of the viewstate because the name is now null. However I have noticed if I put other buttons on the screen, and the post back, it doesn't fail, even after authentication has timed out. Should this error every time it times out?
I have a CreateUserWizard where there are two plain WizardSteps, then the CreateUserWizardStep, then CompleteWizardStep. In the CreateUserWizardStep I would like to use a reCAPTCHA control. Obviously when I go to the first plain WizardStep the reCAPTCHA control is invalid. So when I click the Next button from the first WizardStep the form isn't valid and I can't progress. I'm not sure how to handle this situation.
Users are complaining they need to click the submit button. They want the option to use the Enter Key on the keyboard as well. How do I enable the Enter Key?
Below is my working code.
<asp:Content ID="Content1" ContentPlaceHolderID="ContentSpeeD" Runat="Server"> <p>Prove yourself Human by passing the Captcha Test.<br> Please type the two words below.<br> The purpose of this test is to help prevent our site being spammed.</p> <recaptcha:RecaptchaControl ID="recaptcha" runat="server" PublicKey="pubkey" PrivateKey="privkey" /> <br /> <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /> <br/> <asp:Label Visible=false ID="lblResult" runat="server" /> </asp:Content>
I am using the captcha from recaptcha.net in my asp.net webform. The webform has a checkbox list which does an auto-postback. Now when I select any of the checkboxes, the pages is posting back and the captcha is refreshing too and gives me a new image and also throws the validation error,"Incorrect word, please enter".how to avoid the refrshing of the image(or captcha) on every postback of the page.I tried using other capctha controls from code project but I need an audio control for my captcha and have tried to use .net speech libraries to produce the audio, but could not succeed.So I am working with the recaptcha instead.
I have a word document which opens in a web browser using ASP.NET 2.0 this is the code:
[Code]....
THIS WORKS, PROMPTING THE USER WITH "OPEN" "SAVE" "CANCEL" OR SOME USERS WITH "SAVE" "CANCEL" DEPENDING ON USER INTERNET SECURITY SETTING. BUT FOR SECURITY ISSUES, MY BOSS WANT THIS WORD DOCUMENT TO BE OPENED IN WORD PROGRAM. (MICROSOFT WORD 93,97 ETC) IS THIS POSSIBLE....? OFCOURSE SAVING THE FILE IS OKAY, JUST OPENING THE DOCUMENT SHOULD BE NOT BROWSER.
My requirement is : I have to open a word document in Microsoft word from my web application and the word document is stored in the server location.
In javascript i wrote a code to open the word document like below. var dsWordApp = new ActiveXObject("Word.Application"); var WordDoc = dsWordApp.Documents.Open(FileName)
Using above script i am able to open the local word doc files but i am unable to open the server side word doc file.
I am using recaptcha in an ASP.NET 3.5 application and for some odd reason the ErrorMessage property is not working. Below is my code
<recaptcha:RecaptchaControl ID="recaptcha" runat="server" PublicKey="*******************************" PrivateKey="*******************" Theme="white" ErrorMessage="This is an typo error" />
When the typed text doesn't match with the recaptcha image text it still shows the default error message "Incorrect. Try again." instead of my custom error message. What could be the reason for this strange behavior
I've implemented reCAPTCHA following the instructions on this site:[URL]However I am unable to get it to render on my lightbox. It renders as below when i check with firebug.
<noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=6Lctg74SAAAAADV4UAfyRdEUdZi_FGc4PCqA7LEn" width="500" height="300" frameborder="0"> </iframe><br /><textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea><input name="recaptcha_response_field" value="manual_challenge" type="hidden" /> </noscript> Note that when i look in firebug the < and > display as the text "& lt;" and "& gt;" (without the space)
Let me know if there's any additional information required to help with this problem.
I'm implementing the recaptcha control from google.
I built a simple c# test project from their example and all works. Now, instead of having the PublicKey and PrivateKey in the aspx page, I'd rather assign these values at run time as they will most likely be pulled from either the web.config or a database table.
I have a master page which contains a Login control so that the user can login/logout from any page. However, a couple of content pages require a Recaptcha control. This causes problems because when I try and log in on a page that has the Recaptcha control, the system expects me to enter the words. I'm aware of the lack of validation groups in the Recaptcha control, and the fact that you can't have multiple forms on an ASP.NET page. Is there a way to work around this? A 'hacky' way I can think of, is in the "Login" event, check the page for a Recaptcha control. If one exists, then disable it, otherwise continue. However, that just seems quite inefficient especially when there are quite a few pages and most won't have a Recaptcha control.
The reCaptcha example for ASP.NET does not seem to work. I followed the instructions but it always returns false, "The verification words are incorrect.". The entries are good. I'm using localhost as the site but am not getting any public/private key errors which I did get when adding a bad key (as a test).I've seen this error reported a lot but no good answers. Some suggest to call the validate on the control before checking to see if it is valid but this did not work for me.
We are using recaptcha ASP.NET control:[URL]However, we find that in some situations, recaptcha accepts answers which are clearly wrong.For example, recaptcha provided these words: of purserThe tester typed in the following: o purser ..but Page.IsValid returned true! Is this a known issue with recaptcha?
I'm using ASP.NET plugin for reCAPTCHA in my ASP.NET MVC application. Recaptcha assembly version is 1.0.4.0. Is there a way to set language to be used for RecaptchaControl?
var captchaControl = new Recaptcha.RecaptchaControl { ID = "recaptcha",
I'm trying to integrate recaptcha into a contact us form but can't get it to work. The email is sent whether or not I type in the captcha text. When I type the word into the box incorrectly it still goes out and I don't get a message to say it that it was wrong either.