.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

Rules on Drop Down List to populate another text field

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :SharePoint

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.



View Complete Post

More Related Resource Links

FormView Text Field Being Set by A Drop Down List


Hello, I have a FormView which is used to insert a record into a database.  Outside of this formview i have a drop down list, I want to grab the value from that drop down list and set one of the text fields within the formview to it's currently selected value.  I've tried the following code, but the dynamic categorytextbox line is what seems to not be working.

                    <asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="True" 
DataSourceID="SqlDataSourceCategory" DataTextField="CategoryName"
DataValueField="CategoryID" Width="200px">

                            <asp:TextBox ID="CategoryIDTextBox" runat="server" 
Text='<%# Bind("CategoryID") %>' Visible="False" />

        protected void FormView1_DataBound(object sender, EventArgs e)
dynamic varCategory = ddlCategory.SelectedValue;
dynamic categoryTextBox = FormView1.FindControl("CategoryIDText

How to read a column of a sharepoint list to a text string field of infopath form?

My infopath form used to read these email addresses from a web service and web.config file. Now i would like to get these user email addresses from a contact list in a sharepoint server. I am trying to do this without writing any codes. Here is what i have done so far: 1. Adding a new "data connection to receive data from SharePoint library or List" where i selected Email Address column of the contact list. 2. I added a new Text Field and define a new rule with "Query using a data connection" defined above. When i try to access the newly created Text field above it always return empty as if the Query attached to it did not executed at all. What did i do wrong? Is there a better way? Thank you in advance for your help.

How to get selected text of a drop down list in MVC?

I aggressively googled around, but could not find the information I am looking for.  I know how to populate a dropdownlist using my view model and Html.DropDownListFor helper method.Suppose the drop down list contains U.S. stateId and stateName key value pairs.  Suppose my ViewModel looks likepublic class MyViewModel{      public IList<State> States {get; set;}      public int SelectedStateId {get; set; }}public class State{     public int StateId {get; set; }     public string StateName {get; set; }}Now, in my controller's action method:[HttpPost]public ViewResult Index(MyViewModel  myViewModel){     // This following line seems to work fine, myViewModel automatically      // picks up the selected item of the drop down list.  How does this work?      // Is this the so-called model binding?      int selectedStateId = myViewModel.SelectedStateId;      // But, then, how do I get the selected state name?     string stateName = ??????????????     ... ... }Do I have to change my implementation of my view model?  In any case, how to get the selected item text of the drop down list?  Any hint?  Thanks a lot.

Display each new line of a sharepoint mutliline text field as choice in drop down box.

The question pretty much says it all. I have a lot of data I need to represent, and this would be the best way to do it. I have a multiline text field in sharepoint, where each line has a choice that should be a seperate choice in a text box. How do I do this? I have the data connection set up, and I would be fine with adding some sort of tag after each line, if that would make it so infopath can somehow parse out those tags, and interpret each "chunk" as a choice. Thanks in advance for your help.

Drop down list with text and dates


Could someone help me with this problem?

I have a dropdownlist that is bound to an objectDataSource, and the dropdownlist is populated with dates, from records obtained in the database.

But I need to have the default value of the dropdownlist as text saying PLEASE SELECT, however the populated list are dates.

I tried adding appendbounditems to true and manually adding a list item as PLEASE SELECT but it says it is not of date type.

Is there any way I can have a dropdownlist with the first one text saying PLEASE SELECT, and the remaining collection of dates obtained from the database (objectdatasource / sql query)

P.S.  Know of a way to format the dates  to mm-dd-yyyy ? In the SQL Database, it includes times such as 12:00 pm which I really do not need

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.




Required Field Validator and drop down list


 I am trying to get the required field validator to work. I have given it an initial value of the first index value in the dropdown list. I is just not working. Will my contrrols residing on a View of a Multiview control effect anything. I am using all drop down lists?

Drop-Down List Filled with Checkboxed 'Choice' Field?


SP Lists allow a 'choice' field.  You can opt to make the Choices a manually typed in list where the user simply 'checks' off one or more options.

Within InfoPath, I want to be able to show ALL of the checked-off choices in a drop-down menu.  Can't do it! :(

Any suggestions?


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

Populate Drop-Down list box from Active Directory Data Connection?


I recently created a data connection to my active directory, so that certain fields can be automatically populated given the user who is filling in the form.

However, I would like to have a drop-down box that is populated from Active Directory (i.e. the user of the form can select another AD member), the result of which will then populate other fields (with information such as Manager, Email Address, etc).

So, 2 questions:

  1. How do I get a drop-down list to populate with the members of AD?
  2. How do I get the result of this selection to populate other fields?
Cheers again - you guys are great!

how to capture text from text field and pass to input parameter of dataconnection added as rules in


Hi All,

I have a small application on infopath form published to Sharepoint form library.

I have a text field where i enter serial number to search.

And on rules of search button i added rule where i pass input text to input parameter of dataconnection.

This dataconnection is actually a web service which get details of serial number from SQL database

and then on another button "remove record" rule added where if data is there..which result from first button then delete record from form library and database and enter log details to SQL table ..these all steps writtern in try catch of a webservice.

My problem is:

1. when i enter text to search i need to click twice on search button to get data from SQL ..or i have to click on outside of text field (anywhere in form) to get the event changed and then to click to button to search.

2. when i click on "remove record" button i get error message as error in accessing datasource..

but when i check in preview its working fine


pls advise


-- Regards Sandeep

Can I populate a the drop-down list of a report parameter by custom code


Hi there,

I have a custom assembly that returns an Arraylist and I am wondering if I can populate the drop-down list of a particular parameter by this list. To me, it seems that I can either have static values for such a drop-down list or that I can query the items from a dataset. However, I do not see how I can populate the list using custom code.

Best wishes



InfoPath 2003 - Populate Data Field based on text field from secondary/different data source.


I have a form where the main fields are populated based on the results of a query field.
Ex, Main Data (SQL) Source: 

Fruit         Color
Apple       Red
Orange     Orange
Pear         Green
Banana     Yellow

Secondary Data Source (Sharepoint List)
Fruit         Code
Apple        1001
Orange     1002
Pear         1003
Banana     1004

What I would like to do is create form fields that will automatically populate based on the contents of the text field.
Ex,  (text field)   Please enter your fruit of choice:   [ Apple ]

(Field 2 - from main SQL data source)          The color of your fruit is [ RED ]

(Field 3 - from secondary Sharepoint List data source)  Your fruits code is  [ 1001 ]


Any suggestions would be greatly appreciated.

How to populate drop down list inside fromview using code?



I have formview to read US cities as following:

- I use label to read the values in <ItemTemplate>

- I use dropdown list to read values in <EditItemTemplate> and < InsertItemTemplate>

When the formview get loaded it’s read all values properly, but when I move to edit or insert mode the dropdown list give me this error: Object reference not set to an instance of an object

Could anyone help me with example of code (Note: I use the code to fill the dropdown list instead of SqlDataSource )

Thank you in advance,



Way of adding items in Drop Down List or List Box using Javascript

The article Way of adding items in Drop Down List or List Box using Javascript was added by raja.s on Sunday, June 06, 2010.

Hi,script type="text/javascript"> function AddItem(Text,Value) { // Create an Option object var opt = document.createElement("option"); // Add an Option object to Drop Down/List Box document.getElementById("DropDownList"

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?

How to use a drop down list to edit in the standard Edit.aspx with DD?


Hey All,

I'm brand new to Dynamic Data and to ASP.NET.  I've been able to fumble around and get the calendar extender up and running and a few other customization options implemented, but I can't seem to get this drop down list to work - even after reading tons of online info.  The good news is that my web page/application is VERY simple, so hopefully you guys can help me out.  I'm working in VB btw.

I have a list of road projects submitted to me by local governments.  One of the fields is SponsoringAgency, which has a limited number of possible entries (the names of member governments).  Thus, when they submit a new project, or edit an existing one, I want to limit the input into the field "SponsoringAgency." I'm trying to use a dropdownlist because I'm familiar with it from Access, but it may not be the best approach.  Imagine you just setup a brand new, standard DD website, how would you get this to work?

Methods tried and failed (probably because I don't understand them fully):

UIHint - The closest I can get with this is an error saying that since SponsoringAgency isn't a Foreign Key, I'm out of luck.

Creating a SponsoringAgency Table - In my data layer, I created a second table with a list of government names.  I then tried se

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