I have 3 different buttons but I want that when clicking on any of them, the text that this brings is saved in a variable by means of the object sender
One of the buttons would be, for example, the following:
<asp:Button ID="Btn_eng" class="btn btn-primary" runat="server" Text="ENG" OnClientClick="showAndHide();" Width="185px" OnClick="Unnamed1_Click"></asp:Button>
and this is the event that occurs when you click:
protected void Unnamed1_Click(object sender, EventArgs e)
{
Button Btn_clic = (Button)sender;
var name = Btn_clic;
List.ListUsers listArea = new List.ListUsers();
List<Data.Area> Area = listArea.AreaList();
List<Data.Area> ListOfEquiposFCHOk = Area.Where(x => x.AREA = name && x.STANDBY == 0).ToList();
List<Button> Botones = new List<Button>();
var TeamFCH = ListOfEquiposFCHOk.Select(x => x.TEAM).Distinct().ToList();
foreach (var team in TeamFCH)
{
Button newButton = new Button();
newButton.Text = team;
Botones.Add(newButton);
}
Panel1.Controls.Add(Botones[0]);
}
I already managed to save it in the name variable but when I wanted to concatenate it to the linq query it would not accept it, and it would throw the red line under it.
Error 150 Operator '& &' can not be applied to operands of type 'System.Web.UI.WebControls.Button' and 'bool'