예제 #1
0
        /// <summary>
        /// gvResults - OnRowDataBound
        /// </summary>
        protected void gvResults_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                // Process DataRow
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    // Check if row is NOT in Edit mode
                    if (e.Row.RowState != DataControlRowState.Edit &&
                        e.Row.RowState != (DataControlRowState.Edit | DataControlRowState.Alternate))
                    {
                        // Change the Background Color of the row during Hoover
                        GridFormatting.GridViewStyle(e);

                        // Set OnClick event to go into Select Mode
                        e.Row.Attributes.Add("onClick", Page.ClientScript.GetPostBackClientHyperlink(gvResults, "Select$" + e.Row.RowIndex));
                    }
                }
            }
            catch (InternalException err)
            {
                // Display a Messagebox
                AlertMessage.Show(err.UserFriendlyMsg, this.Page);
            }
            catch (Exception err)
            {
                // Error
                string errMsg = string.Format("{0} - gvResults Row Data Bound Error - {1}",
                                              GetType().FullName,
                                              err.Message);

                // Log the Error
                AppLogWrapper.LogError(errMsg);

                // Save a User Friendly Error Message in Session Variable
                errMsg = "There was a problem creating a row in the Results grid.  If the problem persists, please contact Technical Support.";

                // Display a Messagebox
                AlertMessage.Show(errMsg, this.Page);
            }
        }
예제 #2
0
        /// <summary>
        /// gvDirectReportCA - OnRowDataBound
        /// </summary>
        protected void gvDirectReportCA_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            const string WIPText       = "Work in Progress";
            const string PndTMDiscText = "Pnd Mgr TM Disc";
            const string PndTMAckText  = "Pnd TM Ack";

            //const string CancelText = "Cancel";

            try
            {
                // Process DataRow
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    int    idx        = Convert.ToInt32(e.Row.RowIndex);
                    string statusCode = gvDirectReportCA.DataKeys[idx].Values["Status_Code"].ToString();

                    //Button btnCancel = (Button)e.Row.Cells[6].Controls[0];
                    Button btnCancel = (Button)e.Row.Cells[6].FindControl("cancel");
                    btnCancel.Visible = false;
                    Button btnPndTMDisc = (Button)e.Row.Cells[6].FindControl("pndTMDisc");
                    btnPndTMDisc.Visible = false;
                    Button btnPndTMAck = (Button)e.Row.Cells[6].FindControl("pndTMAck");
                    btnPndTMAck.Visible = false;

                    DataRowView drv = (DataRowView)e.Row.DataItem;

                    if (statusCode.ToString().ToUpper() == "WIP")
                    {
                        btnPndTMDisc.Visible = true;
                    }

                    if (drv.Row.ItemArray[5].ToString() == WIPText)
                    {
                        btnPndTMDisc.Visible = true;
                    }

                    if (drv.Row.ItemArray[5].ToString() == PndTMDiscText)
                    {
                        btnPndTMDisc.Visible = true;
                    }

                    // Check for Pnd TM Discussion Button
                    if (btnPndTMDisc.Text == PndTMDiscText)
                    {
                        btnPndTMDisc.Attributes["onclick"] = "javascript:if (! confirm('Are you sure you want to change the status. '))" +
                                                             "{return false;}";
                        btnPndTMDisc.Visible = false;
                        btnPndTMAck.Visible  = true;
                    }

                    // Check for Pnd TM Ack Button
                    if (btnPndTMAck.Text == PndTMAckText)
                    {
                        // Add a confirmation
                        //btnPndTMAck.Attributes["onclick"] = "javascript:if (! confirm('Are you sure you want to change the status. '))" +
                        //                                  "{return false;}";

                        if (btnPndTMAck.Attributes["onclick"].Equals(true))
                        {
                            btnPndTMAck.Visible = false;
                        }
                    }

                    // Check if row is NOT in Edit mode
                    if (e.Row.RowState != DataControlRowState.Edit &&
                        e.Row.RowState != (DataControlRowState.Edit | DataControlRowState.Alternate))
                    {
                        // Change the Background Color of the row during Hover
                        GridFormatting.GridViewStyle(e);

                        // Set OnClick event to go into Select Mode
                        e.Row.Attributes.Add("onClick", Page.ClientScript.GetPostBackClientHyperlink(gvDirectReportCA, "Select$" + e.Row.RowIndex));
                    }
                }
            }
            catch (InternalException err)
            {
                // Display a Messagebox
                AlertMessage.Show(err.UserFriendlyMsg, this.Page);
            }
            catch (Exception err)
            {
                // Error
                string errMsg = string.Format("{0} - gvDirectReportCA Row Data Bound Error - {1}",
                                              GetType().FullName,
                                              err.Message);

                // Log the Error
                AppLogWrapper.LogError(errMsg);

                // Save a User Friendly Error Message in Session Variable
                errMsg = "There was a problem creating a row in the CA for DirectReport TM grid.  If the problem persists, please contact Technical Support.";

                // Display a Messagebox
                AlertMessage.Show(errMsg, this.Page);
            }
        }