// 在此处放置用户代码以初始化页面 //this.Response.Write(this.Request.QueryString["ckd_id"]);//从上页传来的参数 string sqlStr="SELECT phd_id as 出库单号 ,(SELECT storageName FROM storage WHERE storage.storageCode = dbo.kcda_phdda.storageCode) AS 出货仓库, mtime AS 制表时间, ck_man AS 制表人,sh_man AS 送货人, bz AS 备注 FROM dbo.kcda_phdda "; sqlStr=sqlStr + "Where phd_id='"+this.Request.QueryString["phd_id"]+"'"; this.DataGrid1.DataSource=this.a_function.dbtbl(sqlStr,""); this.DataGrid1.DataBind(); sqlStr="SELECT hh_id 货物代码 , number as 数量,retailprice as 单价 ,bz as 备注 FROM kcda_phddamx "; sqlStr=sqlStr + "Where phd_id='"+this.Request.QueryString["phd_id"]+"' order by hh_id "; //Response.Write(sqlStr); this.myDataGrid.DataSource=this.a_function.dbtbl(sqlStr,""); this.myDataGrid.DataBind() ; }
手动触发SelectedIndexChanged
http://www.hexiesoft.net/hexiesoft/Default.aspx,用户名/密码:guest/guest请探讨一下右边Frame如何响应左边Frame中数据表格行的变化(指的是从一行变到另一行时右边内容信息发生变化)?
string sqlStr="SELECT '<a href=\"page_youwant_invoke.aspx?ckd_id='+ckd_id+'\" target=\"_blank\">字段</a>' as 字段汉字名
,...";
this.MyDataGrid.DataSource=dbtbl(sqlStr,"");
this.MyDataGrid.DataBind();public DataView dbtbl(string commstr,string v_soft)//执行查询语句,返回dataview填充datagrid内容,v_soft参数是指定按某个字段排序,可以为空
{
SqlConnection myconn;
myconn=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_conn"]);
SqlDataAdapter myCommand=new SqlDataAdapter(commstr,myconn);
myconn.Open();
DataTable dbtbl=new DataTable ();
myCommand.Fill (dbtbl);//error found nearby XS_xsdID
DataView dbview= dbtbl.DefaultView ;
dbview.Sort =v_soft;
myconn.Close ();
return dbview;
}
在page_youwant_invoke.aspx页里显示明细
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
//this.Response.Write(this.Request.QueryString["ckd_id"]);//从上页传来的参数
string sqlStr="SELECT phd_id as 出库单号 ,(SELECT storageName FROM storage WHERE storage.storageCode = dbo.kcda_phdda.storageCode) AS 出货仓库, mtime AS 制表时间, ck_man AS 制表人,sh_man AS 送货人, bz AS 备注 FROM dbo.kcda_phdda ";
sqlStr=sqlStr + "Where phd_id='"+this.Request.QueryString["phd_id"]+"'";
this.DataGrid1.DataSource=this.a_function.dbtbl(sqlStr,"");
this.DataGrid1.DataBind();
sqlStr="SELECT hh_id 货物代码 , number as 数量,retailprice as 单价 ,bz as 备注 FROM kcda_phddamx ";
sqlStr=sqlStr + "Where phd_id='"+this.Request.QueryString["phd_id"]+"' order by hh_id ";
//Response.Write(sqlStr);
this.myDataGrid.DataSource=this.a_function.dbtbl(sqlStr,"");
this.myDataGrid.DataBind() ; }