Choose Gridview rows in ASP.NET

1

I am extracting information at GridView but I see that they are quite fields that I do not want.

How could it be done to just choose the rows that I want?

I enclose the image of GridView and everything that comes out.

This is the code that I pull to my GridView .

dtorequest.Monto = Convert.ToDecimal(txtImporteCredito.Text);//Convert.ToDecimal(1900.00);
dtorequest.MontoCapitalFijo = 0;
dtorequest.MontoTIR2 = 10000;
dtorequest.MontoTIR3 = 0;
int somestring = Convert.ToInt32(dprNumerocuota.SelectedItem.Value);
dtorequest.NumeroCuotas = Convert.ToInt32(dprNumerocuota.SelectedItem.Text.Substring(0, 2));// 12;
dtorequest.Oficina = 5;
dtorequest.Periodicidad = 30;
dtorequest.PeriodicidadCapital = 0;
dtorequest.PeriodicidadInteres = 0;
dtorequest.PeriodosGracia = 0;
dtorequest.Plazo = 360;
dtorequest.PorcentajeMinimoCuoton = 0;
dtorequest.RedondeoHacia = ServiceReference1.EnumeradosConfiguracionNegocioTipoRedondeo.Arriba;

dtorequest.Tasa = Convert.ToDecimal(txtTEA.Text);//40;
dtorequest.TasaInicialObjetivo = 0;
dtorequest.TipoGracia = ServiceReference1.EnumeradosConfiguracionNegocioTipoGracia.GraciaCapital;
dtorequest.TipoTabla = "CUOTFIJA";

listadtodividendo = tabla.ConsultarTablaAmortizacion(dtorequest).ToList();

GridView1.DataSource = listadtodividendo;

GridView1.DataBind();

For example, of all that I just want to show it as the image:

    
asked by PieroDev 09.06.2017 в 19:23
source

2 answers

1

Good so they can hide a row from a gridview you have to add a new property called RowCreated and make this code indicating the row number you want to hide:

 protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {

            e.Row.Cells[0].Visible = false;
            e.Row.Cells[1].Visible = false;
            e.Row.Cells[2].Visible = false;
            e.Row.Cells[3].Visible = false;
            e.Row.Cells[5].Visible = false;
            e.Row.Cells[6].Visible = false;
            e.Row.Cells[7].Visible = false;
            e.Row.Cells[8].Visible = false;
            e.Row.Cells[10].Visible = false;


        }
    
answered by 13.06.2017 / 02:45
source
1

First of all in your GridView you are going to put the characteristic of

<asp:GridView ID="GridView1" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="Monto" HeaderText="Monto" />
</columns>

In this way you are creating BoundField depending on the columns you want to create. EYE the "DataField" puts the name of the data

    
answered by 09.06.2017 в 20:09