Thursday, February 9, 2012

Binding data to Dropdown list In asp.net

1.get the data from data base and we can attach data to dropdown as follows 2.Inserting the "select" Ist Item to the Dropdownlist
Here DataTextField and DataValueField taken from the database attached to dropdown list
ddlcategory.DataSource = objCategoryBLL.GetAllCategories().Tables[0];
ddlcategory.DataTextField = "CatgName";
ddlcategory.DataValueField = "CatgId";
ddlcategory.DataBind();
ddlcategory.Items.Insert(0, "Select");

No comments:

Post a Comment