ASP.NET - Problemas al anviar parametros por get

 
Vista:
Imágen de perfil de Mauricio

Problemas al anviar parametros por get

Publicado por Mauricio (1 intervención) el 02/11/2015 19:10:39
Estimados:

Necesito si alguien me pudiese ayudar con un problema que se me esta presentado cuando envio parámetros por GET a una pagina ASPX, por ejemplo "CierreEdp.aspx?numero=2525", en esta pagina hay un GridView y dentro de esta grilla hay un ImgeButton que contiene una acción que se controla a través de CommandName y CommandArgument, la pagina al llamarla sin parámetros funciona bien, pero cuando envío los parámetros por GET no realiza la acción del imageButton, ¿alguien me puede ayudar con esto?

Recepcion del parámetro

1
2
3
4
5
if (Request.QueryString["numero"] != null)
{
	hfId.Value = Request.QueryString["numero"].ToString();
	buscar();
}

Grilla con el ImageButton

1
2
3
4
5
6
7
8
9
10
11
<asp:GridView ID="gvPre" runat="server" AutoGenerateColumns="false" OnRowCommand="gvPre_RowCommand" CssClass="grilla1" AlternatingRowStyle-BackColor="#ecf2f6" >
	<Columns>
		<asp:BoundField DataField="OrdenTransporteId" HeaderText="Orden de Transporte"/>
		<asp:BoundField DataField="OtAlerce" HeaderText="OT Alerce"/>
		<asp:TemplateField HeaderText="Elimina Sel">
			<ItemTemplate>
					<asp:ImageButton ID="btDeletePreDetalle" runat="server" ImageUrl="~/IMG/icons/raster/red/minus_alt_16x16.png" CommandName="Eliminar" CommandArgument='<%#Eval("OrdenTransporteId").ToString() %>' ></asp:ImageButton>   
			</ItemTemplate>
		</asp:TemplateField>
	</Columns>
</asp:GridView>


Funcion de commandArgument

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
protected void gvPre_RowCommand(object sender, GridViewCommandEventArgs e)
{
	if (e.CommandName == "Eliminar")
	{
		//  AlertaAjax(e.CommandArgument.ToString());
 
		CLS.IN.InPreEdp entrada = new CLS.IN.InPreEdp();
		CLS.NEG.PreEdp funciones = new CLS.NEG.PreEdp();
		CLS.OUT.OutPreEdp salida = new CLS.OUT.OutPreEdp();
 
		entrada.OrdenTransporteId = e.CommandArgument.ToString();
		entrada.RutCliente = ListBox.Rut;
 
		salida = funciones.delPreEdpDetalle(entrada);
 
 
		DataTable dt = new DataTable();
		dt.Columns.Add("OrdenTransporteId");
		dt.Columns.Add("OtAlerce");
 
 
 
		foreach (GridViewRow row in GvOt.Rows)
		{
			DataRow dr = dt.NewRow();
			dr["OrdenTransporteId"] = row.Cells[0].Text;
			dr["OtAlerce"] = row.Cells[1].Text;
			dt.Rows.Add(dr);
			dt.AcceptChanges();
 
		}
 
 
		DataTable dtd = new DataTable();
		dtd.Columns.Add("OrdenTransporteId");
		dtd.Columns.Add("OtAlerce");
 
 
		foreach (GridViewRow row in gvPre.Rows)
		{
			if (row.Cells[0].Text != entrada.OrdenTransporteId)
			{
				DataRow drd = dtd.NewRow();
				drd["OrdenTransporteId"] = row.Cells[0].Text;
				drd["OtAlerce"] = row.Cells[1].Text;
				dtd.Rows.Add(drd);
				dtd.AcceptChanges();
 
			}
			else
			{
				DataRow dr = dt.NewRow();
				dr["OrdenTransporteId"] = row.Cells[0].Text;
				dr["OtAlerce"] = row.Cells[1].Text;
				dt.Rows.Add(dr);
				dt.AcceptChanges();
 
			}
 
		}
		GvOt.DataSource = dt;
		GvOt.DataBind();
 
		gvPre.DataSource = dtd;
		gvPre.DataBind();
	}
}


De antemano muchas gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder