|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
validation message only show in val summary when ShowSummary=true when no js to execute on clienti have a page where JS is enabled. I have validation controls that have
custom validators and don't have clientValidationFunctions. when a validation error occurs, the page stops processing and returns. When i have ShowSummary = true, the error messages appear in the validation summary on the page. When i have ShowSummary = false and ShowMessageBox = true, the error messages aren't displayed in a popup box, only the validation control's text is displayed on the form ("*"). Why is this? thanks Hi,
Thank you for your post. ValidationSummary.ShowMessageBox was designed to pop up a dialog box to show errors when client-side validation happens. Since the CustomValidator does not have any client-side validation function, hence no client-side validation happens when the button clicked. You can workaround this by following code: void ValidateBtn_OnClick(object sender, EventArgs e) { if (!Page.IsValid) { string msg = "Errors: \\n"; foreach(IValidator v in Validators) { if (!v.IsValid) { msg += v.ErrorMessage + "\\n"; } } ClientScript.RegisterStartupScript(this.GetType(), "error", "javascript:alert('" + msg + "');", true); } } Hope this helps. Please feel free to post here if anything is unclear. Regards, Walter Wang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. hi,
I have a page with 4 textboxes. Two of them are mandatory fields, whereas the other two have a condition as follows, if one is entered a value, the other should also be entered a value. how can i achieve with validation controls. Any help would be really appreciated. thanks, Ashu. Walter Wang [MSFT] wrote: Show quoteHide quote > Hi, > > Thank you for your post. > > ValidationSummary.ShowMessageBox was designed to pop up a dialog box to > show errors when client-side validation happens. Since the CustomValidator > does not have any client-side validation function, hence no client-side > validation happens when the button clicked. > > You can workaround this by following code: > > void ValidateBtn_OnClick(object sender, EventArgs e) > { > if (!Page.IsValid) > { > string msg = "Errors: \\n"; > foreach(IValidator v in Validators) > { > if (!v.IsValid) > { > msg += v.ErrorMessage + "\\n"; > } > } > ClientScript.RegisterStartupScript(this.GetType(), "error", > "javascript:alert('" + msg + "');", true); > } > } > > Hope this helps. Please feel free to post here if anything is unclear. > > Regards, > Walter Wang > Microsoft Online Community Support > > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no rights. thanks Walter I see this situation.
Ashu, you'll have to create a customvalidator and handle that logic in it on the server side and if you want the client side Show quoteHide quote "Walter Wang [MSFT]" <waw***@online.microsoft.com> wrote in message news:8HrfO%23elGHA.5184@TK2MSFTNGXA01.phx.gbl... > Hi, > > Thank you for your post. > > ValidationSummary.ShowMessageBox was designed to pop up a dialog box to > show errors when client-side validation happens. Since the CustomValidator > does not have any client-side validation function, hence no client-side > validation happens when the button clicked. > > You can workaround this by following code: > > void ValidateBtn_OnClick(object sender, EventArgs e) > { > if (!Page.IsValid) > { > string msg = "Errors: \\n"; > foreach(IValidator v in Validators) > { > if (!v.IsValid) > { > msg += v.ErrorMessage + "\\n"; > } > } > ClientScript.RegisterStartupScript(this.GetType(), "error", > "javascript:alert('" + msg + "');", true); > } > } > > Hope this helps. Please feel free to post here if anything is unclear. > > Regards, > Walter Wang > Microsoft Online Community Support > > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no > rights. > Thank you for your update and please let me know if you need more help on
this. Have a nice day! Regards, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Thanks,
I used the custom validator. thanks for the help. Ashu. TS wrote: Show quoteHide quote > thanks Walter I see this situation. > > Ashu, you'll have to create a customvalidator and handle that logic in it on > the server side and if you want the client side > > "Walter Wang [MSFT]" <waw***@online.microsoft.com> wrote in message > news:8HrfO%23elGHA.5184@TK2MSFTNGXA01.phx.gbl... > > Hi, > > > > Thank you for your post. > > > > ValidationSummary.ShowMessageBox was designed to pop up a dialog box to > > show errors when client-side validation happens. Since the CustomValidator > > does not have any client-side validation function, hence no client-side > > validation happens when the button clicked. > > > > You can workaround this by following code: > > > > void ValidateBtn_OnClick(object sender, EventArgs e) > > { > > if (!Page.IsValid) > > { > > string msg = "Errors: \\n"; > > foreach(IValidator v in Validators) > > { > > if (!v.IsValid) > > { > > msg += v.ErrorMessage + "\\n"; > > } > > } > > ClientScript.RegisterStartupScript(this.GetType(), "error", > > "javascript:alert('" + msg + "');", true); > > } > > } > > > > Hope this helps. Please feel free to post here if anything is unclear. > > > > Regards, > > Walter Wang > > Microsoft Online Community Support > > > > ================================================== > > When responding to posts, please "Reply to Group" via your newsreader so > > that others may learn and benefit from your issue. > > ================================================== > > > > This posting is provided "AS IS" with no warranties, and confers no > > rights. > >
Problem updating with TableAdapter in Detailsview.
Formview Question "AJAX" techniques for the ASPNET 2.0 TreeView control? I need a chart control with a special feature Event from one WebControl triggering an event in another Web control Client ID of User Control in Page templates HttpContext.Current.Session problem Sorting DataView problem Interactivity between placeholders & objectdatasouces Asp.Net AutoPostback and control focus |
|||||||||||||||||||||||