Example #1
0
    }//end void 

    public static void LlenaGridViewDataReader( System.Data.SqlClient.SqlDataReader sqldr , GridView gv, Label lblTitulo, String DescripcionTitulo, Label lblMsj )
    {
        try
        {
             if (sqldr.HasRows)
                    {            
                        gv.DataSource = sqldr;
                        gv.DataBind();
                        gv.Caption = gv.Rows.Count + " registros ";
                        lblTitulo.Text = DescripcionTitulo;
                        LabelControl.LimpiaLabel(lblMsj);
                    }
                    else
                    {
                        GridViewControl.LimpiaGridview(gv);
                        LabelControl.LimpiaLabel(lblTitulo);
                        lblMsj.Text = FmkCartera.Generales.Mensaje.DevuelveMsj(2);            

                    }//end if
        }
        catch (Exception ex)
        {
            lblMsj.Text = ex.Message;
        }       

    }//end void 
Example #2
0
    }//string

    //Usado para Exportar a Excel y Paginacion
    public static void LlenaGridViewDataReaderSesionTabla(System.Data.SqlClient.SqlDataReader sqldr, GridView gv, Label lblTitulo, String DescripcionTitulo, Label lblMsj, ImageButton bt, String NombreSesion)
    {
        try
        {
            if (sqldr.HasRows)
            {
                System.Data.DataTable dt = new System.Data.DataTable();
                dt.Load(sqldr);                

                System.Web.HttpContext.Current.Session[NombreSesion] = dt;

                gv.DataSource = dt;
                gv.DataBind();
                gv.Caption = gv.Rows.Count + " registros ";
                lblTitulo.Text = DescripcionTitulo;
                LabelControl.LimpiaLabel(lblMsj);

                ImageButtonControl.HabilitaVisibilidadBotones(true, bt);

                if (dt.Rows.Count >= 20)
                {
                    gv.Caption = "Registros: " + dt.Rows.Count + " (Paginados de 20 en 20)";
                }
                else
                {
                    gv.Caption = "Registros: " + dt.Rows.Count;
                }//end if   
            }
            else
            {
                ImageButtonControl.HabilitaVisibilidadBotones(false, bt);
                GridViewControl.LimpiaGridview(gv);
                LabelControl.LimpiaLabel(lblTitulo);
                lblMsj.Text = FmkCartera.Generales.Mensaje.DevuelveMsj(2);

            }//end if
        }
        catch (Exception ex)
        {
            lblMsj.Text = ex.Message;

        }//end try       

    }//end void