foreach (DataGridItem item in ArticleGrid.Items)
    
{
        CheckBox Chk 
= (CheckBox)item.FindControl("ArticleChk");
        
if (Chk.Checked)
        
{
        id 
+= "," + ArticleGrid.DataKeys[item.ItemIndex];
        }

    }


for(int i=0;i<this.dtTopOrg.Rows.Count;i++)
    
{
        
string Sid=this.dtTopOrg.Rows[i]["Sid"].ToString();
        
string Name=this.dtTopOrg.Rows[i]["Hy_coname"].ToString();
        
string Hy_co=this.dtTopOrg.Rows[i]["Hy_co"].ToString();
        }


GridView里面获取boundField点击的所在行的数据

this.GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value

  
protected void MasterGridView_RowDataBound( object sender, GridViewRowEventArgs e )
  
{
    
if (e.Row.RowType == DataControlRowType.DataRow)
    
{

      GridView oGridView 
= (GridView)e.Row.FindControl("DetailGridView");
      
if (oGridView != null)
      
{
        OleDbCommand cmd 
= new OleDbCommand("select top 10 * from Document Where pid = " + MasterGridView.DataKeys[e.Row.RowIndex].Value, cn1);
        OleDbDataReader dr1 
= cmd.ExecuteReader();
        oGridView.DataSource 
= dr1;
        oGridView.DataBind();
        dr1.Close();
        cmd.Dispose();
      }

    }

  }


((LinkButton)(e.Row.Cells[
6].Controls[0])).Attributes.Add("onclick""return confirm('你确定要删除码?');");

this.GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value
posted on 2007-05-29 00:58  小角色  阅读(145)  评论(0)    收藏  举报