A A A Font Size

Making MOSS Work for You

BDC Related List - Default Values

If you've ever used the BDC Related List in conjunction with a BDC List that filters the results of the Related List, you should be familiar with that message that indicates something along the lines of 'to show values in this web part, connect it to a web part that supplies......'.  For example, you may have a BDC List diplaying committees, and you want the user to select an item in that list in order to show the members of that committee which would be diplayed by the BDC Related List web part.

You don't always want your users to see that default message however and it is nicer to have one of the values in the list selected by default. The BDC doesn't make this all that easy, but you can get there! You can use the same technique to send the appropriate value to a BDC Item web part from a BDC List.

The first thing I had to do was to find out what the BDC representation was for the item I want to use as a default value. I got this by doing a View Source on the page, searching for the term in the BDC list I wanted to use as default (i.e. 'Board of Directors') and right nearby you'll see something ugly like this: 
__bkc0001300c300c300

Copy that value.

Now in the xslt for the BDC List, add this inside the dvt.headerfield template, replacing the ugly key with your own copied value:

 <xsl:if test="$dvt_1_form_selectkey=''">
     <script type="text/javascript">
        function doit() {
          <xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_1_form_selectkey={','__bkc0001300c300c300','}'))" />;
          return false;
        }
        doit();
      </script>   
    </xsl:if>   


That function tells the BDC List when it loads that if it doesn't have a default value to go ahead and populate one, and fire the event that sends that selection over to the BDC Related List. You can also of course update the xslt to make it appear that the appropriate radio button does appear selected.

To see a live example of this technology in use, check out this sweet Course Catalog browser on the Nationwide Mortgage Licensing System (NMLS) site. We updated the xslt on this one to make the selection from the BDC list appear as tab-like horizontal buttons instead of the regular vertical radio buttons.

Cheers!
ann



You must sign in to rate content.
(Unrated)

Comments

There are no comments yet for this post.

Leave a Comment

You must be logged in to post a comment.
Superstar
Ann Wallinger
Solution Architect
Winchester, VA

Search This Blog

 

© 2010 SusQtech. All rights reserved.
Powered by SharePoint Server 2007 and using the MemberToMember SharePoint Add-On for social media capabilities.