ASP.NET,点击GridView中的详细按钮获取点击那行的值 仍用gridview显示
主页面已经写好可以跳转 protected void GridViewD_RowCommand(object sender, GridViewCommandEventArgs e)
{
if ("EditRow".Equals(e.CommandName))
{
string id = e.CommandArgument.ToString();
this.ModalPopupExtender1.Show();
}
}
但是次页面不显示内容 是一个空的表框
次表的GridView是用GridView.Datasource=ds;GridView.DataBind();绑定的
不用sqlDataSource
也不能用GridView自带的选择
protected void Page_Load(object sender, EventArgs e)
{
if (getuser.Strcomid == null) Response.Redirect("index.aspx");
if (!Page.IsPostBack)
{
System.Data.SqlClient.SqlConnection sqlConn = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["dbsysConnectionString"].ConnectionString.ToString());
sqlConn.Open();
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter("SELECT ents_sid,ents_pid,ents_comid, ents_code,ents_type, ents_mid, pro_ape, pro_spe, ents_qty, ents_wid,ents_price,ents_amount, ents_discount, ents_disrate,ents_gamount,ents_present,ents_oth1,ents_rem FROM dbo.GetEntryDinfo where ents_mid='" + get_value.Getcontrolstr + "' and ents_type=11 and ents_comid='" + getuser.Strcomid + "'", sqlConn);
da.Fill(dt);
da.Dispose();
sqlConn.Close();
GridViewD.DataSource = dt;
//this.GridViewD.DataKeyNames = new string[] { "ents_sid" };
GridViewD.DataBind();
}
} 怎么才能让次页面中的gridview表显示选中行的数据 求代码
主页面已经写好可以跳转 protected void GridViewD_RowCommand(object sender, GridViewCommandEventArgs e)
{
if ("EditRow".Equals(e.CommandName))
{
string id = e.CommandArgument.ToString();
this.ModalPopupExtender1.Show();
}
}
但是次页面不显示内容 是一个空的表框
次表的GridView是用GridView.Datasource=ds;GridView.DataBind();绑定的
不用sqlDataSource
也不能用GridView自带的选择
protected void Page_Load(object sender, EventArgs e)
{
if (getuser.Strcomid == null) Response.Redirect("index.aspx");
if (!Page.IsPostBack)
{
System.Data.SqlClient.SqlConnection sqlConn = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["dbsysConnectionString"].ConnectionString.ToString());
sqlConn.Open();
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter("SELECT ents_sid,ents_pid,ents_comid, ents_code,ents_type, ents_mid, pro_ape, pro_spe, ents_qty, ents_wid,ents_price,ents_amount, ents_discount, ents_disrate,ents_gamount,ents_present,ents_oth1,ents_rem FROM dbo.GetEntryDinfo where ents_mid='" + get_value.Getcontrolstr + "' and ents_type=11 and ents_comid='" + getuser.Strcomid + "'", sqlConn);
da.Fill(dt);
da.Dispose();
sqlConn.Close();
GridViewD.DataSource = dt;
//this.GridViewD.DataKeyNames = new string[] { "ents_sid" };
GridViewD.DataBind();
}
} 怎么才能让次页面中的gridview表显示选中行的数据 求代码
//你的链接跳转
herf=“a.aspx?id=****”//获取值
string str = Resquest.QueryString["id"].ToString();//根据ID查出来数据
//自己写
//绑定自己写