when i clik the link btn "view" in gridview that that time all related field of book_id like book_name,Copy,publisher etc fields are disply in "DetailView" control plz help.....to diplay..
Diplay all field in "DetailView" Control
Hello ...sir

when i clik the link btn "view" in gridview that that time all related field of book_id like book_name,Copy,publisher etc fields are disply in "DetailView" control plz help.....to diplay..
when i clik the link btn "view" in gridview that that time all related field of book_id like book_name,Copy,publisher etc fields are disply in "DetailView" control plz help.....to diplay..
fresher developerPosted Mar 7, 2013, 11:20 AM
Satyapriya NayakPosted Mar 7, 2013, 4:10 AM
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Display_related_records_gridview
{
public partial class test1 : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
SqlCommand com;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bindgrid();
}
}
private void bindgrid()
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from employee";
com = new SqlCommand(str, con);
SqlDataReader reader;
reader = com.ExecuteReader();
g1.DataSource = reader;
g1.DataBind();
con.Close();
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test2.aspx.cs" Inherits="Display_related_records_gridview.test2" %>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Display_related_records_gridview
{
public partial class test2 : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
string s1;
SqlCommand com;
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
try
{
con.Open();
s1 = Request.QueryString[0];
str = "select * from employee where empid='" + s1 + "'";
com = new SqlCommand(str, con);
DetailsView1.DataSource = com.ExecuteReader();
DetailsView1.DataBind();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
con.Close();
}
}
}