本文介绍了如何删除此错误 - 异常已被asp.net中的调用目标抛出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在asp.net中开发一个websie并且我已经完成了一个GridView Binding。当我运行网站或程序然后我发现这个错误:---





调用目标引发了错误异常

给我正确答案。

我的示例代码绑定如下: -



在aspx页面中: -

I am developing a websie in asp.net and I have done a GridView Binding.when i run the website or program then i find this error:---


"error-exception has been thrown by the target of an invocation"
Give me the proper answer.
my sample code for the binding is given below:--

In aspx page:-

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"

            CellPadding="4" ForeColor="#333333" GridLines="Horizontal"

        Width="743px">
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" />
        <Columns>
            <asp:TemplateField HeaderText="UserId" Visible="false">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("userid") %>'></asp:TextBox>
                </EditItemTemplate>
<HeaderTemplate>
            Field of Work2

</HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("userid") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>


         <asp:TemplateField>
        <HeaderTemplate>
            Field of Work2
        </HeaderTemplate>
        <ItemTemplate>
            <asp:Label ID="Label3" runat="server" Text='<%#Bind("fieldofwork1") %>'></asp:Label>
            </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="TextBox3" runat="server" Text='<%#Bind("fieldofwork1") %>'></asp:TextBox>

        </EditItemTemplate>
        </asp:TemplateField>

          <asp:TemplateField>
        <HeaderTemplate>
            From
        </HeaderTemplate>
        <ItemTemplate>
            <asp:Label ID="Label3" runat="server" Text='<%#Bind("[[From]1]") %>'></asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="TextBox3" runat="server" Text='<%#Bind("[[From]]1]") %>'></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField>
        <HeaderTemplate>
            To
        </HeaderTemplate>
        <ItemTemplate>
            <asp:Label ID="Label3" runat="server" Text='<%#Bind("[[To]]1]") %>'></asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="TextBox3" runat="server" Text='<%#Bind("[[To]]1]") %>'></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
                                         <asp:TemplateField>
        <HeaderTemplate>
            Specialization
        </HeaderTemplate>
        <ItemTemplate>
            <asp:Label ID="Label3" runat="server" Text='<%#Bind("specialization1") %>'></asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="TextBox3" runat="server" Text='<%#Bind("specialization1") %>'></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
                                         <asp:TemplateField>
        <HeaderTemplate>
            Organization
        </HeaderTemplate>
        <ItemTemplate>
            <asp:Label ID="Label3" runat="server" Text='<%#Bind("organization1") %>'></asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="TextBox3" runat="server" Text='<%#Bind("organization1") %>'></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>







</Columns>
           <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
           <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
           <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
           <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
           <EditRowStyle BackColor="#999999" />
           <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
       </asp:GridView>

推荐答案




这篇关于如何删除此错误 - 异常已被asp.net中的调用目标抛出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 18:00