<body> <form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1" onselectedindexchanged="GridView1_SelectedIndexChanged"> <Columns> <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True" SortExpression="id" /> <asp:BoundField DataField="name" HeaderText="name" SortExpression="name" /> <asp:BoundField DataField="Lname" HeaderText="Lname" SortExpression="Lname" /> <asp:TemplateField> <ItemTemplate> <asp:HyperLink ID="hp" Text="pass value" NavigateUrl="~/AA.aspx" runat="server"></asp:HyperLink> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:QConnectionString %>" SelectCommand="SELECT [id], [name], [Lname] FROM [registration]"> </asp:SqlDataSource> <br /> <br /> </div> </form> </body>
public partial class Default7 : System.Web.UI.Page { string ss; SqlConnection cn = new SqlConnection(@"Data Source=.\sqlexpress;Initial Catalog=Q;Integrated Security=True"); protected void Page_Load(object sender, EventArgs e) { } protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { foreach(GridViewRow gr in GridView1.Rows) { HyperLink idd = (HyperLink)gr.FindControl("hp"); if (idd) { ss = gr.Cells[2].Text; } Session["dd"] = ss.ToString(); } } }
public partial class AA : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Label1.Text = Convert.ToString(Session["dd"]); } }
string strLink1 = "Page.aspx?id=" +value + "& name=" +value + ""; ((HyperLink)e.Row.Cells[i].Controls[1]).Attributes.Add("onclick", "open_win('" + strLink1 + "')");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)