private void LoadGrid() { DataSet suppliers = Dal.LoadCategory(); GridView1.DataSource = suppliers.Tables[0]; GridView1.DataBind(); }
private void LoadCategory() { clsCategory Dal = new clsCategory(); DataSet Manuf = Dal.LoadCategory(); ddlCategory.DataTextField = "CategoryName"; ddlCategory.DataValueField = "CategoryId"; ddlCategory.DataSource = Manuf.Tables[0]; ddlCategory.DataBind(); ddlCategory.Items.Insert(0, new ListItem("--Select Category--", string.Empty)); }
private void LoadCategory() { clsCategory Dal = new clsCategory(); DataSet dsCategory = Dal.LoadCategory(); string htmlCategory = string.Empty; if (dsCategory != null && dsCategory.Tables.Count > 0 && dsCategory.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsCategory.Tables[0].Rows) { htmlCategory += "<li><a href='SearchMedicine.aspx?CategoryId=" + int.Parse("0" + dr["CategoryId"]) + "'>" + Convert.ToString(dr["CategoryName"]) + "</a></li>"; } ltrlCategory.Text = htmlCategory; } else { htmlCategory = "<li><a href='#'>No Category Found</a></li>"; ltrlCategory.Text = htmlCategory; } }