<asp:TemplateField>
<ItemTemplate>
<asp:DropDownList ID="ddlItem" runat="server">
<asp:ListItem Value="1">項目1</asp:ListItem>
<asp:ListItem Value="2">項目2</asp:ListItem>
<asp:ListItem Value="3">項目3</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="txbName" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
$(document).ready(function () {
$('select[id*=ddl]').change(function () {
var selectedValue = $(this).find('option:selected').val();
var row = $(this).closest("tr");
var txbName= row.find("[id*=txbName]");
txbName.val(selectedValue );
});
});
留言列表