shah Momin

shah Momin

  • NA
  • 176
  • 21.4k

What Can I Wrong

Jun 6 2022 8:35 PM
private void DgvAttendanceGrid_SelectionChanged(object sender, EventArgs e)
{
    AdjustmentBLL adjustmentBLL = new AdjustmentBLL();
    ManualAttendance attendance = new ManualAttendance();
    foreach (DataGridViewRow selectedRow in (BaseCollection)dgvAttendanceGrid.SelectedRows)
    {
        iAttendanceLogID = int.Parse(selectedRow.Cells["ATTENDANCELOGID"].Value.ToString());
        DataSet dataSet = adjustmentBLL.FetchAttendanceByLogID(iAttendanceLogID);
        if (dataSet.Tables[0].Rows.Count > 0)
        {
            DataRow row = dataSet.Tables[0].Rows[0];
            attendance.ddlShiftAdjust.Text = row["SHIFT"].ToString();
            Convert.ToString(attendance.ddlVolunteerNameAdjust.SelectedValue = row["VOLUNTEERID"].ToString());
            if (row["DUTYDATETIME"].ToString() != "")
                attendance.dtp_DutyDuaTime.Value = (DateTime)row["DUTYDATETIME"];
            if (row["CHECKINDATETIME"].ToString() != "")
                attendance.dtp_CheckInDateTime.Value = (DateTime)row["CHECKINDATETIME"];
            if (row["CHECKOUTDATETIME"].ToString() != "")
                attendance.dtp_CheckOutDateTime.Value = (DateTime)row["CHECKOUTDATETIME"];
            attendance.ddlTypeAdjust.Text = row["TYPE"].ToString();
            attendance.ddlPointsAdjust.SelectedValue = row["POINTS"].ToString();

            if (row["DUTYSPOT1"].ToString() != "")
                attendance.ddlDutySpot1.SelectedValue = row["DUTYSPOT1"].ToString();
            else
                attendance.ddlDutySpot1.SelectedValue =-1;

            if (row["DUTYSPOT2"].ToString() != "")
                attendance.ddlDutySpot2.SelectedValue = row["DUTYSPOT2"].ToString();
            else
                attendance.ddlDutySpot2.SelectedValue = -1;

            if (row["DUTYSPOT3"].ToString() != "")
                attendance.ddlDutySpot3.SelectedValue = row["DUTYSPOT3"].ToString();
            else
                attendance.ddlDutySpot3.SelectedValue = -1;
            attendance.Show();
        }
        attendance.dtpDutyDateTime.Text =attendance.dtp_DutyDuaTime.Value.ToString("ddd  dd-MMM-yyyy  hh:mm:tt");
        attendance.dtpCheckInDateTime.Text = attendance.dtp_CheckInDateTime.Value.ToString("ddd  dd-MMM-yyyy  hh:mm:tt");
        attendance.dtpCheckOutDateTime.Text = attendance.dtp_CheckOutDateTime.Value.ToString("ddd  dd-MMM-yyyy  hh:mm:tt");

    }
}

Convert.ToString(attendance.ddlVolunteerNameAdjust.SelectedValue = row["VOLUNTEERID"].ToString());

attendance.ddlPointsAdjust.SelectedValue = row["POINTS"].ToString();

if (row["DUTYSPOT1"].ToString() != "")
                        attendance.ddlDutySpot1.SelectedValue = row["DUTYSPOT1"].ToString();

this Line Not Pass Value OTher Value Pass 


Answers (2)