浏览器没有刷新

时间:2013-10-10 09:27:23

标签: asp.net

这是我的第一篇文章,所以请保持温柔。关于下面的标记和代码(这都在用户控件中),这可以正常工作。当我尝试从formview呈现的列表中删除多个项目时,会发生此问题。

我可以删除一个项目,页面重新加载,我删除的项目也消失了。如果我然后单击另一项上的删除,则根本没有明显的响应。将断点放在后面页面中的所有函数等上表明它确实经历了它应该做的所有事情,但是浏览器根本没有显示任何响应。如果我然后手动刷新浏览器,我删除的第二个项目已经消失。

每次点击删除时我都需要刷新浏览器,如果可能的话,我可以帮助理解问题。我已经尝试在窗体视图和转发器中分别和一起使用ViewStateMode =“Disabled / Enabled”。

其他 - 我也尝试过禁用缓存。

提前致谢。

<asp:FormView ID="fvDrugActiveSubstance" runat="server" DefaultMode="ReadOnly" UseSubmitBehavior="false" Width="100%">
    <ItemTemplate>
        <table style="border-collapse: collapse; border-spacing: 0;width: 100%;">
            <tr>
                <th style="width:80%;">Name</th>
                <th style="width:10%;">Edit</th>
                <th style="width:10%;">Delete</th>
            </tr>
            <asp:Repeater ID="rptrDrugActiveSubstance" runat="server" OnItemCommand="rptrDrugActiveSubstance_ItemCommand">
                <ItemTemplate>
                    <tr class="view_table" style="">
                        <td>
                            <asp:Label  Text='<%# Eval("ActiveSubstanceName") %>' ID="lblName" runat="server" />
                            <asp:Label  Text='<%# Eval("DrugSafetyDrugCode") %>' ID="lblCode" runat="server" Visible="false" />
                        </td>
                        <td>
                            <img onclick='<%# String.Format("openDrugActiveSubstanceWindow( {1},{0},\"Write\" );return false;",((DrugActiveSubstance)Container.DataItem).DrugSafetyDrugCode.ToString(),((DrugActiveSubstance)Container.DataItem).DrugSafetyDrugActiveSubstanceCode) %>' src="/images/grid_icons/edit.png" style="cursor: pointer;" title="Edit" />
                        </td>
                        <td>
                            <asp:ImageButton ID="btnDelete" runat="server" CommandArgument='<%# Eval("DrugSafetyDrugActiveSubstanceCode") %>' style="cursor: pointer;" CommandName="cmd_delete" ImageUrl="~/images/grid_icons/Delete.gif" ToolTip="Delete" />
                        </td>
                    </tr>
                </ItemTemplate>
                <AlternatingItemTemplate>
                    <tr class="view_table_alt">
                        <td>
                            <asp:Label  Text='<%# Eval("ActiveSubstanceName") %>' ID="lblName" runat="server" />
                            <asp:Label  Text='<%# Eval("DrugSafetyDrugCode") %>' ID="lblCode" runat="server" Visible="false" />
                        </td>
                        <td>
                            <img onclick='<%# String.Format("openDrugActiveSubstanceWindow( {1},{0},\"Write\" );return false;",((DrugActiveSubstance)Container.DataItem).DrugSafetyDrugCode.ToString(),((DrugActiveSubstance)Container.DataItem).DrugSafetyDrugActiveSubstanceCode) %>' src="/images/grid_icons/edit.png" style="cursor: pointer;" title="Edit" />
                        </td>
                        <td id="tdDelete">
                            <asp:ImageButton ID="btnDelete" runat="server" CommandArgument='<%# Eval("DrugSafetyDrugActiveSubstanceCode") %>' style="cursor: pointer;" CommandName="cmd_delete" ImageUrl="~/images/grid_icons/Delete.gif" ToolTip="Delete" />
                        </td>
                    </tr>
                </AlternatingItemTemplate>
            </asp:Repeater>
        </table>
    </ItemTemplate>
</asp:FormView>



protected void rptrDrugActiveSubstance_ItemCommand(object source, RepeaterCommandEventArgs e)
{
    drugSafetyService.DeleteDrugActiveSubstance(int.Parse(e.CommandArgument.ToString()));
    Response.Redirect(HttpContext.Current.Request.Url.ToString().Split('?')[0] + "?#drugAS_accordian");
}

1 个答案:

答案 0 :(得分:0)

我打算把这个作为经验。找到导致中止的javascript函数后,问题现在得到解决。

相关问题