Skip to main content
added 8 characters in body
Source Link
Goshky
  • 2.1k
  • 4
  • 25
  • 49

I Have list "Department" and takes the data from it. I want the first value in DropDownMenu to be "Not a dept"...


enter image description here


protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            using (SPSite site = new SPSite("http://sf-spsdev04/sites/gkk92sitecolection/"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.Lists["Departments"];
                    dropDep.DataSource = list.Items;
                    dropDep.DataValueField = "Title";
                    dropDep.DataTextField = "Title";
                    dropDep.DataBind();
                }
            }
        }
    }

I Have list "Department" and takes the data from it. I want the first value in DropDownMenu to be "Not a dept"...


enter image description here


protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            using (SPSite site = new SPSite("http://sf-spsdev04/sites/gkk92/"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.Lists["Departments"];
                    dropDep.DataSource = list.Items;
                    dropDep.DataValueField = "Title";
                    dropDep.DataTextField = "Title";
                    dropDep.DataBind();
                }
            }
        }
    }

I Have list "Department" and takes the data from it. I want the first value in DropDownMenu to be "Not a dept"...


enter image description here


protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            using (SPSite site = new SPSite("http://sf-spsdev04/sites/sitecolection/"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.Lists["Departments"];
                    dropDep.DataSource = list.Items;
                    dropDep.DataValueField = "Title";
                    dropDep.DataTextField = "Title";
                    dropDep.DataBind();
                }
            }
        }
    }
edited title
Link
Goshky
  • 2.1k
  • 4
  • 25
  • 49

SharePoint - How to set nulldefault value in DropDownMenu which takes data in SPList?

Source Link
Goshky
  • 2.1k
  • 4
  • 25
  • 49

SharePoint - How to set null value in DropDownMenu which takes data in SPList?

I Have list "Department" and takes the data from it. I want the first value in DropDownMenu to be "Not a dept"...


enter image description here


protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            using (SPSite site = new SPSite("http://sf-spsdev04/sites/gkk92/"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.Lists["Departments"];
                    dropDep.DataSource = list.Items;
                    dropDep.DataValueField = "Title";
                    dropDep.DataTextField = "Title";
                    dropDep.DataBind();
                }
            }
        }
    }