Click here to Skip to main content
15,896,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Design as follows


Code dropdonwlist

In the above dropdownlist code as follows


MFA
TFA
RFA
VAC


suppose when i select the TFA in dropdown that TFA should be displayed in the textbox.


for that how can i do in asp.net using csharp.

Example as follows


Code TFA(dropdownlist) when i select the TFA in dropdown that TFA should be in textbox

Certificate TFA(textbox)



Regards,
Narasiman P.
Posted

Assign the selected value/Text of Dropdownlist to TextBox in Dropdownlist's SelectedIndexChanged Event[^]

And you should start learn C# & ASP.NET. Learn Learn Learn!
Education Needed[^]
 
Share this answer
 
you can use the selected Index Chnaged event of the combo to fill the value

C#
cmb_selectedIndexChanged()
{
 textBox1.Text = cmb.SelectedItem.Text.ToString();
}
 
Share this answer
 
C#
protected void DDLcardSelection_SelectedIndexChanged(object sender, EventArgs e)
    {
txtval.Text=DDLcardSelection.SelectedItem.Text;
}
 
Share this answer
 
Don't go for code behind, this can be possible in Javascript only.

XML
<script type="text/javascript">
function getDropdownListSelectedText()
{
var DropdownList=document.getElementById('<%=aspdropdown.ClientID %>');
var SelectedIndex=DropdownList.selectedIndex;
var SelectedValue=DropdownList.value;
var SelectedText=DropdownList.options[DropdownList.selectedIndex].text;

var TextBox=document.getElementById('<%=TextBox.ClientID %>');
var sValue='Index: '+SelectedIndex+' Selected Value: '+SelectedValue+' Selected Text: '+SelectedText;

TextBox.innerHTML=sValue;
}
</script>
 
Share this answer
 
Comments
Tom Marvolo Riddle 24-Oct-13 6:04am    
@NagarajDj:It is possible in code behind also.Check above answers
NagarajDJ 24-Oct-13 6:20am    
ya i know, but why go to code behind (long process) when their is a possibilty with javascript.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900