access dropdown selected item inside of gridview

Jodh

New Member
i have a \[code\]Gridview\[/code\] having a dropdownlit and button. now I want to get selected value of that \[code\]dropdown\[/code\] list on \[code\]button click\[/code\].here is my sample code\[code\]<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>\[/code\]and here is the button\[code\]<asp:TemplateField> <ItemTemplate> <asp:Button ID="tst" runat="server" Text="text" CommandName="Test" CommandArgument='<%# Eval("EntryID") %>'/> </ItemTemplate> </asp:TemplateField>\[/code\]and this is \[code\]RowCommand\[/code\] function\[code\]if (e.CommandName == "Test") { String row = e.CommandArgument.ToString(); lblError.Visible = true; lblError.Text = row;}\[/code\]
 
Back
Top