Microsoft KB Archive/815185

= PRB: DataGrid Web Server Control Does Not Appear When You Put It in a MultiPage Internet Explorer Web Controls Control =

Article ID: 815185

Article Last Modified on 5/12/2007

-

APPLIES TO


 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition

-



SYMPTOMS
When you put a DataGrid Web server control in a MultiPage Microsoft Internet Explorer Web Controls control through code, the DataGrid does not appear in the Web Form in Design view. The DataGrid also does not appear when you view the Web Form in the browser.



CAUSE
This problem occurs because the DataGrid is not bound to any data.

Typically, when a DataGrid control is at the top level of the code, the Designer object instantiates. This behavior creates a dummy data source for the DataGrid, and then the DataGrid appears as expected.

However, when the DataGrid control is located in another control (the MultiPage control in this example), the DataGrid control does not go through the design-time code path that it would have gone through typically. Therefore, the DataGrid does not appear in the browser because the DataGrid has not been bound to any data. In this scenario, the DataGrid also does not appear in Design view at design time.



STATUS
This behavior is by design.



Steps to Reproduce the Behavior
To reproduce this problem, you must have the Microsoft Internet Explorer Web Controls installed on your computer. To obtain the Internet Explorer Web Controls, visit the following Microsoft Web site:

http://www.asp.net/IEWebControls/download.aspx

Note Microsoft does not currently support the Internet Explorer Web Controls. For more information, see the &quot;References&quot; section.  Start Microsoft Visual Studio .NET 2003. On the File menu, click New, and then click Project. In the New Project dialog box, click Visual Basic Projects under Project Types, and then click ASP.NET Web Application under Templates. Click OK.

By default, WebForm1.aspx is created. Right-click the toolbox, and then click Customize Toolbox. In the Customize Toolbox dialog box, click the .NET Framework Components tab.</li> In the list of controls, click to select the check box for Multipage Control. If the control is not available in the list, click Browse, and then locate Microsoft.Web.UI.WebControls.dll. Click OK.

The MultiPage control is added to the toolbox.</li> Drag the MultiPage control to WebForm1.</li> Switch to the HTML view of WebForm1.</li>  Replace the code that is located between the   tag and the   tag with the following sample code: <iewc:MultiPage id=&quot;MultiPage1&quot; style=&quot;Z-INDEX: 101; LEFT: 76px; POSITION: absolute; TOP: 42px&quot; runat=&quot;server&quot; Width=&quot;520px&quot; Height=&quot;320px&quot; BorderStyle=&quot;None&quot;> <iewc:PageView id=&quot;FirstPage&quot;> </iewc:PageView> </iewc:MultiPage> </li> Switch to the Design view of WebForm1.</li> Click the MultiPage control.</li> In the toolbox, double-click the DataGrid control.</li> Switch to the HTML view of WebForm1</li> In HTML view, put the existing code that creates the DataGrid between the following tags:

<iewc:PageView>

</iewc:PageView>

</li> Switch to the Design view of WebForm1.</li></ol>

<div class="references_section">