see a table with the buttonfield of my gridview

0

My problem is the following: in my gridview I put a buttonfield to expand the information I have in that row, but I do not work the code I did so I thought so

Any ideas? preened in advance

protected void grDatos_RowCommand (object sender, GridViewCommandEventArgs e)         {             try             {                 if (e.CommandName == "See")                 {                     int index = Convert.ToInt32 (e.CommandArgument);                     GridViewRow row = grDatos.Rows [index];                     Session ["verCuenta"] = Server.HtmlDecode (row.Cells [0] .Text);                     VerCuentas (Convert.ToString (Session ["verCuenta"]));                 }             }             catch {}

    }

    protected void VerCuentas(string p)
    {

        DataTable dtDatos = null;
        string strConsulta = "exec SP_VER_CuentasMasImputadas";

        try
        {
            strConsulta = strConsulta + " @codigo = " + Convert.ToString(Session["verCuenta"]);


            dtDatos = Conexion.llenarGridFromConsulta(strConsulta);

            if (dtDatos == null)
            {
                if (Session["error"] != null)
                {
                    lblMensaje.Text = Session["error"].ToString();
                    lblMensaje.Visible = true;
                }

            }
            else
            {
                grDatosVer.DataSource = dtDatos;
                grDatosVer.DataBind();

            }

        }
        catch { }
    }

frontend

                                                                                                                                                                                                                                                                                                                                              

                </Columns>
             <EmptyDataRowStyle HorizontalAlign="Center" />
             <EmptyDataTemplate >
            <asp:Label ID="lblNoTieneDato" runat="server"  
                Text="LA CONSULTA NO TRAE DATOS" ForeColor="Red" Font-Bold="true"></asp:Label>
                </EmptyDataTemplate>

            </asp:GridView>
        </td>
    </tr>
</table>

store procedure I'm using:

ALTER PROCEDURE [dbo]. [SP_VER_CuentasMasImputadas] @codigo int

AS BEGIN

select TransactionId, AccountCode, NetAmount, EffectiveDate, CreatedDate, DocumentType, JournalDescription, LineDescription, FirstNameusername, Movement.Description as descrip from MainTable left join Users on MainTable.UserId = Users.Id_user left join Movement on MainPanel.Id_movement = Movement.Id_movement where AccountCode = @codigo

END

    
asked by Dieguito Weed 22.11.2018 в 21:17
source

0 answers