MVC :: How To Localize "field Is Required" Validation Error Message In Musicstore Sample
Nov 28, 2010I tried to localize codeplex mvc musicstore sample in .NET 3.5
View 22 RepliesI tried to localize codeplex mvc musicstore sample in .NET 3.5
View 22 Replies[Code]....
[Code]....
[Code]....
[Code]....
Given the above scenario, I would have thought that submitting the form with a blank ProductId would have been fine because I didn't decorate the ProductId property with [Required]. However I get the error message "The ProductId field is required".
Is there any way to make an Integer property on the model not required?
I backported MVC musicstore sample in codeplex to .NET 3.5
From VWD2010 IDE it runs OK, uses ASP.NET web server.
I published it to local file system. Web.config file included in musicstore source code is present in root.
Typing http://localhost in browser returns error
HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.
<fieldset><legend>Detailed Error Information</legend>.....
i am working on web-form for which I have set the validation summary showmessagebox = "true". I have two required field validators, which trigger on a checkbox's OnCheckedChanged event....now my problem is, when I hit submit, the page does not submit if I do not enter any values in the text boxes..which is correct behavior but it does not point out to the error or does not display the message box...i have to scroll up to see what is wrong with he page and then try to enter the values...I do not understand why my message box does not show up or at least why my setfocusonerror which is set to true does not show me the text boxes. find my code below.....
View 1 Repliesi am working on web-form for which I have set the validation summary showmessagebox = "true".
I have two required field validators, which trigger on a checkbox's OnCheckedChanged event....now my problem is, when I hit submit, the page does not submit if I do not enter any values in the text boxes..which is correct behavior but it does not point out to the error or does not display the message box.
i have to scroll up to see what is wrong with he page and then try to enter the values...I do not understand why my message box does not show up or at least why my setfocusonerror which is set to true does
not show me the text boxes...
find my code below...
[Code]....
[Code]....
[Code]....
I'm using Data Annotations to validate my fields, Eventhough field is marked with Required Attribute the DropdownList/ListBox Value doesn't fire up to show they are required. how can I solve this.
View 3 RepliesI usually only write in ASP, so I am not very familiar with this script. Can anyone tell me how to how to request a querystring so I can use it to pull the image location. Like this.
PhotoCropper.aspx?userid=1090&picid=47
private const string ORIG_SAMPLE_PHOTO_URL = @"/PhotoCropperC/photos/1090/47.jpg";
I have tried just using Request.QueryString["userid"];, but I get the compiler error. Here is my code:
public partial class PhotoCropper : System.Web.UI.Page
{
//Make sure you give the IUSR_MachineName permissions to the directory below
private const string ORIG_SAMPLE_PHOTO_URL = @"/PhotoCropperC/photos/TheDog.jpg";
//private const string ORIG_SAMPLE_PHOTO_URL = "~/photos/TheDog.jpg";
private const string CROPPED_SAMPLE_PHOTO_URL = @"d:/inetpub/sites/dc/cropper/TheDogCropped.jpg";
protected void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
loadPhoto(ORIG_SAMPLE_PHOTO_URL);
}
else {
loadPhoto(CROPPED_SAMPLE_PHOTO_URL);
btnCrop.Visible = !btnCrop.Visible;
}
}
<asp:TextBox ID="txtDraftsmanName" runat="server" Width="200px" CssClass="inputtext" >
</asp:TextBox>*<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtDraftsmanName" ErrorMessage= "Please enter Draftsman Name!! " Font-Bold="True" Font-Size="8pt" ForeColor="DarkRed" ValidationGroup="saveDraftsman"></asp:RequiredFieldValidator>
<asp:Button ID="btnSaveDraftsman" runat="server" Text="Save" onclick="btnSaveDraftsman_Click" ValidationGroup="saveDraftsman"/>
I tried [URL] mvc musicstore sample in .NET 3.5
View 11 RepliesI tried musicstore mvc sample in codeplex in .NET 3.5
Filling new use registration form throws error that password remainder question must be filled. However there is no such field in registration form.
How to register new user in this sample ?
I'm writing an multi-language MVC app.So far, all localisation went well using resource-Files, but now I can't find a way on how to localise this string, which shows up on all [required] attributes of my model (if I leave them empty like "The Username field is required".
I read a few hints like: http://stackoverflow.com/questions/1538873/how-to-replace-the-default-modelstate-error-message-in-asp-net-mvc-2/ , but it does not work for me. where to find this strings and how to localise?
Customer wants to see following:
[URL]
I have
[Code]....
in result there are :
[Code]....
How to set styles for required display?
MVC musicstore contains code:
<p class="button">
<%= Html.ActionLink("Payment >>", "AddressAndPayment", "Checkout")%>
</p>
this creates button which has lot of space before and after text. If clicked in this space, button click is ignorred since it is outside generated <a> element. Only clicking in button text invokes action.
How to fix this so that clicking everywhere in button invokes action ?
I have Dropdownlist whose value field and text field are bind at runtime. it has --select-- as first item with a value of '0' and the rest of the values are bind at runtime.
I have given validaton group for both the control and the validator as "g1" and Intialvalue=0
But still the page is posting back even if I select '--select--' option.
[Code]....
If I have a search object with a list of fields, can I, using the System.ComponentModel.DataAnnotations namespace, set it up to validate that at least one of the fields in the search is not null or empty? i.e All the fields are optional but at least one should always be entered.
View 2 RepliesI'm trying to use a field validator to make sure one of my list boxes has a selection before the user is able to proceed to the next page. i'm having is that if the validation message is triggered, all of the buttons on my page loose functionality.Meaning, if I purposely trigger the validation control, I can't get rid of the error message and none of my buttons do anything when clicke after this.
The majority of the HTML:
[Code]....
Is there something that I need to add to the code behind of the page or the Java Script that I'm using?
I have three asp checkbox controls and button click. If any of those three checkboxes is not selected it shoudld validate . How can i accomplish this?
Here is a code for my web form control
<asp:TextBox runat="server" ID="txtUsername"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtUsername" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
<asp:CustomValidator OnServerValidate="checkUsername" ID="CustomValidator1" runat="server" ControlToValidate="txtUsername" EnableClientScript="true" ClientValidationFunction="checkUsername" ErrorMessage="CustomValidator"></asp:CustomValidator>
Client side validation
<script type="text/javascript">
function checkUsername(source,args){
alert("test");
/* alert(args.Value);
[Code]....
I have a web forms where i have 10 required field validators for 10 textboxes. Validation group for these required field validator needs to be determined when the page loads. I tried to change the validator in the .cs file but failed.
rfvBT.ValidationGroup = "registration";
I have a textbox with a required field validator and two buttons .One to save and other to cancel the action. On clicking the cancel button i am clearing the text entered in textbox.
The required filed validators is working on the save button if the textbox is empty. But on my cancel button click the required field validators message is blinking .
I am giving the mark up of my controls below:
[Code]....
I want to apply styles on the message (i.e. Name field is required) display by the asp.net required field validator control.
Styles=border, padding, background-color, font-color, font-weight, img etc
And I also want highlight the border or asp.net textbox and asp.net dropdown list with which this control is associated.
RequiredFieldValidator does not have style property !
i am using the required field validation and Reqularexpressioncontrol in gridview. Fields are in the gridview are in template, but only the edit button it is not templeted, this edit buton is of type Imagebutton and same goes with canel and update.
1_ Do i have to use the Templeted fields for edit/cancel/ and update as well in order to use the validation?
2_Validaiotn should only work when user clicks on the Update button, it should not trigger when cancel button fired.
to explain my problem as simple as i can i have made the following page each textbox is a required field. when i enter valid data in the text box and click the button everything is fine. the problem i am having is that after this button click > i empty out the last 2 textboxes > click the button > the required field validation is not thrown.
the autopostback property being set to true is a must in this case.
[Code]....
I created some required field validators and a validation summary control. When I get an error it displays next to the control its validating and also inside the validation summary control. I only want the error to display in one place; inside the validation summary control. I tried making the required field validator invisible but then it didn't display anywhere.How can I get the errors to only display in the validation summary control? There is no need to display them twice it just clutters up the page.
View 3 RepliesI have forgotte password page in my application,page have one textbox to insert email address,when user click on submit button if inserted email address (i.e. abc@gmail.com) does not exits in DB it will give custome error message like "Email ID not available".after that suppose user will enter inproper email address (aaa#gmail.com) than client side validation for regular expression will file "Email id not valid",at same both message be on screen,now i want only one message at a time.so please can you help me for same
View 2 Replies