protected void Search_Click(object sender, EventArgs e) { string where = ""; string LinkType = txtLinkType.Value.Trim(); string Status = this.DropStatus.SelectedValue; if (!string.IsNullOrEmpty(LinkType)) { LinkType = Tz888.Common.Utility.PageValidate.HtmlEncode(LinkType); if (filterSql(LinkType)) { LinkType = ""; } } if (!string.IsNullOrEmpty(LinkType)) { where = "LinkName='" + LinkType + "' and "; } if (Status != "-1") { where = where + "CheckId=" + Status + " and "; } if (where.Length > 0) { where = where.Substring(0, where.LastIndexOf("and")).Trim(); } dataBind(where); }
public void LoadLinkType() { try { Tz888.BLL.Link.LinkTypeTab LinkType = new Tz888.BLL.Link.LinkTypeTab(); DropLinkType.DataSource = LinkType.GetLinkTypeList(); DropLinkType.DataTextField = "LinkName"; DropLinkType.DataValueField = "LinkId"; DropLinkType.DataBind(); ListItem item = new ListItem(); item.Text = "-请选择-"; item.Value = "-1"; DropLinkType.Items.Insert(0, item); } catch (Exception ex) { throw new Exception(ex.Message); } }