This article describes how to click the "a" in the GridView to get the click of the Drop-down box in the line and the value of the text box, the specific implementation of the whine is as follows, interested friends can refer to ha, I hope to help you
ASPX page code: Get the Drop-down box and the value in the text box in the clicked line by clicking a tag in the GridView
Copy Code code as follows:
<asp:gridview id= "GridView1" runat= "Server" >
<Columns>
<asp:boundfield headertext= "id" datafield= "id"/>
<asp:boundfield headertext= "Name" datafield= "ID"/>
<asp:boundfield headertext= "Url" datafield= "ID"/>
<asp:TemplateField>
<ItemTemplate>
<asp:dropdownlist id= "DropDownList1" runat= "Server" >
<asp:listitem value= "0" > Privacy </asp:ListItem>
<asp:listitem value= "1" > Male </asp:ListItem>
<asp:listitem value= "2" > Female </asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:textbox id= "txtdate" runat= "Server" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<a href= "#" onclick= "Save (this);" >Save</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
jquery Code:
Copy Code code as follows:
<script src= "... /scripts/jquery-1.4.1.js "type=" Text/javascript "></script>
<script language=" javascript "type=" Text/javascript >
Function Save (obj) {
var tr = $ (obj). Parent (). parent ();//Get the TR
Tr.find ("TD") that clicks on the line. EQ (3 ). Find ("select"). Val (); Get the fourth column in the line DropDownList1 select value
Tr.find ("TD"). EQ (3). Find ("select"). Text ();//Get the fourth column of the clicked Row DropDownList1 The Select Text
Tr.find ("TD"). EQ (4). Find ("Input"). val ();//Get Click on the fourth column TextBox Text
</script>
in the row