January 21, 2021
Hot Topics:

Dynamically Data-bind in InfoPath

  • By Thiru Thangarathinam
  • Send Email »
  • More Articles »

Customizing the Task Pane to Display Custom Content

In this section, we will see how to add custom content to the task pane that will be displayed to the user at the time of filling out the form. By providing meaningful content, we can provide the users with helpful information they need while filling out the forms. For the purposes of this article, let us display all the publishers available in the Publishers table in the custom task pane.

For this reason, let us create a new Visual C# ASP.NET project named TaskPaneCustomContent. Once the project is created, add a Web Form named PublishersList.aspx to the project. After that, add a DataGrid control named gridPublishers to the form and then modify the code in the Page_Load event to look like the following.

private void Page_Load(object sender,
                       System.EventArgs e)
  DataSet publishersDataSet = 
         new DataSet("Publishers");
  using (SqlConnection conn = new
    SqlDataAdapter adapter = 
         new SqlDataAdapter("Select pub_name,
             country from Publishers ",conn);
    adapter.Fill(publishersDataSet ,"Publisher");
  gridPublishers.DataSource =

Now that we have created the ASP.NET page that is going to provide content to the task pane, let us see how to hook it up with the InfoPath form. To accomplish this, select Tools-> Forms Options from the menu and select the Advanced tab from the Forms Options dialog box. In the dialog box, check the Enable custom task pane check box, and enter a custom name as well as the location of the ASP.NET page that we created earlier. After entering all the details, your dialog box should look like the following screenshot.

Now, if you preview the form by clicking on the Preview form option from the toolbar, you will get the following output.

Click here for a larger image.

As the above figure shows, the output produced by the PublishersList.aspx page is displayed in the Custom task pane of the form.


In this article series, we have understood the key features of InfoPath 2003 that make it an ideal candidate for creating productivity applications using the familiar Office suite of tools. InfoPath has the ability to become the widely used data capturing tool, because of its native ability to create and consume XML data, allowing the data in an enterprise to be reused without writing any custom code. You can achieve all of this without requiring the users to know XML or possess development skills, but still leverage the features of XML throughout the enterprise. Also by using InfoPath, you can simply develop Web Services "hooks" that allow data to be submitted to and retrieved from a variety of applications. Developers can use InfoPath to quickly create new, feature-rich user interfaces to those legacy applications. This process is both much faster and less expensive than the task of re-engineering the legacy application, and can result in a huge cost saving.

Source Code

The following is the source code for this two part article: InfoPath.zip - 52 kb.

About the Author

Thiru Thangarathinam has many years of experience in architecting, designing, developing and implementing applications using Object Oriented Application development methodologies. He also possesses a thorough understanding of software life cycle (design, development and testing). He is an expert with ASP.NET, .NET Framework, Visual C#.NET, Visual Basic.NET, ADO.NET, XML Web Services and .NET Remoting and holds MCAD for .NET, MCSD and MCP certifications. Thiru has authored numerous books and articles. He can be reached at thiruthangarathinam@yahoo.com.

# # #

Page 2 of 2

This article was originally published on September 24, 2003

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date