SharePoint Developer Center > SharePoint Products and Technologies Forums > SharePoint - Design and Customization (pre-SharePoint 2010) > Trying to bind dropdownlist selection to Sharepoint list column on custom insert form

Answered Trying to bind dropdownlist selection to Sharepoint list column on custom insert form

  • Thursday, April 19, 2007 12:42 PM
     
     

    I am building a custom insert form based on the following article: http://dattard.blogspot.com/2007/04/sharepoint-2007-filtered-lookups.html.

     

    I have a list with three columns, two of which are text and one which I want the user to select from a dropdown (a category).  I built the dropdown connecting to another sharepoint list.  However, I can't seem to get the value of the selected item to be bound to my original list. So what happens is that when I insert my item, I get the two text items and nothing for this category field.

     

    Sample code:

      <SharePointBig SmileVDropDownList runat="server" id="ff4{$Pos}" DataSourceID="spDataSource2"
              DataTextField="Title" DataValueField="ID" selectedValue="Business Model"
              __designer:bind="{ddwrtBig SmileataBind('i',concat('ff4',$Pos),'SelectedValue','SelectedIndexChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ID')}" AppendDataBoundItems="True"/>

          

    I also tried creating a linked source by linking my original list to which I want to insert an item to the categories list but then sharepoint produces an error about not being able to support linked sources in insert forms.

Answers

  • Thursday, April 19, 2007 3:50 PM
     
     Answered

    It turns out that I was very close to getting this to work.  I had to add the items in red.

     

     <SharePointBig SmileVDropDownList FieldName="Categories" runat="server" id="ff4{$Pos}" DataSourceID="spDataSource2"
              DataTextField="Title" DataValueField="ID"
              __designer:bind="{ddwrtBig SmileataBind('i',concat('ff4',$Pos),'SelectedValue','SelectedIndexChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Categories')}"/>
          

    What I fixed:

     

    1) The property FieldName was missing.

    2) The second parameter was @ID and I thought that referred to the DataValueField="ID", but no, it needs to bind to the FieldName.

     

     

All Replies

  • Thursday, April 19, 2007 3:50 PM
     
     Answered

    It turns out that I was very close to getting this to work.  I had to add the items in red.

     

     <SharePointBig SmileVDropDownList FieldName="Categories" runat="server" id="ff4{$Pos}" DataSourceID="spDataSource2"
              DataTextField="Title" DataValueField="ID"
              __designer:bind="{ddwrtBig SmileataBind('i',concat('ff4',$Pos),'SelectedValue','SelectedIndexChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Categories')}"/>
          

    What I fixed:

     

    1) The property FieldName was missing.

    2) The second parameter was @ID and I thought that referred to the DataValueField="ID", but no, it needs to bind to the FieldName.

     

     

  • Monday, December 24, 2007 12:10 PM
     
     

    Great Post!

    But I still have a problem with binding dropdownlist.

    Maybe you could suggest some additional source of information, where it is possible to find out more about designer binding?

     

  • Wednesday, January 02, 2008 4:19 PM
     
     

    Unfortunately, I figured this out by trial and error. I wasn't able to find good resources on this topic.