<asp:TemplateField HeaderText="是否空闲">
<ItemTemplate>
&nbsp;
<asp:HiddenField ID="hidKongXian" Value='<%#Eval("是否空闲")%>' runat="server" />
<asp:DropDownList ID="ddlKongXian" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlKongXian_SelectedIndexChanged">
<asp:ListItem Text="--选择--" Value="-1"></asp:ListItem>
<asp:ListItem Text="在用" Value="在用"></asp:ListItem>
<asp:ListItem Text="空闲" Value="空闲"></asp:ListItem>
<asp:ListItem Text="不确定" Value="不确定"></asp:ListItem>
</asp:DropDownList>
&nbsp;
</ItemTemplate>
<ItemStyle Width="300px" />
</asp:TemplateField>

 

//是否空闲
protected void ddlKongXian_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlKongXian = sender as DropDownList;
TableCell cell = (TableCell)ddlKongXian.Parent;
GridViewRow item = (GridViewRow)cell.Parent;
string id = item.Cells[1].Text;
string kongXian = ddlKongXian.SelectedValue;
string sqlStr = "update myTable set 是否空闲='" + kongXian + "' where id=" + id;
sqlHelp.inUpDelInfo(sqlStr);
this.BindData();
}

posted on 2023-03-14 16:30  御不凡  阅读(15)  评论(0编辑  收藏  举报