Esempio n. 1
0
    protected void gridRemarks_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            GridView _gridView   = (GridView)sender;
            int      nCurrentRow = Int32.Parse(e.CommandArgument.ToString());
            int      id          = Convert.ToInt16(_gridView.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString());
            if (e.CommandName.ToUpper().Equals("UPDATE"))
            {
                TextBox lblAmntRcv    = (TextBox)_gridView.Rows[nCurrentRow].FindControl("lblAmntRcv");
                TextBox lblRIDate     = (TextBox)_gridView.Rows[nCurrentRow].FindControl("lblRIDate");
                TextBox lblRemRemarks = (TextBox)_gridView.Rows[nCurrentRow].FindControl("lblRemRemarks");
                Label   lblRemID      = (Label)(_gridView.Rows[nCurrentRow].FindControl("lblRemID"));
                Label   lblJID        = (Label)(_gridView.Rows[nCurrentRow].FindControl("lblJID"));


                string seatime  = lblAmntRcv.Text;
                string porttime = lblRIDate.Text;


                //Update command
                oCP.Update_Remittance_Details(UDFLib.ConvertDateToNull(lblRIDate.Text), Convert.ToDouble(lblAmntRcv.Text), lblRemRemarks.Text, lblRemID.Text);
            }
            if (e.CommandName.ToUpper().Equals("CANCEL"))
            {
                _gridView.EditIndex = -1;
                DataTable dt = oCP.Get_Remittance_Details(ViewState["Charter_Id"].ToString()).Tables[0];
                gridRemarks.DataSource = dt;
                gridRemarks.DataBind();
            }
            DataTable dt1 = oCP.Get_Remittance_Details(ViewState["Charter_Id"].ToString()).Tables[0];
            gridRemarks.DataSource = dt1;
            gridRemarks.DataBind();
        }
        catch (Exception ex)
        {
            string err = ex.ToString();
        }
    }