For this type of requirements you have to use RowCommand event of the gridview. Please refer below code example.
01.<%@ Page Language="C#" %>
02.
03.<%@ Import Namespace="System" %>
04.<%@ Import Namespace="System.Data" %>
05.<%@ Import Namespace="System.Data.SqlClient" %>
06.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
07.<script runat="server">
08. protected void Page_Load(object sender, EventArgs e)
09. {
10. if (!IsPostBack)
11. LoadProducts();
12. }
13.
14.
15. private void LoadProducts()
16. {
17. using (SqlConnection connection = new SqlConnection("ConnectionString"))
18. {
19. using (SqlCommand command = new SqlCommand("Select * from Products", connection))
20. {
21. using (SqlDataAdapter da = new SqlDataAdapter(command)) {
22. DataTable dt = new DataTable();
23. da.Fill(dt);
24. GridView1.DataSource = dt;
25. GridView1.DataBind();
26. }
27. }
28. }
29. }
30.
31. protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
32. {
33. if (e.CommandName == "goto")
34. {
35. string queryString = "hn=" + e.CommandArgument.ToString() + "&R=" + ddl.SelectedItem.Text;
36. Response.Redirect("DetailedView.aspx?" + queryString);
37. }
38. }
39.</script>
40.<html xmlns="http://www.w3.org/1999/xhtml">
41.<head runat="server">
42. <title></title>
43.</head>
44.<body>
45. <form id="form1" runat="server">
46. <div>
47. <asp:ScriptManager ID="sm" runat="server">
48. </asp:ScriptManager>
49. <asp:DropDownList ID="ddl" runat="server">
50. <asp:ListItem Text="Item1"></asp:ListItem>
51. <asp:ListItem Text="Item2"></asp:ListItem>
52. <asp:ListItem Text="Item3"></asp:ListItem>
53. <asp:ListItem Text="Item4"></asp:ListItem>
54. <asp:ListItem Text="Item5"></asp:ListItem>
55. </asp:DropDownList>
56. <asp:GridView ID="GridView1" runat="server" onrowcommand="GridView1_RowCommand">
57. <Columns>
58. <asp:TemplateField>
59. <ItemTemplate>
60. <asp:LinkButton ID="btnDelete" runat="server" Text='<%#Eval("ProductName") %>' CommandName="goto" CommandArgument='<%#Eval("ProductName") %>' />
61. </ItemTemplate>
62. </asp:TemplateField>
63. </Columns>
64. </asp:GridView>
65. <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
66. SelectCommand="SELECT [ProductID], [ProductName], [QuantityPerUnit], [UnitPrice], [UnitsInStock] FROM [Alphabetical list of products]">
67. </asp:SqlDataSource>
68. </div>
69. </form>
70.</body>
71.</html>