Error message when you try to run an ASP.NET 2.0 Web application: "An unhandled exception occurred during the execution of the current web request" (916443)
The information in this article applies to:
SYMPTOMSWhen you try to run a Microsoft ASP.NET 2.0 Web application that is built on the Microsoft .NET Framework 2.0, you receive the following error message: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
This problem occurs when you try to convert a hyperlink field by clicking the Convert this field into a TemplateField link in the Fields dialog box in Microsoft Visual Web Developer. CAUSEThis problem is caused by incorrect code that is generated by Visual Web Developer. When you click the Convert this field into a TemplateField link in the Fields dialog box, code that resembles the following is generated. <asp:HyperLink ID="HyperLink1"
NavigateUrl='<%# Eval("au_fname", "http://{0}/{1}/{2}") %>' runat="server" Text='<%# Eval("au_fname", "go/{0}") %>'>
</asp:HyperLink> Note HyperLink1 is a placeholder for the name of the Hyperlink control. au_fname is a placeholder for name of the data source field that contains "first name" information. You must change these names to match your application. RESOLUTIONTo resolve this problem, use the following code to replace the code that is generated by Visual Web Developer. <asp:HyperLink ID="HyperLink1"
NavigateUrl='<%# String.Format("http://{0}/{1}/{2}", DataBinder.Eval(Container.DataItem,"au_fname"),
DataBinder.Eval(Container.DataItem,"au_lname"),DataBinder.Eval(Container.DataItem,"au_id")) %>' runat="server">
</asp:HyperLink> Note HyperLink1 is a placeholder for the name of the Hyperlink control. au_lname is a placeholder for name of the data source field that contains "last name" information. You must change these names to match your application.
Modification Type: | Minor | Last Reviewed: | 8/22/2006 |
---|
Keywords: | kbASP kbconversion kbtshoot kbprb KB916443 kbAudDeveloper |
---|
|