Web Forms :: Enable Disable Validator Using DropDownList Selected Value
May 7, 2015
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 am having a problem with disabling DropDownList based on the chice of 1st DropDownList, there is no post back occuring, and it is a template based web app here is the current code:
what is happening now is page is blank and if I remove the above code everything shows, where I am going wrong. here is the plain and final javascript code which worked:
I have a dropdownlist ,three text boxes and a submit button.The three text boxes are disabled and enabled based on the condition in dropdownlist.I have provided required field validators in three text boxes.When I click on condition "self" then three text boxees are disabled and submit button click wont enter the values since required field validators prevent that.I have set causes validation property to false.But it wont work for the second condition where i need to enable all the textboxes,If i didnt provide any values it will enter nulll values to db.
I'm using a gridview rows, in that I'm adding the rows. I need to disable the textboxes based upon the selected value from the dropdownlist (Yes / No). This should be remain same for the previous rows when ever I'm adding new rows.
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:
that I put RFvare.visible=false and RfcareaC.visible=true
and 1 dropdown list below is my code:
<div id="zirbanaval"> <asp:RequiredFieldValidator ID="Rfvarea" runat="server" ErrorMessage="*لطفا مساحت زمین را وارد نمایید." ControlToValidate="txtarea" CssClass="RfvareaC" Visible="false"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RfvareC" runat="server" ErrorMessage="*لطفا زیر بنا را وارد نمایید" ControlToValidate="txtMesure" CssClass="RfvareabanaC"></asp:RequiredFieldValidator> </div>
I want if users select item="Area" from dropdownlist then Rfvare.visible=true and RfvareaC.visible= false
I have a couple of dropdownlists and a button.when a user selects an item in the 1st dropdownlist,the 2nd dropdown is programmatically bound to a set of items(using an ajax request) depending on the value selected in the 1st dropdown.Then the user will have the ability to choose an item from the 2nd dropdown and click on the button,which performs some server side opeartions and returns the results.
But if the user tries to click on the button before the 2nd dropdown list is populated,user will receive an exception message.Instead of that I would like to prevent the user from clicking the button before the ajax request is completed to populate the 2nd dropdown.I tried using Button1.Enabled=false in the selectedvaluechanged event of 1st dropdown,which does n't seem to work.
I have a Gridview that has a button at the left hand side representing the row number. The Gridview has two textboxes and a dropdown listbox as templates. I would like to enable or disable the textboxes and the dropdown listbox if the row is not selected. I also need to enable or disable the templates depending on what the value is of one of the cells. When the templates are changed, I need to save the changes.
I have been able to get this working in the RowDataBound Sub but not in the RowCommand Sub when the row is selected. provide an example in VB.My current RowDataBoundSub, which does no work is below:
Protected Sub PropGrid_RowCommand(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles PropGrid.RowCommand[code]....
My current RowDataBound Sub, which is working is below:
Protected Sub PropGrid_RowDataBound(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles PropGrid.RowDataBound [code]....
How to enable & disable data value from selected table ?
For Example, select ID from employeeTlb(for Dropdownlist function) then in asp:checkbox able to tick enable & disable that control the data in dropdownlist show/ hide ?
i have one dropdown list and one gridview in my page by default all the textboxes in gridview enabled if i change the dropdown value textboxes in the gridview has to disable how to implement this?
i have a Time column in my sql db, and i have a page where you inser titme, obviously if you put 0900 it throws back an error, and it needs to be 09:00... how do i enable a validator to do this? needs to be 00:00 format.
using c# I am entering two types of string in a text box for eg "so-123456" or "12345678" only this two formats are allowed to enter, when i enter only 12345678 i.e, without "so" next textbox in that page should be enabled, if i enter "SO-123456" textbox should be disabled. without any click event i.e, while entering text in 1st textbox if it contains "so" textbox2 should be disabled, if textbox1 contains only integer(123456) textbox2 should be enabled.
I have a text box, a range validator, and a button. The validator is hooked up and prevents the button from doing a post back if the text is out of the range, however I'd also like to enable and disable the button. Is this possible to do within client-side code?
How do I validate RequiredFieldValidator/CompareValidator conditionally. I have aded equiredFieldValidator/CompareValidator on date textbox. I want that if textbox1="No" thne it should not validate or compare date text box, if textbox1="Yes" then it should validate.
Is this possible on form submit button or any other way?
I have a webpage that inherits a masterpage. Within the webpage I have the content palceholder and then a table within that that contains all the controls of the page. Like below:
[Code]....
I want to be able to change the fields to readonly if a field in the database for the user says they should have readonly access. I can't seem to find the level to go to in order to loop through the controls of the page to set their access to readonly.
I have gotten down to this level and it seems like it is in the base of this.
I have developed toolbar which contains the First,Next,Last and Previous buttons, based on the records display the buttons needs to be changed. Now how to disable and enable the button from .cs file or by using .css file.
I want to know how I came to knoe whether user is logged in or not so that i can make visible log out button on MAster PAge
I am able to log in but my log out button is not visible since after successfully login i am getting log in button visible and How to store value in session ("UI") ?
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Session("UI") Is Nothing Then Logoutbutton.Visible = True LoginButton.Visible = False Displayprofile.Visible = True Displayprofile.Text = "USER profile"
Else Alert.Show("no session") LoginButton.Visible = True Displayprofile.Visible = False End If end Sub
I have a webform with textbox and button,i want to disable the button when nothing is entered into textbox and if something is entered the button must be enabled.How to do it without javascript?
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 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 am using required field validator for controls.In one scenario iam not showing one textbox so when I click on button validation is firing so I can I do this to not fire validation when the textbox is in hide?