There's no easy way to do it. You can change the style of the item to make it look like it's disabled, and then with the help of javascript, you can "ignore" that selection (i.e. stop the postback). That's one way, I think, that you can simulate disabling
an item.
function MaxAmountDepositMethodFirst()
{
var theForm = document.forms['<%=Form.ClientID %>'];
if (!theForm)
theForm = document.<%=Form.ClientID %>;
var depositFirst = theForm.<%=txtDepositFirst.ClientID %>;
var maxDepositAmount= "5000000";
//var depositMethodFirst = document.all.ddlDepositMethodFirst;
var engangSelect= "Engangsfullmakt";
if( depositFirst > maxDepositAmount)
{
var items = document.getElementById("<%=ddlDepositMethodFirst.ClientID %>").options;
for (var i = 0; i < items.length; i++)
{
if (items[i]== engangSelect)
{
items[i].disabled = (items[i].text.toLowerCase() == value.toLowerCase());
}
im stuck with a really crazy problem. Disabling a value in dropdownlist with help of javascript works in IE8 but not in IE 7 and IE 6. does anyone knows anything about that.
im stuck with a really crazy problem. Disabling a value in dropdownlist with help of javascript works in IE8 but not in IE 7 and IE 6. does anyone knows anything about that.
None
0 Points
7 Posts
Disabling a value in dropdownlist- Javascript
Jan 08, 2010 06:55 AM|CKK77|LINK
Hi
I am trying to disable a value in my dropdownlist depending on what is written in my textbox. Does anyone have an idea
thanks
ck
All-Star
32861 Points
7877 Posts
Re: Disabling a value in dropdownlist- Javascript
Jan 08, 2010 07:24 AM|qwe123kids|LINK
Hi,
http://www.java2s.com/Code/JavaScript/Form-Control/Disableandenableadropdownlistcombobox.htm
the above link Shows simple code snippet how to disable combox using javascript
u use with textvalue condition
Avinash Tiwari
Remember to click “Mark as Answer” on the post, if it helps you.
All-Star
101931 Points
20703 Posts
Re: Disabling a value in dropdownlist- Javascript
Jan 08, 2010 07:32 AM|MetalAsp.Net|LINK
There's no easy way to do it. You can change the style of the item to make it look like it's disabled, and then with the help of javascript, you can "ignore" that selection (i.e. stop the postback). That's one way, I think, that you can simulate disabling an item.
None
0 Points
7 Posts
Re: Disabling a value in dropdownlist- Javascript
Jan 08, 2010 07:38 AM|CKK77|LINK
Thanks for you answer i already checked that link which didn't help a lot.
I already wrote little kod but that is not getting me so far.
// CK
All-Star
54508 Points
14111 Posts
Re: Disabling a value in dropdownlist- Javascript
Jan 08, 2010 07:39 AM|mudassarkhan|LINK
This way
Blog: ASPSnippets | Forum: ASPForums | Company: Excelasoft
None
0 Points
7 Posts
Re: Disabling a value in dropdownlist- Javascript
Jan 08, 2010 08:07 AM|CKK77|LINK
Hi thanks for the hint but i think i'm missing something
All-Star
54508 Points
14111 Posts
Re: Disabling a value in dropdownlist- Javascript
Jan 08, 2010 08:37 AM|mudassarkhan|LINK
Replace above with
Onkeyup = "MaxAmountDepositMethodFirst()"
and use the following function
function MaxAmountDepositMethodFirst()
{
var theForm = document.forms['<%=Form.ClientID %>'];
if (!theForm)
theForm = document.<%=Form.ClientID %>;
var depositFirst = theForm.<%=txtDepositFirst.ClientID %>;
var maxDepositAmount= "5000000";
//var depositMethodFirst = document.all.ddlDepositMethodFirst;
var engangSelect= "Engangsfullmakt";
if( depositFirst > maxDepositAmount)
{
var items = document.getElementById("<%=ddlDepositMethodFirst.ClientID %>").options;
for (var i = 0; i < items.length; i++)
{
if (items[i]== engangSelect)
{
items[i].disabled = (items[i].text.toLowerCase() == value.toLowerCase());
}
}
}
}
Blog: ASPSnippets | Forum: ASPForums | Company: Excelasoft
None
0 Points
7 Posts
Re: Disabling a value in dropdownlist- Javascript
Jan 08, 2010 08:55 AM|CKK77|LINK
thank you all for your help . I found what was wrong
// Ck
None
0 Points
7 Posts
Re: Disabling a value in dropdownlist- Javascript
Feb 09, 2010 09:55 AM|CKK77|LINK
Hey guys
im stuck with a really crazy problem. Disabling a value in dropdownlist with help of javascript works in IE8 but not in IE 7 and IE 6. does anyone knows anything about that.
thanks
CK
All-Star
40630 Points
15348 Posts
Re: Disabling a value in dropdownlist- Javascript
Feb 09, 2010 10:08 AM|NC01|LINK
Start your own post with the relevent code.
NC...