绑定行的编辑

  protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //如果是绑定数据行
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)
            {
                ((LinkButton)e.Row.Cells[10].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('你确认要删除地震编号为:/"" + e.Row.Cells[1].Text + "/"的记录吗?')");
            }
        }
        if ((e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate)) || (e.Row.RowState == DataControlRowState.Edit))
        {
            TextBox curText;
            for (int i = 1; i <8; i++)
            {
                curText = (TextBox)e.Row.Cells[i].Controls[0];
                curText.Width = Unit.Pixel(50);
            }
        }
    }

你可能感兴趣的:(JavaScript,object,textbox)