Forums » .NET » .NET »

javascript to set selected value of dropdown list box

Posted Date: 05 Apr 2006      Posted By:: narayanasamy durai     Member Level: Bronze    Member Rank: 0     Points: 2   Responses: 3

i have a dropdown list box it contain " A,B,C,D,E". And i have a textbox .

if i give " B " in text box ,the listbox value of " B " should become a selected value

pls if any body knew tel me

by durai


#46592    Author: ------      Member Level: Silver      Member Rank: 0     Date: 05/Apr/2006   Rating: 2 out of 52 out of 5     Points: 2

Type Only Capital letters in a text box

Its Only forHTML Controls

<form id="frm">
<input type="text" id="txt" name="txt" onkeyup="frmchng(this.value)">
<select id="slt"><option value=A>A</option>
<option value=B>B</option>
<option value=C>C</option>
<option value=D>D</option>
<option value=E>E</option>


<script language="javascript">
function frmchng(val)






#46596    Author: Ramakrishna      Member Level: Gold      Member Rank: 574     Date: 05/Apr/2006   Rating: 2 out of 52 out of 5     Points: 2

<script language="javascript">
function fnSetDDL()
for(var i=0;i<=document.getElementById("DropDownList1").length-1;i=i+1)
var ddlText=document.getElementById("DropDownList1").options[i].outerText;


private void Page_Load(object sender, System.EventArgs e)
// bindDropDown();

#46597    Author: kedara      Member Level: Silver      Member Rank: 0     Date: 05/Apr/2006   Rating: 2 out of 52 out of 5     Points: 2

1.copy and paste the following in html page head section

<script language="javascript">

function setFocus()

var a=document.getElementById('TextBox1').value;
for (i=0;i<document.getElementById('DropDownList1').length;i++)

if (a == document.getElementById('DropDownList1').options(i).text)
document.getElementById('DropDownList1').options(i).selected = true;

2. in page_load()
TextBox1.Attributes("onblur") = "setFocus();"
3. execute

Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.

Next : what is difference between String and string(data type) in c#?
Previous : what is a resource file...
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages

Subscribe to Subscribers
Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John

Online Members

Priya jain
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India