943,587 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 21626
  • ASP RSS
Jul 27th, 2005
0

dropdownlist value doesnt get selected

Expand Post »
ive a dynamic dropdownlist, which items are retrieved frm db. but when i select an item from the dropdownlist, the item does not stay selected instead the dropdownlist make a postback and stay as default value.

wad shd i do? is there any mtd to get d value selected?

THANK YOU VERY MUCH!

related codes below--

function chktype(){
document.gt.action = 'add_user.asp?userID='+document.gt.userID.value;
document.gt.submit();
}

<select name="type" onChange="chktype();" mandatory='true' class="text">
<%sql = "select distinct * from t_user_type order by userType"
set rs = conn.execute(sql)
do while not rs.eof%>
<option value="<%=rs("userType")%>" <%if request.Form("type") =rs("userType") then response.Write(" selected")%>><%=rs("userType")%></option>
<%rs.moveNext
loop%>
</select>
Attached Files
File Type: txt code.txt (526 Bytes, 123 views)
Reputation Points: 10
Solved Threads: 0
Light Poster
ohgosh is offline Offline
41 posts
since Jul 2005
Jul 27th, 2005
0

Re: dropdownlist value doesnt get selected

i had the same problem.

to my knowledge (im not at my development pc right now) the if statement doesnt like retrieving records from a db and comparing it to a form value.

try making vars of the two that you want to compare, then if it.

not sure if it would work
Reputation Points: 10
Solved Threads: 2
Junior Poster
william_stam is offline Offline
131 posts
since Mar 2005
Jul 27th, 2005
0

Re: dropdownlist value doesnt get selected

wad do u mean? i dun quite understand.. do u mind sharing n tellin me more?

it wud b great to even provide some eg. hEE~

real thanks... :cheesy:
Reputation Points: 10
Solved Threads: 0
Light Poster
ohgosh is offline Offline
41 posts
since Jul 2005
Aug 12th, 2005
0

Re: dropdownlist value doesnt get selected

go asp.net, automatic saving values in forms
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kevinNL is offline Offline
1 posts
since Aug 2005
Aug 30th, 2005
0

Re: dropdownlist value doesnt get selected

Quote originally posted by kevinNL ...
go asp.net, automatic saving values in forms
huh?!? im using asp not asp.net.. i dun quite understand wad are u tryin 2 link me to.. haha~ would u prefer to explain more.. cheers~
Reputation Points: 10
Solved Threads: 0
Light Poster
ohgosh is offline Offline
41 posts
since Jul 2005
Jun 28th, 2009
0

Re: dropdownlist value doesnt get selected

Hello mate,

Having a similar problem myself. The equivelant code works in PHP but ASP doesn't want to know. Did you figure it out in the end?

Cheers
Reputation Points: 10
Solved Threads: 0
Newbie Poster
crymynylmynd is offline Offline
6 posts
since Jun 2009
Jul 1st, 2009
0

Re: dropdownlist value doesnt get selected

hey buddy
do this and it will work
and if it wont let me know
ok


here it goes
ASP Syntax (Toggle Plain Text)
  1. listName.options[listName.selectedIndex].value

and then set the action
it will be set

ok
try it and let me know
Reputation Points: 10
Solved Threads: 5
Newbie Poster
chsab420 is offline Offline
23 posts
since Jun 2009
10 Days Ago
0

Dropdown list not get selected item

Same problem here mentioned above...
...
I set AutoPostback property of dropdownlist as true...
It takes always first value in the dropdownlist
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Sandy Patil is offline Offline
1 posts
since Feb 2012
Message:
Previous Thread in ASP Forum Timeline: Please help with regular expression in ASP
Next Thread in ASP Forum Timeline: No overload for method 'GetRandomPassword' takes '0' arguments





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC