コード例 #1
0
 public void grdpl1_UpdateCommand(object sender, DataGridCommandEventArgs e)
 {
     String DetailId = grdpl1.DataKeys[Convert.ToInt32(e.Item.ItemIndex)].ToString();
     Whitfieldcore _dbClass = new Whitfieldcore();
     _dbClass.UPDATEMaterialinWorkOrder(Convert.ToInt32(ViewState["EstNum"].ToString()), ViewState["WorkOrderID"].ToString(), Convert.ToInt32(DetailId), ((TextBox)(e.Item.FindControl("txtqty"))).Text);
     grdpl1.EditItemIndex = -1;
     grdpl1.ShowFooter = true;
     this.DisplayGrid(Convert.ToInt32(ViewState["EstNum"].ToString()), ViewState["WorkOrderID"].ToString());
     Page.GetType().InvokeMember("DisplayGrid", BindingFlags.InvokeMethod, null, this.Page, null);
 }
コード例 #2
0
    protected void btnInsert_Click(object sender, EventArgs e)
    {
        try
        {
            Whitfieldcore _dbClass = new Whitfieldcore();
            foreach (DataGridItem dgItem in grdpl1.Items)
            {
               // String DetailId = grdpl1.DataKeys[Convert.ToInt32(e.Item.ItemIndex)].ToString();
                Int32 DetailId = Convert.ToInt32(grdpl1.DataKeys[dgItem.ItemIndex].ToString());
                String FeatureValue = ((TextBox)dgItem.FindControl("txtqty1")).Text;
                _dbClass.UPDATEMaterialinWorkOrder(Convert.ToInt32(ViewState["EstNum"].ToString()), ViewState["WorkOrderID"].ToString(), Convert.ToInt32(DetailId), FeatureValue.ToString().Trim());
            }
            this.DisplayGrid(Convert.ToInt32(ViewState["EstNum"].ToString()), ViewState["WorkOrderID"].ToString());
            Page.GetType().InvokeMember("DisplayGrid", BindingFlags.InvokeMethod, null, this.Page, null);
        }
        catch (Exception exp)
        {
            Response.Write(exp.Message.ToString());
        }

        grdpl1.EditItemIndex = -1;
        grdpl1.ShowFooter = true;
    }