Browser Compatible Code To Disable A Dropdownlist When Another Dropdownlist Is Clicked Or A Checkbox Is Checked?

May 26, 2011

I have a window having 2 dropdowmlists(schemename-SN and propertyno-PN) , one chkbox ,one "VIEW" button.SN has options "all" with value=0 and many other options with respctive values.Now,i want the code should behaves as follows:

1.0n window onload, SN must b visible bt PN nt.

2.if i select SN other thn All...the PN shud b visible and if i select "All" ,PN hides.

3.when check box is checked- PN hides,and if it is unchecked- PN visible..

Important:-This whole ddl n chk box are in updatable panel,button is nt in that.I want a browser compatible code so javascript can't b used directly(cz they give problem in mozzila and chrome).Right now, i have done this JavaScript and its is working fine.

function window.onload()
{
DisableProperty();
}

[code]....

but this code is not browser compatible.here onload,onkeyup and onclick functions are used , but they dont work in other browsers except internet explorer.

View 1 Replies


ADVERTISEMENT

Disable Multiple Items From DropDownList. Someone Need To Check Code?

May 15, 2011

I would like to disable a specific items from DropDownList. I have below code but it does not working. So, need someone to told me what I'm doing wrong. DropDownList have 5 items.And, I'm getting error:Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index

Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged Dim X As Integer = 0 <> 1 DropDownList1.Items(X).Enabled = False End Sub

But, if I add a different value for X, then it disable 1st and 2nd item. Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged Dim X As Integer = 0 or 1 DropDownList1.Items(X).Enabled = False End Sub My goal is if I would have a 365 items in DropwDownList to disable items for example between 120 and 150.

View 2 Replies

Disable Multiple Items From DropDownList?

Jun 6, 2011

I would like to disable a specific items from DropDownList. I have below code but it does not working. DropDownList have 5 items.And,I'm getting error:Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index

Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
Dim X As Integer = 0 <> 1
DropDownList1.Items(X).Enabled = False
End Sub

But, if I add a different value for X, then it disable 1st and 2nd item.

Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
Dim X As Integer = 0 or 1
DropDownList1.Items(X).Enabled = False
End Sub

My goal is if I would have a 365 items in DropwDownList to disable items for example between 120 and 150.

View 1 Replies

Saving State Of Checkbox And Dropdownlist In Gridview?

Nov 30, 2010

Firstly i'm not asking for the exact code here but the below is what i'm trying to do:I have a gridview with DropDownList and CheckBox and I have a button outside the gridview that will add a new row within the gridview.I have no problems with the adding row but I have a problem with saving the state of the checkbox/drop down list.Everytime I checked the checkbox and add a new row, all the DDL/CB will be reset.So how can I do it so that when I add a new row, the checkbox that I've checked before will still remain check.

View 3 Replies

Asp.net - Populate DropdownList Based Upon Other DropDownList VB?

Jun 1, 2009

I have found a couple of examples on the internet to do this but really struggling to get it working in VB. (Tried a converter but had mixed results) I need the selection options of a Dropdownlist to be populated based upon the differing values in the first dropdown list.

Can anyone help with a releativley simple example in VB? Not fussed if the values are "hard coded" in the script. Or a SQL bit that pulls the data from a table

View 3 Replies

Wpf - Replace Dynamically A Label By A Dropdownlist And A Checkbox In A Cell In A Grid

Mar 7, 2012

I replace dynamically a label by a dropdownlist and a checkbox in a cell in a grid like this

[Code]...

View 1 Replies

VS 2005 Checkbox In My Application - Fetch The Data From The Database And Add It To The Dropdownlist Of The Combobox

Aug 31, 2009

I have a checkbox in my application,when the checkbox is checked then i want to fetch the data from the database and add it to the dropdownlist of the combobox.Again when the checkbox is unchecked then i want to ramove all the data from the dropdownlist of the combobox.

I did this

Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
con = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=Etech.mdb")

[CODE]...

When the checkbox is checked then the data is added from the database to the dropdownlist of the combobox but when i uncheck it then the data is not removed from the dropdownlist of the combobox. In the above code i think i need to add an else condition to remove the data from the dropdownlist of the combobox and make it empty when the checkbox is unchecked.......but i cant give the proper else condition in the above code.

View 7 Replies

DataGridView Checkbox Not Getting Checked When Clicked?

Aug 12, 2010

This is my first time using the checkbox in a datagridview. I added the column at design time and it is false for readonly and frozen. But when I click on it at runtime nothing is happening. Do I have to check it through the event?

View 2 Replies

Install Button Must Also Disable A Checkbox When It Itself Is Checked

Aug 31, 2011

creating an install button. The button must be able to find a file from a folder and be able to place it in another folder. But the install button must also disable a checkbox when it itself is checked.

View 9 Replies

Populate Dropdownlist From Another Dropdownlist?

Jan 15, 2012

I'm trying to write a program that selects an item (Area Code) from a combobox and this list gets the city that was associated with this area code (another comnbobox list)

View 1 Replies

Filtering With Two DropDownList - ASP.NET | Dream.In.Code?

Jul 14, 2010

Im very new and have found a solution which filter with on e grid but how do I manaipulate the Vb code to accomodate anothe industry filter.here's my ASP current code

<asp:GridView ID="GridView2" runat="server"
AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource2"
ForeColor="#333333" GridLines="None" DataKeyNames="Permit_No"

[code].....

View 1 Replies

Browser Compatible Code Which Take Values From Hidden Field And Pass It Through Query String On To Other Page

Jun 3, 2011

Right now I am using this code on client side.

[Code]...

The values for the hidden fields are already set. I want these value to open a window, in which the fields will be already filled using the values passed by this page. This code is working fine on Internet Explorer, but not on other browsers. Moreover, when I don't pass any value and just open the required window, it works on all browsers.

View 1 Replies

Get The Dropdownlist Status Without Puting The Code In "Not IsPostBack"?

Jul 15, 2011

I have 2 dropdownlists "countries" and "cities", with 2 datasources: If a user chooses the first index in the ddl countries, he can see all the cities in the world in the ddl cities (uses datasource1).If a user chooses a country, he can see the cities correspond to this country chosen (uses datasource2).I put the code for changing datasource in the code behind using vb.net, in Page_Load, but after the user chose a city, and click the submit button, the dropdownlist cities can't keep the status, it goes to the first index of this ddl.

I tried to put this code in the If Not IdPostBack, but like this, it doesn't change datasource while it can keep status of the dropdownlist.I put the code here as reference:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ddlCities As DropDownList
Dim ddlCountries As DropDownList

[code]....

View 1 Replies

Code A Button So That When Clicked It Will Toggle The Sound On/off On A Web Browser?

Oct 24, 2009

I'm using visual basics 2008, and I want to code a button, so that when clicked it will toggle the sound on/off on a web browser, while the volume of the system stays unaffected. I browsed the web and I found this code:

Public Class Form1
Private Const APPCOMMAND_VOLUME_MUTE As Integer = &H80000
Private Const WM_APPCOMMAND As Integer = &H319

[code]....

but this DOES mute the whole system which isn't what I want.

View 3 Replies

Javascript - Insert Checkbox Checked Value When Checked To Textbox As Comma Separated String

Nov 9, 2010

Insert checkbox checked value when checked to textbox as comma seperated string in vb.net or javascript

suppose i have 3 checkboxes and and 1 textboxes in my webpage.aspx

when i checked checkbox1 and checkbox2 then in textbox it will appear as 1,2 only on checkboxes checked event ...

and i want its revert also :

if i set textbox de

View 1 Replies

Create A Checkbox In Form2 That Says If Checkbox 1 Is Checked Then Show Picture 1 In Form 1?

Apr 15, 2011

I have a question, I can't really find the answer...Basically I have 2 FormsIn form number 1 I have 2 pictureboxes. I want to create a checkbox in form2 that says if checkbox 1 is checked then show picture 1 in form 1

View 1 Replies

.net - Getting Selected Value From An ASP.NET DropDownList?

Oct 2, 2009

I can't get the selected value of a programmatically generated list of items:

Protected Sub ddlMMMYY2_PreRender(ByVal sender As Object, ByVal e
As System.EventArgs) Handles ddlMMMYY2.PreRender
If Not Page.IsPostBack Then

[Code].....

If I try to get a value from a static DropDownList, <asp:listitem> works.

View 2 Replies

.net Dropdownlist Datasource?

May 17, 2011

have 3 dropdown list one has pre set values and my post back works the other 2 has the data from the db when i try using post back on them i don't get anything in my grid view.

<asp:DropDownList ID="ddlname" runat="server" DataSourceID="SqlDataSource1" DataTextField="Venue_Name" DataValueField="Venue_Name" AppendDataBoundItems="True" AutoPostBack="True"> <asp:ListItem Text="All" Value="All" Selected="True"></asp:ListItem> </asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"

[Code]...

View 2 Replies

.net Dropdownlist If Condition?

Oct 18, 2010

I had posted this question before but didn't get the right answer -here's my code again with the if condition.

Dim provider As CultureInfo = CultureInfo.InvariantCulture
Dim a1 As DateTime = Nothing
If date1.selectedvalue isnot nothing Then

[code]....

View 4 Replies

Add A Default Value To Dropdownlist

May 10, 2009

Actually I would like to add a default value to my dropdownlist before I bind the data from the SQL statement.Below is my codes,how should I change so that my dropdownlist default value will be "All" then only follow by the data retrieved from SQL? [code]

View 5 Replies

Add A Default Value To Dropdownlist?

May 10, 2009

Actually I would like to add a default value to my dropdownlist before I bind the data from the SQL statement.Below is my codes,how should I change so that my dropdownlist default value will be "All" then only follow by the data retrieved from SQL?

[Code]......

View 2 Replies

Add Empty Value To A DropDownList In ASP.net MVC

Jun 2, 2009

I'm building a data entry interface and have successfully bound the columns that have reference tables for their data using DropDownList so the user selects from the pre-configured values.

My problem now is that I don't want the first value to be selected by default, I need to force the user to select a value from the list to avoid errors where they didn't pick that field and by default a value was assigned.

Is there a more elegant way of doing this than to add code to include an empty value at the top of the list after I get it from the database and before i pass it to the SelectList constructor in my controller class?

View 2 Replies

Add Items In A Dropdownlist?

Mar 14, 2010

how to add an item to a dropdownlist.i have tried this

DropDownList1.Items.Insert(0,
"Abu Dhabi")
DropDownList1.Items.Add(
"Dubai")

but nothing is showing in the dropdownlist

View 6 Replies

Add Items In The Dropdownlist?

Nov 23, 2009

Using VB.NET I want to add a data's in the Datagridviewcombobox column

Code.

cmd = New SqlCommand("SELECT Sched_Name from tb_Sched_Master", con)
ada = New SqlDataAdapter(cmd)
ada.Fill(ds1)

[code]....

But I cannot get the data's, what wrong in my code.

View 1 Replies

Assigning A Value To A DropDownList?

May 19, 2012

I have a VB.Net Windows app that has a form with a ComboBox. It's dropdown style is set to "DropDownList". When I retrieve a record from the DB, I'm trying to assign a value to the "Text" Property of the ComboBox but it's not taking it. I've tried using the "SelectedText", "SelectedItem" properties and they're not working either.

View 7 Replies

DropdownList - How To Set Value Of ComboBox

May 28, 2010

I am using the following method to set a value to ComboBox1 whose dropdown type is set to dropdownlist:
ComboBox1.Items.Clear()
ComboBox1.Items.Insert(0, "ABC")
ComboBox1.SelectedIndex = 0
Is there any other and better way to do it?

View 3 Replies

DropDownList Databinding?

Jun 2, 2009

I want to databind my catagory table to a dropdown list but thecategories aren't going to be in order like:

categoryID Name---------------------1-----------apple2-----------wiper blades3-----------band aids4-----------pear5-----------raisons6-----------tiresHow would I be able to make the list look like:

[code].....

View 3 Replies

Dropdownlist Look Like Treeview?

Mar 10, 2009

Is the anyway to make a dropdownbox look like this

402-2198 474A 475E 474M402-2602 476T 475B 473Q

View 2 Replies

Get Index Of DropDownList Asp.net?

May 28, 2010

I want to get the value of the specifed index in a DropDownList

View 1 Replies

How To Getvalue From Dropdownlist

Sep 4, 2009

I am using vb.net language I have a dropdownlist, which is filled by below pattern

"Smith,James" so first one is surname and second after "," is firstname

I have two textboxes for surname and firstname. Now I want to fill the textbox when dropdownlist is changed.I mean when user changes the dropdownlist the selected text in dropdown will be filled in related textboxes.so my result will be like this

surname.text = "Smith"
firstname.text = "James"

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved