Header

Tuesday, 27 March 2012

How to Populat a Drop-Down with List Data in Sharepoint


Some time we need to bind some column of SharePoint list to one Drop-Down.
When i had started working on SharePoint i used to bind Drop-Down with list through For Each loop, so it was time consuming and not good in programming.
Now i use simple and easy code without any loop.


       Dim ds As New DataSet()
        Dim mySite As SPSite = SPContext.Current.Site
        Dim myWeb As SPWeb = mySite.OpenWeb()
        Dim list As SPList = myWeb.Lists("ListName")
        Dim DTable_List As DataTable = list.Items.GetDataTable()
        DTable_List.TableName = "Table1"
        ds.Tables.Add(DTable_List)
        DropDownBGroup.DataSource = ds.Tables("Table1")
        DropDownBGroup.DataTextField = "FieldName"
        DropDownBGroup.DataValueField = "FieldName"
        DropDownBGroup.DataBind()
        DropDownBGroup.SelectedIndex = 0



I hope this will helpful for you,

Thanks and Regards

How to get attached file url in sharepoint

This post has moved to this link

http://unique2026.blogspot.in/2013/08/how-to-get-attached-file-url-in_7.html







Monday, 12 March 2012

Cookies Based Authentication