我有Gridview
一个下拉灯和按钮。现在我想获取该dropdown
列表的选定值。这button click
是我的示例代码
<asp:TemplateField>
<ItemTemplate>
<asp:DropDownList ID="ddPStatud" runat="server" DataSourceID="sdsProductStatus" DataTextField="StatusName"
DataValueField="StatusId">
</asp:DropDownList>
<asp:SqlDataSource ID="sdsProductStatus" runat="server" ConnectionString="<%$ ConnectionStrings:cs %>"
SelectCommand="SelectProductStatus" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:SessionParameter Name="Branchid" SessionField="Branchid" Type="Int16" />
</SelectParameters>
</asp:SqlDataSource>
</ItemTemplate>
</asp:TemplateField>
这是按钮
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="tst" runat="server" Text="text" CommandName="Test" CommandArgument='<%# Eval("EntryID") %>'/>
</ItemTemplate>
</asp:TemplateField>
这是RowCommand
功能
if (e.CommandName == "Test")
{
String row = e.CommandArgument.ToString();
lblError.Visible = true;
lblError.Text = row;}