How to bind details using hyperlink in gridview?
hi i am developing student management system..here i have attached the image...when i clicking view details of murali (or) others.the whole details of murali should be bind on new form... can any one help me out how to code....it's urgent .....


Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 24, 2013, 2:44 AM EDT
in grid:
OnRowCommand="GridView1_RowCommand">
runat="server">
in .cs add this event:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "passdata")
{
Response.Redirect("~/studprof.aspx?T_ID=" + e.CommandArgument.ToString());
}
}
now you can able to get the id in new form. just get that id and pass that id to database to get the info of particular id.
to get the id in next page:
string id = Request.QueryString["T_ID"];
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 24, 2013, 2:18 AM EDT
selva kumarRank #2,987 · 483 reputationPosted Jul 24, 2013, 2:31 AM EDT
selva kumarRank #2,987 · 483 reputationPosted Jul 24, 2013, 3:14 AM EDT
Conversion failed when converting the varchar value '<%Eval("T_ID")%>' to data type int.
my code is...
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class studprof : System.Web.UI.Page
{
SqlConnection Con;
SqlDataAdapter Sda=new SqlDataAdapter ();
DataTable dt = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
Con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=studentmgmt;Integrated Security=True");
bind();
}
public void bind()
{
string id=Request.QueryString["T_ID"];
Sda = new SqlDataAdapter("Select [Name],Fathers_Name,Class,Section,Batch,Date_Of_Berth,Sex,[Address] from student
where T_ID='" +id+ "'", Con);
Sda.Fill(dt);
Repeater1.DataSource = dt;
Repeater1.DataBind();
}
}
selva kumarRank #2,987 · 483 reputationPosted Jul 24, 2013, 3:19 AM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 24, 2013, 3:25 AM EDT
protected void Page_Load(object sender, EventArgs e)
{
Con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=studentmgmt;Integrated Security=True");
int id = Convert.ToInt32(Request.QueryString["T_ID"]);
bind(id);
}
public void bind(int id)
{
Sda = new SqlDataAdapter("Select [Name],Fathers_Name,Class,Section,Batch,Date_Of_Berth,Sex,[Address] from student where T_ID='" + id + "'", Con);
Sda.Fill(dt);
Repeater1.DataSource = dt;
Repeater1.DataBind();
}