【问题标题】:asp panel default button not workingasp面板默认按钮不起作用
【发布时间】:2011-04-13 15:43:24
【问题描述】:

我在我的项目中使用 ajax 可折叠面板扩展器。因此,在价格范围功能面板之一中,我有 2 个文本框和一个用于处理价格范围功能的 asp 按钮。好吧,我正在尝试将按钮设置为该 asp 面板中的默认按钮,但它不起作用。我也在 Firefox、IE 和 chrome 中尝试了我的页面。它只是不执行任何操作并重新加载页面。

下面我添加asp代码,

<asp:Panel ID="PricePanel" runat="server" CssClass="ui-widget-header ui-corner-all"
                                Style="padding: 0.1em 0.3em; text-align: left;">
                                <asp:Image ID="imgPrice" runat="server" />
                                <asp:Label ID="AllPrices" runat="server" Text="Price Range"></asp:Label>
                            </asp:Panel>
                            <asp:Panel ID="PricePanelContent" runat="server" CssClass="collapsePanel" DefaultButton="btnPrice">
                                <div class="PriceRange">
                                    <asp:Label ID="lblPriceFrom" runat="server" Text="Rs" Width="20px"></asp:Label><asp:TextBox
                                        Width="60px" ID="txtPriceFrom" runat="server"></asp:TextBox>
                                    <asp:Label ID="lblPriceTo" runat="server" Text="To Rs " Width="42px"></asp:Label><asp:TextBox
                                        ID="txtPriceTo" Width="60px" runat="server" AutoPostBack="True" Wrap="True"></asp:TextBox>
                                    <asp:Button ID="btnPrice" runat="server" Text="Go" OnClick="btnPrice_Click" />
                                </div>
                            </asp:Panel>
                            <asp:CollapsiblePanelExtender TargetControlID="PricePanelContent" ImageControlID="imgPrice"
                                ExpandedImage="~/images/open.png" CollapsedImage="~/images/close.png" ID="CollapsiblePrice"
                                ExpandControlID="PricePanel" CollapseControlID="PricePanel" CollapsedText="All Price"
                                TextLabelID="AllPrices" ExpandedText="" Collapsed="true" runat="server" SuppressPostBack="true">
                            </asp:CollapsiblePanelExtender>

如果有人可以帮助我。

感谢和问候,

梅胡尔·马克瓦纳。

【问题讨论】:

  • 检查 javascript 错误。 (并更新到此控件的最新版本)
  • 嘿 aristos 我在 Dumitru 的帮助下解决了这个问题。谢谢阿里斯托斯。哪个是可用的最新版本。

标签: asp.net panel


【解决方案1】:

尝试从txtPriceTo 文本框中删除AutoPostBack="True",看看是否有帮助。

【讨论】:

  • 嘿,好家伙,这是唯一的问题。谢谢你的帮助。你能告诉我当它被设置为真的问题是什么吗?这样我就不会再犯同样的错误了。
  • msdn.microsoft.com/en-us/library/… - “如果在 TextBox 控件失去焦点时发生自动回发,则为 true”。可能它在调用默认按钮的事件之前执行了自动回发。
  • 4 年多后,仍然有用。
猜你喜欢
  • 1970-01-01
  • 2012-08-09
  • 1970-01-01
  • 1970-01-01
  • 2015-06-23
  • 1970-01-01
  • 1970-01-01
  • 2015-09-01
  • 1970-01-01
相关资源
最近更新 更多