Ejemplo n.º 1
0
        protected void gv_Favorites_RowDataBound(object obj, GridViewRowEventArgs e)
        {
            try
            {
                /* IM01365142 - New Agricast - Favorite table - translation for "Edit" and "Delete" - Jerrey - Begin */
                if (e.Row.RowType == DataControlRowType.Header)
                {
                    e.Row.Cells[3].Text = string.Format("{0} / {1}",
                                                    objPreTool.getTranslatedText(Constants.FAV_EDIT, strCulCode),
                                                    objPreTool.getTranslatedText(Constants.FAV_DELETE, strCulCode));
                }
                /* IM01365142 - New Agricast - Favorite table - translation for "Edit" and "Delete" - Jerrey - End */

                if (e.Row.RowType == DataControlRowType.DataRow)
                {

                    LinkButton lbButton = new LinkButton();
                    lbButton.Text = e.Row.Cells[0].Text;
                    e.Row.Cells[0].Controls.Add(lbButton);
                    lbButton.CommandName = "Select";
                    lbButton.CommandArgument = index.ToString();
                    index++;

                    /* IM01365225 - New Agricast - favorite - Service Name - Jerrey - Begin */
                    objSvcPre = new ServicePresenter();
                    Label lblModuleName = new Label();
                    lblModuleName.Text = e.Row.Cells[1].Text;
                    lblModuleName.Visible = false;
                    e.Row.Cells[1].Controls.Add(lblModuleName);

                    Label lblModuleTransTag = new Label();
                    lblModuleTransTag.Text = objSvcPre.GetServicePageTransTag(lblModuleName.Text);
                    e.Row.Cells[1].Controls.Add(lblModuleTransTag);
                    /* IM01365225 - New Agricast - favorite - Service Name - Jerrey - End */
                }

                //hide the key field in the GRID
                e.Row.Cells[4].Visible = false;

            }

            catch (Exception ex)
            {
                AgriCastException currEx = new AgriCastException(objSvcPre.GetServiceDetails(), ex);
                AgriCastLogger.Publish(currEx, AgriCastLogger.LogType.Error);
                HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.GENERIC_ERRORONPAGE, strCulCode) + ex.Message.ToString();

            }
        }