Tuesday, November 30, 2021

Drop down list asp.net C# from database

ddlPositions.SelectedValue = dt.Rows[0]["PostHeld"].ToString();



ddlTypeOfCourt.SelectedValue= courtApplicationDatesDTO.CourtTypeId.ToString();



selectedvalue will work


selecteditem.value will not work on above


but when we set the value to object from drop down selecteditem.value will work as below


courtApplicationDatesDTO.CourtTypeId =  Convert.ToInt32(ddlTypeOfCourt.SelectedItem.Value);

 https://www.c-sharpcorner.com/UploadFile/0c1bb2/fill-Asp-Net-dropdown-list-from-database-table-using-Asp-Net/


https://www.aspsnippets.com/Articles/Bind-Populate-ASPNet-DropDownList-using-DataTable-DataSet-in-C-and-VBNet.aspx

No comments:

Post a Comment