.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to populate a ComboBox from a list

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :SharePoint

I have two basic lists (Alist, and Blist).

One field from Alist is a textfiled of selection type (ComboBox). I want to fill this combo with the content of Blist.

When I create a field I can chose to populate the ComboBox from an static list, but I don't know how to bind to a SharePoint List.

It is possible to do in easy way?

Thanks for your time!

Un saludo! Juan Segura

View Complete Post

More Related Resource Links

problem...i want a list item to populate all data in gridview!!!


i have a dropdownbox and a gridview

what I want is to have a list item which populates all data in a gridview.

I have tried using list item selected value=0 but to no avail.

what is the easiest way to achieve this?

Populate combobox

i have 2 combo, cboCountry and cboCity in file default.aspx using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; using System.Data.SqlClient; using System.Configuration;   protected void cboCountry_TextChanged(object sender, EventArgs e)         {             SqlCommand cmd = new SqlCommand("SELECT * FROM [Country] where country='" + cboCountry.SelectedValue + "'", new SqlConnection(ConfigurationManager.AppSettings["ConString"]));             cmd.Connection.Open();   <==== ERROR HERE             SqlDataReader ddlValues;             ddlValues = cmd.ExecuteReader();             cboCity.DataSource = ddlValues;             cboCity.DataValueField = "City";             cboCity.DataTextField = "City";             cboCity.DataBind(); &nb

ComboBox Display list does not update if a datasource is a boxed string

I have a combo box databound to a BindingSource bound to a List<Holder> it has Holder.Name as its display value. I also have a text box bound to Holder.Name but if I change the text in the text box it will not change what is displayed in the combo box. Changing selected items and changing back will show the updated text in the text box but will still have the old value displayed in the combo box. How do I make the item in the combo box update? namespace Sandbox_Form { public partial class Form1 : Form { public Form1() { InitializeComponent(); lstBroken = new List<Holder>(); lstBroken.Add(new Holder("test1")); lstBroken.Add(new Holder("test2")); bsBroken = new BindingSource(lstBroken, null); cmbBroken.DataSource = bsBroken; cmbBroken.DisplayMember = "Name"; txtBroken.DataBindings.Add("Text", bsBroken, "Name"); lstWorks = new List<string>(); lstWorks.Add("test3"); lstWorks.Add("test4"); bsWorks = new BindingSource(lstWorks, null); cmbWorks.DataSource = bsWorks; txtWorks.DataBindings.Add("Text", bsWorks, null); } } public class Holder { public Holder(string name) { Name = name; } public string Name { get; set; } } }

open faster huge list of combobox

Hi All. In detail form I have combobox with some thousand rows. I preloaded collection view of this list in parent form and make equal collection view of parent form to collection view detail form for combobox. But still need wait approximately 5 second when list will open. How to do that list of combobox will open faster. Thanks.

Fetch data from one list and populate another list


How to fetch the details from one list & show it in an another list in Sharepoint 2010.


List #1 : Total Project/Resource List

   Resources       Projects
         Resource1 Project1,project2
  REsource2 Project1,project3

List #2 : Resources Per project


How to fetch details from List1 based on projects (Projects (Multiline text) are comma seperted data)


populate combobox from SQL DB


I could'nt find any pages that populate Combo box values faster.........in C#


This code snippet in C# pulls data from a DataBase : Modal, Table : Tbl_Area using a stored procedure : SelectDistinctStates_sp

SelectDistinctStates_sp contains :


CREATE   PROCEDURE SelectDistinctStates_sp 


SELECT AreaName as AreaName FROM Tbl_Area





using System;

using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

using System.Data.SqlClient;

using System.Data.OleDb;



namespace Shyam_Test


/// <summary>

/// Summary description for Form1.

/// </summary>

public class Form1 : System.Windows.Forms.Form


private System.Windows.Forms.Button button1;

private System.Windows.Forms.TextBox textBox1;

private System.Windows.Forms.ComboBox cboEmployerState;

/// <summary>

/// Required designer variable.

/// </summary>

private System.ComponentModel.Container components = null;


public Form1()

Using a sharepoint list to populate a form then capture user input


Hi.  New to this forum but looks like a great resource.  I am using MOSS2007, Infopath 2007 and Nintex workflow 2007.

I have a form that will act as a report for each of the operational sites in my company.  Each site receives freight movements on a daily basis and these are on a schedule; I am trying to record the variances to that schedule.  What I have attempted to do is the following:

  • Create a sharepoint list that contains each of the scheduled arrivals per site.
  • Connect to this list in Infopath as a secodary data source.
  • Drop this in to the form as a repeating table.
  • Filter the list of arrivals by using the conditional formatting control on the section, bound to a drop-list where the user specifies the facility/site.

What I am trying to do is present these arrivals and have the user enter an "actual" arrival time next to each, then store the results on submit.  I therefore need to know two things, 1) how to capture an "actual" value for each row in the repeating table (at the moment this is pulled in as an empty field from the list) and 2) how to store the data on submit so it is there when the form is re-opened.

I hope this makes sense, happy to give you any further information that may be required.

Thanks, Matt

Rules on Drop Down List to populate another text field


I have a last name field in infopath 2007 web form with a drop down on sharepoint list. When they select a certain last name, I want it to populate the primary dept field on form. I set up a rule on the last name to set the primary dept field = to the primary dept field on datasource when the last name field is not blank. What I am getting is the primary dept value for the first record in the datasource. I am trying to understand what record I have. Do I need to do another query back to the datasource with the last name field to have the correct entries available to populate the dept field with? Please give me some clue. I am a programmer but not grasping the interplay between the datasource and the form and noit finding what I need in numerous google searches.



Search data from sharepoint list and populate repeating table (Seach text should be entre in first f


Hi All,

I am newbie to infopath.

I have assignment to search data from sharepoint list and display it to repeating table. Below is the case in detail.

i. User enter search text in first textbox of repeating table.

ii. After text enter you will Enter or click tab button.

iii. As user press Tab /Enter, the other textboxes of repeating table will populate with data automatically.

iv. If searched data rows are more then one, then dynamically add new row's in repeating table and  show searched data.

I am working at offical assignment and it's deadline is very tough. i had made extensive search at google and msdn forum but unable to accomplish. I would appreciate and thanks is some provide me solution in form to a small infopath application and code snippet.




combobox list problem


Hi All.

I binded UserComboBox to datadet

Private Sub SetSvc_No(ByVal Svc_No As String)
  CtrlUserTableAdapter.FillBy(CtrlSvcDataSet.User, 0, Me.SvcNoTextBox.Text)
  Me.cvUser = CollectionViewSource.GetDefaultView(CtrlSvcDataSet.User)

  If Me.cvUser.Count >= 2 Then
    Me.UserComboBox.ItemsSource = Me.cvUser
    Me.UserComboBox.SelectedIndex = 1
    Me.UserComboBox.ItemsSource = Me.cvUser
  End If
End Sub

Private Sub SvcNoTextBox_LostFocus(ByVal sender As Object

dropdown list wont populate values from database


Hello everyone i need help. Ive been having this problem for almost  3 days now. dropdown list won't populate from database

Below is the code i am using:

<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PhotoAlbum.aspx.vb" Inherits="PhotoAlbum" %>

<asp:SqlDataSource ID="categoriesDataSource" runat="server"  
<%$ ConnectionStrings:ConnectionString %>"  
    SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] WHERE ([UserId] = @UserId) ORDER BY [Name]"> 
<asp:QueryStringParameter Name="UserId" QueryStringField="ID"/> 

Populate in dropdown list control


Hello need some help on this one.  I am using ASP.NET with C# and Oracle database. I am trying to return some values from my select statement to fill my dropdown list control. I am designing this in a 3 tier architecture.  Here is my codes.  I am getting an error which states "Object reference not set to an instance of an object." I am returning the field name "NAME" to be filled in my dropdown control.  What I am doing wrong?


List.cs file code

public static string _GetClientList()


string clients = string.Empty;int SessUserID =

Populate list of values for runtime parameters. SQL server 2008



I have created a Trial balance report using report builder and have setup runtime filter parameters for GL description. I would like to populate  runtime filter parameter with values from the GL master table (GL00100) enableing users to select  values from the drop down list.

How  can i acheive this task? 





code SQL to populate gridview with multiple random list box selections, How to


I could use some help in coding a query.

I have a list box that allows for multiple selections (holding down the control key) the selection quantity is basically unlimited, but realistically should never be more than 50 to 100 items from the listing of about 3000 items.

I need to collect the list of selected items from the drop down list and retrieve each of their full records from the item master and populate a gridview.

Any help would be greatly appreciated.


Thanks again,



How to dynamically populate a ComboBox through client-side Javascript?


I'm using the ComboBox control from the May 2009 release of the ASP.NET Ajax Control Toolkit.

I'd like to try and populate this ComboBox's list of options dynamically from the client-side Javascript (because I'm retrieving the data from the server based on the user's selection in another drop-down box).  Can anyone suggest how to accomplish this?  I tried this:


                var teacherComboBox = document.getElementById("ctl00_ContentPlaceHolder1_TeacherComboBox_OptionList");
                teacherComboBox.innerHTML = "";
                for (var i = 0 ; i < result.length ; i++) {
                    var listitem = document.createElement("li");
                    listitem.innerHTML = result[i];


And it didn't work.  The ComboBox just ended up with just one item (the first one) in the list, instead of all of them.

Any help appreciated.


On excel sheet upload read the workbook and populate data to sharepoint list


Requirement in my current project:
In a document library when I upload an excel sheet, a specific workbook has to be read and the contents have to be uploaded to a sharepoint custom list.
The approach followed was create an event receiver and register as a feature. Following is the code for event receiver.

public override void ItemAdded(SPItemEventProperties properties)
            var list = getSPList("{150301BF-D0BD-452C-90D7-2D6CD082A247}");          
            SPListItem doc = properties.ListItem;
            doc["Msg"] = "items deleted from req list";
            string excelname=doc.File.Name;

UpdateListItems to populate multivalue in the lookup field of the list



I want to populate a column which is of type lookup.I used the web service provided by the sharepoint. This column should contain multiple values. For this I used the format ID;#lookupvalue.But the column is not getting populated.

The elbatch.InnerXML looks like IS

"<Method ID=\"2\" Cmd=\"New\"><Field Name=\"RFPRequirement\" Type=\"Lookup\">623</Field><Field Name=\"Product\" Type=\"Lookup\">232</Field><Field Name=\"Offering\" Type=\"Lookup\">49</Field><Field Name=\"Services\" Type=\"Lookup\">212;#B: Event Management Service;#215;#(B) Incident Management Service;#217;#(B) Proactive Problem Management Service</Field></Method>"

Also I tried separating only the IDs by ;#.The elbatch.innerxml is

"<Method ID=\"2\" Cmd=\&q

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend