Remove first line from repeating table and DropDownLists

S

Sjoukje Zaal

Hi,

I'm creating a InfoPath form with Visual Studio. I wan't to remove the first
blank line from a repeatingtable and from several DropDownList. The
datasources for this controls are xml files wich retrieve data from
SharePoint.

I've tried to do this with the following code but unfortuanly this will
disable the entire control:

// Retrieve the first row of the repeating table
XPathNavigator domNav = MainDataSource.CreateNavigator();
XPathNavigator itemNav = domNav.SelectSingleNode(
"/my:myFields/my:group1/my:group2[1]",
NamespaceManager);

// Delete the row
if (itemNav != null)
itemNav.DeleteSelf();

Any suggestions Anyone?

Regards,
Sjoukje
 
G

Greg Collins

The drop-downs are an XSLT issue. InfoPath adds the blank row so that useres
can select no value (or a blank value). In most cases, this is desirable.
You can do a couple of things:

1. Set a default value so that the user doesn't see blank.
2. Manually edit the XSL file for the view and remove the code that inserts
the blank value.



The blank row in a repeating table can be removed by code, but if you don't
want one present to begin with, why not change the default values of the
form to just not include the first row to begin with? Look in:

Data | Default Values (Visual Studio)
Tools | Default Values (Non-Visual Studio)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top