Here are the steps
Open SharePoint team site.
Create a new list For example: “
Authors”.
Create a custom column named “
Name of the author”.
Now add some information into the list.
Open Microsoft Visual Studio.
Create a new SharePoint 2013 Empty Project.
Add a new visual Webpart into it.
ASPX Code: - <asp:DropDownList ID="drpbind" runat="server" AutoPostBack="true">
- </asp:DropDownList>
ADD namespaces - Using microsoft.SharePoint;
CS Code:- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- using(SPSite site = new SPSite("http://winserver/sites/customsite/"))
- {
- using(SPWeb web = site.OpenWeb())
- {
- SPList list = web.Lists["Authors"];
- drpbind.DataSource = list.Items;
- drpbind.DataValueField = "Title";
- drpbind.DataTextField = "Title";
- drpbind.DataBind();
- }
- }
- }
- }
In the above code bind the title column.
Final result: