2
I made a query where it is populated a gridview, the columns are code, category, noprazo, foradoprazo. In the columns noprazo and foradoprazo, I left them as linkbuttom
that by clicking on the resulting item line or noprazo or out of date, returns me the ID of the clicked line.
This is performed on GridView1_RowCommand
as follows below, but does not return me the id of the clicked row.
What should I do?
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Detalhar")
{
chamadosEntities carga1 = new chamadosEntities();
int index = Convert.ToInt32(e.CommandArgument);
GridView1.SelectedIndex = index;
int codigoId = Convert.ToInt32(GridView1.DataKeys[index].Value);
acredito que a linha : int codigoId = Convert.ToInt32(GridView1.DataKeys[index].Value); posssa ser substituida por <asp:GridView ID="Grid" runat="server" DataKeyNames="codigoId "> e no codo behind Int32 codigoId = (Int32)Grid.DataKeys[row.RowIndex]. Value;
– Marco Souza
Vlw Marconcilio, it worked... Thank you very much
– Joelias Andrade