I want to bind two text boxes with the change of a combo box in web application.
Is it possible ?
I can bind on etext box by DataTextfield and DataValueField.
But I am suffering when I want to bind two text box.
Plz help me.
---Rajib
Printable View
I want to bind two text boxes with the change of a combo box in web application.
Is it possible ?
I can bind on etext box by DataTextfield and DataValueField.
But I am suffering when I want to bind two text box.
Plz help me.
---Rajib
Correct if I'm wrong but you have a dropdownlist of value-text pairs that OnChange you want one TextBox to hold the value and the other to hold the text. If I've got the wrong end of the stick let me know!
HTML (you might be databinding the list but I'm using hardcoded listitem for this example):
Code behind:Code:<asp:DropDownList id="ddlStart" runat="server" AutoPostBack="true" OnSelectedIndexChange="ddlStart_SelectedIndexChange">
<asp:ListItem Value="1" Text="First" />
<asp:ListItem Value="2" Text="second" />
<asp:ListItem Value="3" Text="Third" />
<asp:ListItem Value="4" Text="Fourth" />
<asp:ListItem Value="5" Text="Fifth" />
</asp:DropDownList>
<asp:TextBox id="txtValue" runat="server" />
<asp:TextBox id="txtText" runat="server" />
HTHCode:void ddlStart_SelectedIndexChange(object sender, EventArgs e) {
txtValue.Text = ddlStart.SelectedValue;
txtText.Text = ddlStart.Items[ddlStart.SelectedIndex];
}
DJ