用TemplateField自定义的DropDownList在后台如何取值
我在GridView中声明了一个TemplateField,在后台cs想取它的DropDownList值如何写这块,请帮帮我这个新人,谢谢!!!!<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="ST_User_id" AllowPaging="True" AllowSorting="True" Width="424px" OnRowEditing="Gridview1_RowEditing" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowUpdating="GridView1_RowUpdating" OnRowDeleting="GridView1_RowDeleting">
<Columns>
<asp:BoundField DataField="ST_User_id" HeaderText="用户编号" ReadOnly="True" SortExpression="ST_User_id" />
<asp:BoundField DataField="ST_Teacher_name" HeaderText="姓名" SortExpression="ST_Teacher_name" />
<asp:TemplateField HeaderText="用户类型" SortExpression="ST_User_power">
<EditItemTemplate>
<asp:DropDownList ID="st_ddl_users" SelectedIndex='<%#DataBinder.Eval(Container.DataItem,"ST_User_power").ToString().Equals("0")?0:1 %>' runat="server">
<asp:ListItem>普通学生</asp:ListItem>
<asp:ListItem>管理员</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"ST_User_power").ToString().Equals("0")?"普通学生":"管理员" %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" />
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
OnClientClick='return confirm("确认删除吗?");' Text="删除" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
cs中
st_comm.Parameters.Add(new SqlParameter("@user_power", SqlDbType.Int, 4));
st_comm.Parameters["@user_power"].Value = ?????
--------------------编程问答-------------------- 顶 --------------------编程问答-------------------- 你在哪个事件里执行
st_comm.Parameters.Add(new SqlParameter( "@user_power ", SqlDbType.Int, 4));
st_comm.Parameters[ "@user_power "].Value = ?????
这句语句?
补充:.NET技术 , ASP.NET