0
I have a table in a Repeater. In this table I have a Button and a Linkbutton. It turns out I need to pick up which click event was fired from the button or the linkbutton. I tried to make an if, but the button and linkbutton were incompatible. If I do this, I will always have the Text property on the button and if will never work:
var btnConsultar = (Button)e.Item.FindControl("btnConsultarProcessos");
This is my Itemcommand
protected void rptGerenciaProcessos_ItemCommand(object source, RepeaterCommandEventArgs e)
{
//Declarações
HiddenField vhdfCdProcesso = null;
HiddenField vhdfCdAnalise = null;
HiddenField vhdfCdUsuario = null;
try
{
//Instâncias e Inicializalções
vhdfCdProcesso = (HiddenField)e.Item.FindControl("hdfCdProcesso");
vhdfCdAnalise = (HiddenField)e.Item.FindControl("hdfCdAnalise");
vhdfCdUsuario = (HiddenField)e.Item.FindControl("hdfCdUsuario");
var btnConsultar = (Button)e.Item.FindControl("btnConsultarProcessos");
//Desenvolvimento
if (vhdfCdProcesso != null)
hdfCdProcessoPriozar.Value = vhdfCdProcesso.Value;
else
hdfCdProcessoPriozar.Value = string.Empty;
if (vhdfCdAnalise != null)
if (vhdfCdAnalise.Value != string.Empty)
hdfCdAnalisePriorizar.Value = vhdfCdAnalise.Value;
else
hdfCdAnalisePriorizar.Value = string.Empty;
else
hdfCdAnalisePriorizar.Value = string.Empty;
if (vhdfCdUsuario != null)
if (vhdfCdUsuario.Value != string.Empty)
listaUsuariosDropDownList.SelectedValue = vhdfCdUsuario.Value;
pnlPriorizar.Visible = true;
}
catch (Exception Ex)
{
Mensagem = (wucMensagens)Page.Master.FindControl("wucMasterMensagens");
Mensagem.ExibirMensagem(wucMensagens.TipoAlerta.Erro, Ex.Source, Ex.Message, Ex.StackTrace);
}
}
At my Onclick Button event I have nothing. What I want is that when I click on the button it does something and when I click on the linkbutton it does something else. The linkbutton is working. The button is that it is a new task for me to do and as I get a click I something like this to say that the button clicked is one and not the other. The btnConsult part is what I’m trying to do.