how to retrieve values in a textbox according to the selected value in the dropdownlist in Web application
-
hello......... I am new in asp.net.I have given dropdownlist and bind data to this one.If I am selecting the value in dropdownlist according their values display into textbox how to do this? I have written the code is private void LoadDropdown() { tblItemDetails1TableAdapter l_tblItemDetails1TableAdapter = new tblItemDetails1TableAdapter(); DataTable l_tblItemTable = l_tblItemDetails1TableAdapter.GetData(); dropItemName.DataTextField = "ItemName"; dropItemName.DataValueField = "ItemId"; dropItemName.DataSource = l_tblItemTable; } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LoadCombo(); } } Pls help me.......... Thanks.
-
hello......... I am new in asp.net.I have given dropdownlist and bind data to this one.If I am selecting the value in dropdownlist according their values display into textbox how to do this? I have written the code is private void LoadDropdown() { tblItemDetails1TableAdapter l_tblItemDetails1TableAdapter = new tblItemDetails1TableAdapter(); DataTable l_tblItemTable = l_tblItemDetails1TableAdapter.GetData(); dropItemName.DataTextField = "ItemName"; dropItemName.DataValueField = "ItemId"; dropItemName.DataSource = l_tblItemTable; } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LoadCombo(); } } Pls help me.......... Thanks.
From javascript or code-behind? If you are looking for code behind, then use SelectedIndex_Changed event of dropdown and use,
ddl.SelectedItem.Text
Arun Jacob http://codepronet.blogspot.com/
-
hello......... I am new in asp.net.I have given dropdownlist and bind data to this one.If I am selecting the value in dropdownlist according their values display into textbox how to do this? I have written the code is private void LoadDropdown() { tblItemDetails1TableAdapter l_tblItemDetails1TableAdapter = new tblItemDetails1TableAdapter(); DataTable l_tblItemTable = l_tblItemDetails1TableAdapter.GetData(); dropItemName.DataTextField = "ItemName"; dropItemName.DataValueField = "ItemId"; dropItemName.DataSource = l_tblItemTable; } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LoadCombo(); } } Pls help me.......... Thanks.
-
thanks for reply..
-
Also make sure that your dropItemName AutoPostBack property is set to true
-
hello......... I am new in asp.net.I have given dropdownlist and bind data to this one.If I am selecting the value in dropdownlist according their values display into textbox how to do this? I have written the code is private void LoadDropdown() { tblItemDetails1TableAdapter l_tblItemDetails1TableAdapter = new tblItemDetails1TableAdapter(); DataTable l_tblItemTable = l_tblItemDetails1TableAdapter.GetData(); dropItemName.DataTextField = "ItemName"; dropItemName.DataValueField = "ItemId"; dropItemName.DataSource = l_tblItemTable; } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LoadCombo(); } } Pls help me.......... Thanks.
For server side, as suggested use SelectedIndexChanged event.. For client side, add the onchange attribute to the dropdown where in the javascript use this onchange to set the textbox value (assign the value that is selected in dropdown)
-
hello......... I am new in asp.net.I have given dropdownlist and bind data to this one.If I am selecting the value in dropdownlist according their values display into textbox how to do this? I have written the code is private void LoadDropdown() { tblItemDetails1TableAdapter l_tblItemDetails1TableAdapter = new tblItemDetails1TableAdapter(); DataTable l_tblItemTable = l_tblItemDetails1TableAdapter.GetData(); dropItemName.DataTextField = "ItemName"; dropItemName.DataValueField = "ItemId"; dropItemName.DataSource = l_tblItemTable; } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LoadCombo(); } } Pls help me.......... Thanks.