protected void txtBusquedaFormulario_OnDataSourceSelect(object sender, SearchBoxDataSourceSelectEventArgs e) { try { ObjectDataSource source = (ObjectDataSource)e.DataSource; RadSearchBox searchBox = (RadSearchBox)sender; if (e.SelectedContextItem.Key != IdAreaSeleccionada.ToString()) { source.SelectParameters["idUsuarioSolicita"].DefaultValue = Session["IdUsuarioSolicita"].ToString(); source.SelectParameters["idUsuarioLevanta"].DefaultValue = ((Usuario)Session["UserData"]).Id.ToString(); source.SelectParameters["idArea"].DefaultValue = e.SelectedContextItem.Key; source.SelectParameters["keys"].DefaultValue = e.FilterString; source.DataBind(); } } catch (Exception ex) { if (_lstError == null) { _lstError = new List <string>(); } _lstError.Add(ex.Message); Alerta = _lstError; } }
protected void radSearchawbIssuance_DataSourceSelect(object sender, SearchBoxDataSourceSelectEventArgs e) { SqlDataSource source = (SqlDataSource)e.DataSource; RadSearchBox searchBox = (RadSearchBox)sender; // string likeCondition = string.Format("'{0}' + @filterString + '%'", searchBox.Filter == SearchBoxFilter.Contains ? "%" : ""); string likeCondition = "Arjay De Torres Tabangay"; string countCondition = e.ShowAllResults ? " " : " TOP " + searchBox.MaxResultCount + 1; string condition = ""; if (e.SelectedContextItem != null) { condition = string.Format("{0}", e.SelectedContextItem.Key); } //source.SelectCommand = string.Format("SELECT {0} * FROM [AwbIssuance] WHERE {1}", countCondition, likeCondition); source.SelectCommand = string.Format("SELECT {0} * FROM (SELECT awb.*, bco.BranchCorpOfficeName, ru.RevenueUnitName, emp.FirstName + ' ' + emp.MiddleName + ' ' + emp.LastName AS Name from AwbIssuance awb LEFT join BranchCorpOffice bco on awb.BCOid = bco.BranchCorpOfficeId LEFT join RevenueUnit ru on awb.RevenueUnitId = ru.RevenueUnitId LEFT join Employee emp on awb.IssuedToId = emp.EmployeeId where awb.RecordStatus = 1 and [bco.BranchCorpOfficeId] = '{1}'') AS inner_table WHERE Name LIKE {2}", countCondition, condition, likeCondition); source.SelectParameters.Add("filterString", e.FilterString.Replace("%", "[%]").Replace("_", "[_]")); }
protected void author_pub_DataSourceSelect(object sender, SearchBoxDataSourceSelectEventArgs e) { RadSearchBox searchBox = (RadSearchBox)sender; searchBox.DataSource = lll.Where(o => o.Name.Contains(e.FilterString)).ToList(); searchBox.DataBind(); }
protected void publisher_DataSourceSelect(object sender, SearchBoxDataSourceSelectEventArgs e) { var x = e.FilterString.ToLower(); publisher.DataSource = HomoryContext.Value.User.Where(o => o.State < State.审核).ToList().Where(o => o.RealName.ToLower().Contains(x) || o.PinYin.ToLower().Contains(x)).Select(o => new RUO { Id = o.Id, Name = o.RealName, PinYin = o.PinYin }).ToList(); publisher.DataBind(); }