private void listbind() { this.LstZoneName.DataSource = B_ADZone.ADZone_GetAll(); this.LstZoneName.DataTextField = "ZoneName"; this.LstZoneName.DataValueField = "ZoneID"; this.LstZoneName.DataBind(); }
private void RepNodeBind() { string adname = this.ViewState["AdName"].ToString(); if (string.IsNullOrEmpty(adname)) { DataTable da = B_ADZone.ADZone_GetAll(); if (da.Rows.Count > 0) { this.nocontent.Style["display"] = "none"; this.GridView1.DataSource = da; GridView1.DataKeyNames = new string[] { "ZoneID" }; this.GridView1.DataBind(); this.GridView1.Visible = true; } else { this.nocontent.Style["display"] = ""; this.GridView1.Visible = false; } } else { DataTable da = B_ADZone.ADZone_ByCondition(" Where ZoneName like '%" + adname + "%'"); if (da.Rows.Count != 0) { this.nocontent.Style["display"] = "none"; this.GridView1.DataSource = da; GridView1.DataKeyNames = new string[] { "ZoneId" }; this.GridView1.DataBind(); this.GridView1.Visible = true; } else { this.nocontent.Style["display"] = ""; this.GridView1.Visible = false; } } }
public void DataBind(string key = "") { DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(Request.QueryString["type"])) { int type = DataConverter.CLng(Request.QueryString["type"]); dt = B_ADZone.ADZone_ByCondition(" Where ZoneType=" + type + " order by ZoneID desc"); } else { string adname = this.ViewState["AdName"].ToString(); if (string.IsNullOrEmpty(adname)) { dt = B_ADZone.ADZone_GetAll(); } else { dt = B_ADZone.ADZone_ByCondition(" Where ZoneName like @adname order by ZoneID desc", new SqlParameter[] { new SqlParameter("adname", "%" + adname + "%") }); } } Egv.DataSource = dt; Egv.DataBind(); }