打开 ASPxGridView 编辑表单时 IE6 中的 JavaScript 错误

发布于 2024-09-10 21:21:02 字数 2996 浏览 3 评论 0原文

我正在使用 DevExpress ASPxGridView 编辑表单,使用默认编辑表单。然而,当我在 IE6 中打开编辑表单并单击“更新”插入记录时,它会导致 JavaScript 错误,提示“类型”为 null 或不是对象”。但是它在 IE7 中工作正常。我很困惑并且不确定如何解决这个问题的代码如下。

<dx:ASPxGridView ID="ASPxGridView_JobTitles" runat="server" 
    AutoGenerateColumns="False" Caption="Titles" 
    ClientInstanceName="ASPxClientGridView_Titles" 
    DataSourceID="SqlDataSource_JobTitle" KeyFieldName="Title" Width="500px">
    <Settings UseFixedTableLayout="True" />
    <Columns>
        <dx:GridViewCommandColumn ButtonType="Image" Caption=" " VisibleIndex="0" 
            Width="65px">
            <UpdateButton Visible="True">
                <Image Url="~/images/update.png">
                </Image>
            </UpdateButton>
            <CancelButton Visible="True">
                <Image Url="~/images/cancel.png">
                </Image>
            </CancelButton>
            <EditButton>
                <Image Url="~/images/file_edit.png">
                </Image>
            </EditButton>
            <HeaderTemplate>
                <dx:ASPxButton ID="ASPxButton_New0" runat="server" AutoPostBack="false" 
                    Image-Url="~/images/file_add.png" Text="New">
                    <ClientSideEvents Click="function(s,e){ASPxClientGridView_Titles.AddNewRow();}" />
                </dx:ASPxButton>
            </HeaderTemplate>
        </dx:GridViewCommandColumn>
        <dx:GridViewDataTextColumn FieldName="Title" VisibleIndex="1">
            <PropertiesTextEdit>
                <ValidationSettings CausesValidation="True">
                    <RequiredField ErrorText="Is Required" IsRequired="True" />
                </ValidationSettings>
            </PropertiesTextEdit>
        </dx:GridViewDataTextColumn>
        <dx:GridViewCommandColumn ButtonType="Image" Caption=" " VisibleIndex="2" 
            Width="65px">
            <DeleteButton Visible="True">
                <Image Url="~/images/file_delete.png">
                </Image>
            </DeleteButton>
        </dx:GridViewCommandColumn>
    </Columns>
    <SettingsBehavior ConfirmDelete="True" />
</dx:ASPxGridView>
<asp:SqlDataSource ID="SqlDataSource_Title" runat="server" 
    ConnectionString="<%$ ConnectionStrings:TEST %>" 
    SelectCommand="SELECT [Title] FROM [Titles]" 
    UpdateCommand="UPDATE Titles SET Title = @Title WHERE (Title = Title)" 
    DeleteCommand="DELETE FROM Titles WHERE (Title = @Title)" 
    InsertCommand="INSERT INTO Titles(Title) VALUES (@Title)">
    <InsertParameters>
        <asp:Parameter Name="Title" Type="String" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="Title" Type="String" />
    </UpdateParameters>
</asp:SqlDataSource>

I'm using DevExpress ASPxGridView edit form, using default edit form. However when I open the edit form in IE6 and click "update" to insert the record, it causes a JavaScript error that says "type" is null or not an object". However it works fine in IE7. I am puzzled and unsure of how to resolve this. Code is below.

<dx:ASPxGridView ID="ASPxGridView_JobTitles" runat="server" 
    AutoGenerateColumns="False" Caption="Titles" 
    ClientInstanceName="ASPxClientGridView_Titles" 
    DataSourceID="SqlDataSource_JobTitle" KeyFieldName="Title" Width="500px">
    <Settings UseFixedTableLayout="True" />
    <Columns>
        <dx:GridViewCommandColumn ButtonType="Image" Caption=" " VisibleIndex="0" 
            Width="65px">
            <UpdateButton Visible="True">
                <Image Url="~/images/update.png">
                </Image>
            </UpdateButton>
            <CancelButton Visible="True">
                <Image Url="~/images/cancel.png">
                </Image>
            </CancelButton>
            <EditButton>
                <Image Url="~/images/file_edit.png">
                </Image>
            </EditButton>
            <HeaderTemplate>
                <dx:ASPxButton ID="ASPxButton_New0" runat="server" AutoPostBack="false" 
                    Image-Url="~/images/file_add.png" Text="New">
                    <ClientSideEvents Click="function(s,e){ASPxClientGridView_Titles.AddNewRow();}" />
                </dx:ASPxButton>
            </HeaderTemplate>
        </dx:GridViewCommandColumn>
        <dx:GridViewDataTextColumn FieldName="Title" VisibleIndex="1">
            <PropertiesTextEdit>
                <ValidationSettings CausesValidation="True">
                    <RequiredField ErrorText="Is Required" IsRequired="True" />
                </ValidationSettings>
            </PropertiesTextEdit>
        </dx:GridViewDataTextColumn>
        <dx:GridViewCommandColumn ButtonType="Image" Caption=" " VisibleIndex="2" 
            Width="65px">
            <DeleteButton Visible="True">
                <Image Url="~/images/file_delete.png">
                </Image>
            </DeleteButton>
        </dx:GridViewCommandColumn>
    </Columns>
    <SettingsBehavior ConfirmDelete="True" />
</dx:ASPxGridView>
<asp:SqlDataSource ID="SqlDataSource_Title" runat="server" 
    ConnectionString="<%$ ConnectionStrings:TEST %>" 
    SelectCommand="SELECT [Title] FROM [Titles]" 
    UpdateCommand="UPDATE Titles SET Title = @Title WHERE (Title = Title)" 
    DeleteCommand="DELETE FROM Titles WHERE (Title = @Title)" 
    InsertCommand="INSERT INTO Titles(Title) VALUES (@Title)">
    <InsertParameters>
        <asp:Parameter Name="Title" Type="String" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="Title" Type="String" />
    </UpdateParameters>
</asp:SqlDataSource>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

他不在意 2024-09-17 21:21:02

您使用的代码非常正确,我看不出出现此错误的原因。请告知您使用的是哪个 ASPxGridView 版本?您可以使用最新的(10.1.5)吗?

The code you are using is quite correct and I do not see a reason for this error to appear. Please tell which ASPxGridView version are you using? Is it possible for you to use the latest one (10.1.5) ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文