Hi, I´m new asp.net developer and working with telerik controls, in my app I have 3 textboxes, the first one is for ID of customers, the second is for name and the third one is for last name. I use this textboxes to search custumers and populate them in a radGrid when a button is pressed, now the searching only works with only one textbox, I mean, if I put the ID in the Id textbox I get as reseult the customer corresponding to that ID, if I put the name it shows me all the customers that matches with the name, and is the same case for the last name, but if I put both name and last name I only get the results of the last textbox I fill, How can I make the search with both values, the name and last name?
Here is the code that I implement when clicking the search button.
Hope you could help me.
Here is the code that I implement when clicking the search button.
Hope you could help me.
protected void btnBuscar_Click(object sender, EventArgs e)
{
if (rdTxtExp.Text == "" && rdTxtApat.Text == "" && rdTxtAmat.Text == "" && rdTxtNom.Text == "")
{
Alerta("Captura al menos un criterio de busqueda");
}
else
{
BuscaSolicitanteGrid();
}
}
private void BuscaSolicitanteGrid()
{
try
{
var bdInstContext = new BD_INSTEntities();
var empleados = from emp in bdInstContext.Empleados
where emp.exp_emp == rdTxtExp.Value
select emp;
rgSolic.DataSource = empleados;
rgSolic.Rebind();
if (rdTxtNom.Text != "")
{
var bdInstContextNom = new BD_INSTEntities();
var empleadoNom = bdInstContextNom.Empleados.Where("it.nombre_emp = '" + rdTxtNom.Text + "'");
//var empleadoNom = from emp in bdInstContextNom.Empleados
// where emp.nombre_emp == rdTxtNom.Text
// select emp;
rgSolic.DataSource = empleadoNom;
rgSolic.Rebind();
}
if (rdTxtApat.Text != "")
{
var bdInstContextApat = new BD_INSTEntities();
var empleadoApat = from emp in bdInstContextApat.Empleados
where emp.paterno_emp == rdTxtApat.Text
select emp;
rgSolic.DataSource = empleadoApat;
rgSolic.Rebind();
}
if (rdTxtAmat.Text != "")
{
var bdInstContextAmat = new BD_INSTEntities();
var empleadosAmat = from emp in bdInstContextAmat.Empleados
where emp.materno_emp == rdTxtAmat.Text
select emp;
rgSolic.DataSource = empleadosAmat;
rgSolic.Rebind();
}
}