private void dtgServicioRecorrido_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataGrid            grdRecorridos = (DataGrid)sender;
                DsHojaRuta          dsRecorridos  = (DsHojaRuta)grdRecorridos.DataSource;
                DsHojaRuta.DatosRow dr            = (DsHojaRuta.DatosRow)dsRecorridos.Datos.Rows[e.Item.DataSetIndex];

                int            AgenciaDestinoID = dr.IsAgenciaIDNull() ? 0 : dr.AgenciaID;
                LiteralControl lc;
                if (AgenciaDestinoID > 0)
                {
                    if (dsRecorridos.DatosAsociados.Select("AgenciaID = " + AgenciaDestinoID).Length > 0)
                    {
                        DataGrid    grdGuias = new DataGrid();
                        BoundColumn bc;

                        grdGuias.AutoGenerateColumns = false;
                        grdGuias.DataKeyField        = "GuiaID";
                        //grdGuias.DeleteCommand += new DataGridCommandEventHandler(grdGuias_DeleteCommand);

                        grdGuias.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.grdGuias_ItemDataBound);

                        bc            = new BoundColumn();
                        bc.DataField  = "GuiaID";
                        bc.HeaderText = "ID";
                        bc.Visible    = false;
                        grdGuias.Columns.Add(bc);

                        TemplateColumn tp = new TemplateColumn();
                        //DynamicItemTemp.idcontrol = dr.
                        tp.ItemTemplate = new DynamicItemTemp();

                        grdGuias.Columns.Add(tp);

                        bc            = new BoundColumn();
                        bc.DataField  = "NroCompletoGuia";
                        bc.HeaderText = "Guía";
                        grdGuias.Columns.Add(bc);

                        bc            = new BoundColumn();
                        bc.DataField  = "CantidadBultosTotal";
                        bc.HeaderText = "Bultos";
                        grdGuias.Columns.Add(bc);

                        SisPackController.AdministrarGrillas.ConfigurarChica(grdGuias, "GuiaID");

                        grdGuias.DataSource = dsRecorridos.DatosAsociados.Select("AgenciaID = " + AgenciaDestinoID);
                        grdGuias.DataBind();

                        e.Item.Cells[0].Controls.Add(grdGuias);
                        lc = new LiteralControl("<br>");
                        e.Item.Cells[0].Controls.Add(lc);
                    }
                }
            }
        }
        private void dtgServicioRecorrido_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataGrid            grdRecorridos = (DataGrid)sender;
                DsHojaRuta          dsRecorridos  = (DsHojaRuta)grdRecorridos.DataSource;
                DsHojaRuta.DatosRow dr            = (DsHojaRuta.DatosRow)dsRecorridos.Datos.Rows[e.Item.DataSetIndex];

                int            AgenciaDestinoID = dr.IsAgenciaIDNull() ? 0 : dr.AgenciaID;
                LiteralControl lc;
                if (AgenciaDestinoID > 0)
                {
                    if (dsRecorridos.DatosAsociados.Select("AgenciaID = " + AgenciaDestinoID).Length > 0)
                    {
                        DataGrid    grdGuias = new DataGrid();
                        BoundColumn bc;

                        grdGuias.AutoGenerateColumns = false;
                        grdGuias.DataKeyField        = "GuiaID";
                        //grdGuias.DeleteCommand += new DataGridCommandEventHandler(grdGuias_DeleteCommand);

                        grdGuias.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.grdGuias_ItemDataBound);

                        bc            = new BoundColumn();
                        bc.DataField  = "GuiaID";
                        bc.HeaderText = "ID";
                        bc.Visible    = false;
                        grdGuias.Columns.Add(bc);

                        TemplateColumn tp = new TemplateColumn();
                        //DynamicItemTemp.idcontrol = dr.
                        tp.ItemTemplate = new DynamicItemTemp();

                        //						CheckBox a = DynamicItemTemplate.check;
                        // comienzo a registrar la funcion javascript para desmarcar -tavo
                        //						string check = chkMostrarTodos.ClientID;
                        //						StringBuilder scriptString = new System.Text.StringBuilder();
                        //						scriptString.Append("<script language='javascript'>function SeleccionarTodos(){");
                        //						scriptString.Append("valCheck = window.document.getElementById('" + check + "').checked;\n");
                        //tavo
                        //						string nombCheck = ((CheckBox)DynamicItemTemplate.check).UniqueID;
                        //string nombCheck = ((CheckBox)item.FindControl("valoresChequeados")).UniqueID;
                        //						scriptString.Append("window.document.getElementById('" + nombCheck + "').checked = valCheck;\n");

                        grdGuias.Columns.Add(tp);

                        bc            = new BoundColumn();
                        bc.DataField  = "NroCompletoGuia";
                        bc.HeaderText = "Guía";
                        grdGuias.Columns.Add(bc);

                        bc            = new BoundColumn();
                        bc.DataField  = "CantidadBultosTotal";
                        bc.HeaderText = "Bultos";
                        grdGuias.Columns.Add(bc);

                        SisPackController.AdministrarGrillas.ConfigurarChica(grdGuias, "GuiaID");

                        grdGuias.DataSource = dsRecorridos.DatosAsociados.Select("AgenciaID = " + AgenciaDestinoID);
                        grdGuias.DataBind();

                        e.Item.Cells[0].Controls.Add(grdGuias);
                        lc = new LiteralControl("<br>");
                        e.Item.Cells[0].Controls.Add(lc);
                    }
                }
            }
        }
Beispiel #3
0
        private void dtgServicioRecorrido_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataGrid            grdRecorridos = (DataGrid)sender;
                DsHojaRuta          dsRecorridos  = (DsHojaRuta)grdRecorridos.DataSource;
                DsHojaRuta.DatosRow dr            = (DsHojaRuta.DatosRow)dsRecorridos.Datos.Rows[e.Item.DataSetIndex];

                int            AgenciaDestinoID = dr.IsAgenciaIDNull() ? 0 : dr.AgenciaID;
                LiteralControl lc;
                if (AgenciaDestinoID > 0)
                {
                    if (dsRecorridos.DatosAsociados.Select("AgenciaID = " + AgenciaDestinoID).Length > 0)
                    {
                        DataGrid grdGuias = new DataGrid();
                        grdGuias.AutoGenerateColumns = false;
                        grdGuias.DataKeyField        = "GuiaID";
                        grdGuias.ItemDataBound      += new System.Web.UI.WebControls.DataGridItemEventHandler(this.Totalizar);
                        //grdGuias.ShowFooter = true;

                        BoundColumn bc;

                        bc                 = new BoundColumn();
                        bc.DataField       = "NroCompletoGuia";
                        bc.ItemStyle.Width = Unit.Percentage(30);
                        grdGuias.Columns.Add(bc);

                        bc                 = new BoundColumn();
                        bc.DataField       = "CantidadBultosTotal";
                        bc.ItemStyle.Width = Unit.Percentage(30);
                        grdGuias.Columns.Add(bc);

                        grdGuias.GridLines           = GridLines.None;
                        grdGuias.BorderStyle         = BorderStyle.None;
                        grdGuias.BorderWidth         = Unit.Pixel(0);
                        grdGuias.BorderColor         = System.Drawing.Color.White;
                        grdGuias.ItemStyle.CssClass  = "TextoGrilla";
                        grdGuias.PagerStyle.CssClass = "Texto";

                        grdGuias.FooterStyle.CssClass    = "TextoBold";
                        grdGuias.FooterStyle.BorderStyle = BorderStyle.Groove;
                        grdGuias.FooterStyle.BorderWidth = Unit.Pixel(1);
                        grdGuias.FooterStyle.BorderColor = System.Drawing.Color.Gray;

                        grdGuias.DataSource = dsRecorridos.DatosAsociados.Select("AgenciaID = " + AgenciaDestinoID);
                        grdGuias.DataBind();

                        e.Item.Width = Unit.Percentage(100);
                        //e.Item.Cells[0].ColumnSpan = 4;
                        e.Item.Cells[0].Controls.Add(grdGuias);

                        lc = new LiteralControl("<br>");
                        //e.Item.Cells[0].ColumnSpan = 4;
                        e.Item.Cells[0].Controls.Add(lc);

                        //lc = new LiteralControl("<table width='100%'><tr><td><br></td></tr><tr><td width='100%' align='right' class='Texto'>Firma y Aclaración: </td></tr></table>");
                        //e.Item.Cells[0].ColumnSpan = 4;
                        //e.Item.Cells[0].Controls.Add(lc);

                        //lc=new LiteralControl("<br>");
                        //e.Item.Cells[0].ColumnSpan = 4;
                        //e.Item.Cells[0].Controls.Add(lc);

                        //lc=new LiteralControl("<br>");
                        //e.Item.Cells[0].ColumnSpan = 4;
                        //e.Item.Cells[0].Controls.Add(lc);

                        //lc = new LiteralControl("<hr>");
                        //e.Item.Cells[0].ColumnSpan = 4;
                        //e.Item.Cells[0].Controls.Add(lc);
                    }
                    else
                    {
                        e.Item.Visible = false;
                    }
                }
            }
        }