I have a table in a repeater. In this table I have a Button and a LinkButton. It turns out that I need to pick which click event was fired from the button or from the linkbutton. I tried to do an if, but failed to be incompatible the button and the linkbutton. If I do this, I will always have the Text property of the button and the 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);
}
}
In my OnClick event of the button I have nothing. What I want is that when I click 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's a new task for me to do and as I get a click pou something to say that the button clicked is one and not the other. The part of btnConsulting is what I'm trying to do.