.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 prepopulate information from sharepoint list to a web form

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

hi all,

i was wondering if there is a way to prepopulate sharepoint list item values into a webform fields if the loggin user's information is matched with the information in the list item.

what i have done is that i made a query function to determine if info is matched, and then i try to pull some infomation out from list item. this method works fine for printing these values to some labels on the form, however, it is not working for prepopulation, which happens in the page_load function.

here is my query code:

  1.   SPList IsExist;
  2.    IsExist = SPContext.Current.Web.Lists["TTCVIP"];   
  4.    SPQuery query = new SPQuery();      
  6.    query.Query = buildQuery();//search for first name = loggin name      
  8.    SPListItemCollection

    View Complete Post

More Related Resource Links

How to prepopulate information from sharepoint list to a web form



i was working on a registration form which requires user information and save it to the sharepoint list. i was wondering if im able to search on the list item according to user's login information, and prepopulate it if information is matched. i did the search part by using query, for example, the first name:

SPList IsExist;   

   IsExist = SPContext.Current.Web.Lists["TTCVIP"];

   SPQuery query = new SPQuery();   

   query.Query = buildQuery();//search for first name = loggin name   

   SPListItemCollection found = IsExist.GetItems(query);

   //if yes, prepopulate the form

   if (found.Count > 0)

//if no, prepopulate user information from profile manager 


i then want to pull the information out from the list and prepopulate to the form. after submit the form, there is button, so when user click submit, it will show the inforamtion he has input(also need to pull info from list), i did this part by using the following code:

public void readFromList()
       SPSite oSiteCollection = SPContext.Current.Site;
       SPList oList = oSiteCollection.AllWebs["/en/admin"].Lists["TTCVIP"];
       SPView oListView = oList.Views["All Items"];
       SPListItemCollection collectListItems = oList.GetItems(oListView);     

       foreach (SPListItem oListItem

Submit a aspx form to a sharepoint list?

Hi,I have a wizard control form in visual studio 2008.. I need to submit this form to a sharepoint list? Is this possible?thanks!

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.

create new custom list form in sharepoint designer and edit in browser

hi, i have created a new list using sharepoint designer 2007. now i inserted a custom list form to modify some field and add new ones. when i finished i will tight my new custom list to the custom form. what i want to know is. i see the status field in my new form. and i only want the status field to appear in the edit form for the one that has the permission to edit the status. then i tought of open the list in my browser and go to the list settings. but what i notice is i dont see my fields i have modified in sharepiont designer in the columns section i only see the ones from the existing list. my question is how can i hide the status field in the new item form that it only show in the edit form. and how do i get my new form in the column section so the end user can add more fields if they want without using sharepointdesigner thnx

Updating an InfoPath Form Library Template breaks preexisting SharePoint List Views

When updating an InfoPath template (e.g. adding a new field), any views I have created on the library lose their filters and sorting, as if the columns on which they were built no longer exist.  Has anyone else encountered this and, if so, is there a solution? V/r Noelle

How to prevent automatic update from sharepoint list on Infopath 2007 form

Hi there, I've got an Infopath 2007 form on MOSS 2007. I have a custom list in sharepoint and the infopath form has a data connection to that list to receive data. Is there any way to prevent automatic update on the values in the form that is received from the list. I'd like the new form to have updated info received from the list. However, the old/existing forms that were created should have the data that were available at the time when the form was created. Let me know if this is not clear and I'll try to explain more. Thanks,Pman http://www.pmansLab.com/

submit infopath 2003 form to a sharepoint list

hi, is it posible to add  an infopath 2003 form to a sharepoint list, not document library but a list. and can i create views from the infopath 2003 form?

Infopath Form Data submitting to Sharepoint 2010 List

Making a Client intake form that once submitted will send data to  a sharepoint 2010 List called contacts. Short Summary the form will have repeating fields and alot of information to submit. I have looked and read all over but I cannot find an easy step by step guild on how to submit the form data like that. Long Summary on the sharepoint site a button will open a form for adding a new client.  once the form has been filled out and the user hits submit sharepoint will then create a User File, in clients file, and take the data and put it into contacts list. I am trying to make use of Sharepoint as I would with access, meaning the more information I have on a client the easier it will be to mail merge letters, motions, basicly any file prepaired stuff. So once I have css designed forsharepoint to make it look the way I want then the forms should intergrate perfect

How to submit my form to Sharepoint Library as well as Sharepoint List with specific Fields only.

Hello ,   I have a Infopath form that contain 50 of fields. i want to submit those form into sharepoint library as well as Sharepoint Custom List(Specific Fields). Please suggest best practice to develop such a functionality.   Thank you.

Reg passing info from aspx page to New form.aspx page of list in sharepoint



Initially i have Newform.aspx in the list.In that when i am clicking an icon that is available in Rich Text Box Editor it is taking me to another aspx page.In that page i have custom web part with One Field Control to upload  and one Button to upload the files.Now my requirement is as soon as after uploading these file from web part i should display the file names in the Rich Text Box.Please share your ideas of capturing file names in the web part and getting those file names in the rich text box in the newform.aspx of the list please let me know

Thanks & Regards,


Add a New Item to a Custom Sharepoint List and Sharepoint Calendar from one Infopath form.


I am trying to create an infopath form for requesting time off.  Once the request is approved I want the form to add the event to a calendar on sharepoint.  I was able to do this using the article by S.Y.M. Wong-A-Ton at http://www.bizsupportonline.net/infopath2007/programmatically-add-item-sharepoint-calendar-infopath.htm.  But I want the form to also add an item to a custom list that has the employees available time off stored on it.  That way the form can automatically subtract the time entered on the infopath form from what is available on the custom list.  I was able to do this using another article by S.Y.M. Wong-A-Ton at  http://www.bizsupportonline.net/infopath2007/programmatically-add-rich-text-item-sharepoint-list-infopath.htm.  I can make both of these functions happen seperately but I need them to happen on the same Infopath form.  I am using Infopath and MOSS 2007.  I have tried to use 2 CAML receive data files and I treid to co

Infopath cannot generate a form template for the sharepoint list


Dear All,

For Sharepoint 2010, Infopath 2010

When I trying to login Infopath by link Customize Form that available in the List tool bar I found the following error:

Infopath cannot generate a form template for the sharepoint list

The SOAP response indicates that an error occurred on the server

Can anybody help me figure out what is causing this error?

How do I submit an attachment in an Infopath Form to a Sharepoint list?

I have already written code to submit my infopath data to my share point list, but now I need to find out how to submit an attachment to the same existing custom list in Share Point 2007.

sharepoint list form pages



i need to create custom form pages for sharepoint list with content type. The following code i wrote in FeatureReceiver class.

  Guid listId = web.Lists.Add("MyAnnouncements", "MyAnnouncements", SPListTemplateType.Announcements);
                        SPList lstAnnouncements = web.Lists[listId];

                        lstAnnouncements.ContentTypesEnabled = true;



                        foreach (SPContentType contentType in web.ContentTypes)

How to add a Repeating Table to Sharepoint Custom List (via Customize Form)



I have create a InfoPath Form Library, and I have a repeating table on the InfoPath form. Now I want to submit the same Templete to a SharePoint List(with the repeating table), is it possible?  



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

Sharepoint list NewFormUsr form page gives HTTP 404 error



We have main SP list say X, within that we have other child SP list say A, B and C. When I view all available list in the SP site I can view all list here (http://server/sitename/_layouts/viewlists.aspx?Basetype=0)

When trying to add new item individually to child list the NewFormUsr.aspx page opens with popup message "You are only allowed to add new items from the [Main List Name] Screen".

Going back to main list DispFormUsr.aspx page I can see a form with all columns of the main list and at the bottom all child list with a link to add new items to them. However, when we try to add new item to child list from this page the NewFormUsr.aspx for child list gives webpage cannot be found error. I'm not sure why this suddenly started to happen as it use to work before. Can someone advice if they had similar problem and how was it solved?

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