This is the markup I have
这是我的标记
<td>
<asp:ComboBox ID="cbArtikal" runat="server" AppendDataBoundItems="True"
AutoCompleteMode="Suggest" DataSourceID="ssArtikal"
DataTextField="Artikal" DataValueField="Artikal" MaxLength="0"
style="display: inline;">
</asp:ComboBox>
<asp:SqlDataSource ID="ssArtikal" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [Artikal] FROM [Stavke_Dokumenta]">
</asp:SqlDataSource>
</td>
<td>
<asp:ComboBox ID="cbJM" runat="server" AppendDataBoundItems="True"
AutoCompleteMode="Suggest" DataSourceID="ssJM" DataTextField="JM"
DataValueField="JM" MaxLength="0" style="display: inline;">
</asp:ComboBox>
<asp:SqlDataSource ID="ssJM" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [JM] FROM [Stavke_Dokumenta]"></asp:SqlDataSource>
</td>
What I would like is to do is autofill the second field when first one is selected, but to still have the option to change the value with dropbox.
我想要做的是在选择第一个字段时自动填充第二个字段,但仍然可以选择使用dropbox更改值。
1 个解决方案
#1
0
You can create an OnChange
event on the first combobox, with something like:
您可以在第一个组合框上创建一个OnChange事件,例如:
cbJM.SelectedItem = cbArtikal.Items.SelectedItem;
Or take this approach:
或采取这种方法:
cbJM.SelectedItem = cbArtikal.Items.FindByValue("The Selected Value")
#1
0
You can create an OnChange
event on the first combobox, with something like:
您可以在第一个组合框上创建一个OnChange事件,例如:
cbJM.SelectedItem = cbArtikal.Items.SelectedItem;
Or take this approach:
或采取这种方法:
cbJM.SelectedItem = cbArtikal.Items.FindByValue("The Selected Value")