I have a dropdown list for the which values are coming from DB. There is one option name OTHER, when I select other the textbox appears. For that Textbox I have made a required field validator. Till here it works fine. But when I select any other option, still it gives me validator errors. It should not happen. It should only give me required field error when the user doesn't fills the textbox on select of OTHER option. Please see the code.
I have an ASP.NET TextBox ID="txtDate" in my usercontrol. It has ValidationGroup="MyUC" set. Now my UC is inside a Repeater Control. So there will be multiple instances of the same textbox. I am able to get all textboxes like: $("[id$='_txtDate']");
Each of the txtDate will have a separate ValidationGroup assigned to it, dynamically. So I want to get a textbox based on the id + ValidationGroup using jQuery / javascript.
Edited based on Josiah's Reply and the way I found:
my scenario is kind of complicated to include entire code. In short the textboxes are attached to jquery datepicker and the code below runs when a date is selected. The same handler is attached to multiple textboxes. Here is what I have:
var valgrp="MyGroup"; /*this mygroup is dynamic but keeping static for e.g.*/ var txtdate1 = $("[id$='txtDate']").filter(function(){if(this.Validators!=null){return this.Validators[0].validationGroup == valgrp;}}); var txtdate2 = $("[id$='txtDate']").filter(function(){return this.validationGroup == valgrp;}); alert("date1- " + txtdate1.val()); /*this returns date selected from datepicker*/ alert("date2 " + txtdate2.val()); /*this returns empty*/
Depending on the date I want to do something else. So txtdate1 is currently working for me where I don't have to add class to my textbox. I was playing with the txtdate2 which isn't behaving how I was expecting and so I had to post this question.
Here is a sample test to see this.validationGroup not returned:
In my web page I have a Checkbox (datatype = tinyint/boolean) and 2 Required field validator (whose visibility is false). I want that when I check(tick) the checkbox, then required field validator visible = true, else not.For this I tried this code on Page_Load as well as on save button click, but it is not working:
I came across the below article, I would like to know how to properly respond to the drop or stop event so that I can show the Save button only once someone changed the order. In other words, I would like the Save button hidden initially, only to make it visible once a drag and drop has occurred.
I want to disable a ASP.NET RequiredFieldValidator with JavaScript. Actually I'm using the following code:
function doSomething() { var myVal = document.getElementById('myValidatorClientID'); ValidatorEnable(myVal, false); }
This disables the validator. But my problem is, that I'm using a ValidationSummary. And this summary shows the validation message, even if I disable the validator.
how to disable the validator in the ValidationSummary too?
How to Disable user click on Gridview header and first two columns? I am using a modalpopuextender for which girdview is used as targetcontrolid. I need to pop up panel2 when user clicks on anywhere on the gridview except the gridview header and first two columns.
I am trying to put in scripts for google analytics in my code. But I want it to run only if the environment is production and not in dev or qa. This javascript runs at page load itself and I am confused how to make it run conditionally. My app is an asp.net app.
Javascript is always confusing to me. There are many other javascripts in the page and I just need to disable this one. Had it been a .net code/function I would check for the environment and conditionally run the function. But I am confused about how to accomplish this type of functionality with javascript
I have a scenario where a RadioButtonList needs to be in disabled mode by default and then on some event on client side, say, when a checkbox is checked, it needs to be enabled.
But once I disable it from code-behind, the javascript part of enabling it doesn't work.
I have file upload and Radio button list controls in the page
Requirement:
When the page load, the file upload control has to be enable = false when I click on the radio button list's Yes option then it has to be enable = true and when No option is clicked then enable = false
i have an AJAXIFIED button(btnsend) thas is disable by it's Property -> Enabled="False"
i have a TextBox Next To This Button And I Want Enable that Button When Users Type Something in That TextBox...
so i did this (JavaScript):
function onkeyupontextbox() { var btnSend = document.getElementById("btnSend"); btnSend.disabled = false; }
but that button does not work after becomes enable...
what can i do about that?
(i am using radajaxmanager for ajaxify that button) (when i remove that button from RadAjaxmanager Or UpdatePanel So EveryThing Is Ok , But I Want That Button In Ajaxify Mode)
I have a button on which I wish to validate a specific ValidationGroup in ASP.NET. This button is not a server control, but a standard a tag with an onclick event on.
I have multiple validation groups on this page, so by calling Page_ClientValidate() is not enough, as the other validators will kick in as well.
I'm new to programming and recently spent some time navigating these forums and searching google to learn how to manipulate Validations with ClientValidationFunction using JavaScript and OnServerValidate with C#. Now that I have a decent handle on it I wanted to give back a bit. I hope some of you all can use this information. Mess around with it and see what its doing and how.I'm using Visual Studio 2008 as my IDE. I did not include a master page so just copy and paste, set break points, and add a watch to the following:
I have been looking on the internet but don't seem to be able to find the answer. I am wondering is there a way to disable a validator on both the client and server side depending on the value of another control.
The situation is that I have a radiobutton that hides a textbox depending on the radionbuttonlist selected value . So I want to disable a validator on both server and clientside if the value selected is "N".
I have a user control in my Master page and need to be able to Enable/Disable it from ANY page. How is this done? My user control has a few TextBox fields and a button. I was hoping to set a public property and simply Enable/Disable, but public properties seem to only work on the Master page code behind and not other pages.
I want to enable/disable controls of a asp.net page against a logged in user's permission. say 'admin' & 'hr' can change user's birth date text-box in a page but others will see the text-box as disabled.
I'm trying to enable/disable buttons in my gridview according to a value in gridview's field. But everytime when I try to run my page, it shows me below underlined error and point to my gvTimeSheet.DataBind() in page_load.
"Unable to cast object of type 'System.EventArgs' to type 'System.Web.UI.WebControls.GridViewRowEventArgs'." I also tried to enable / disable button in HTML but it just against from what I need it to be.
Example, sheet_status = true, I do not need to enable the button.