Advertisement
In this article we can able to see how to Populate values in to drop down from Data Base using asp.net
public void loadDdlRoles()
{
string constr = ConfigurationManager.ConnectionStrings["DConnectionString"].ToString(); // connection string
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand com = new SqlCommand("select *from dbo.aspnet_Roles", con); // table name
SqlDataAdapter da = new SqlDataAdapter(com);
DataSet ds = new DataSet();
da.Fill(ds); // fill dataset
DdlRoles.DataValueField = ds.Tables[0].Columns["RoleName"].ToString(); // to retrive specific textfield name
DdlRoles.DataSource = ds.Tables[0]; //assigning datasource to the dropdownlist
DdlRoles.DataBind(); //binding dropdownlist
}
Don't Forget to call that method in Page load protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
loadDdlRoles();
}
}
Keep always Smile:) 
D7CE1C733F
ReplyDeletehacker bulma
hacker kiralama
tütün dünyası
hacker bul
hacker kirala
ReplyDeleteIn the realm of advanced printing techniques, the technology known as Direct-to-film printing has gained significant popularity due to its high-quality results and efficiency. This method allows for detailed and vibrant designs to be transferred directly onto various surfaces, making it ideal for custom apparel and promotional items. As industries continue to evolve, Direct-to-film printing offers a versatile solution that combines speed with precision. Its growing adoption highlights its importance in modern manufacturing processes.