GridView RowCommand 获取列值

    //根据按钮属性,进行操作
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    
{
        
if (e.CommandName == "Insert" && Page.IsValid)
        
{
            BluePrintDataSource.Insert();
            SendUserToLastPage 
= true;
        }

        
if (e.CommandName == "AddStage")
        
{
            
int index = Convert.ToInt32(e.CommandArgument);
            DataKey key 
= this.GridView1.DataKeys[index];
            BluePrintID 
= Convert.ToInt32(key.Value);
            FormView1.Visible 
= true;
            Label Label2 
= (Label)this.GridView1.Rows[index].Cells[1].FindControl("Label2");
            LabelMessage.Text 
= " - 您现在正在为项目编号为:" + Label2.Text.ToString() + " 添加阶段记录";
        }

    }
posted @ 2007-12-31 01:57  Fernando  阅读(1941)  评论(3编辑  收藏  举报