Ajax 控件工具包 Hover Menu with GridView
您好,我正在尝试实现示例悬停菜单的相同功能 http: //www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/HoverMenu/HoverMenu.aspx
但是,当我的 gridview 显示时我将鼠标悬停在菜单上,但仅针对整个 gridview,而不是像示例中那样的每一行?。目前菜单按钮没有任何作用。
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataSourceID="BookingsSQL"
ShowHeader="False" Width="100%" BackColor="Azure" GridLines="None" >
<Columns>
<asp:BoundField DataField="programme_name" HeaderText="programme_name"
SortExpression="programme_name" />
<asp:BoundField DataField="Start" HeaderText="Start" SortExpression="Start" />
<asp:BoundField DataField="Finish" HeaderText="Finish"
SortExpression="Finish" />
<asp:BoundField DataField="Source" HeaderText="Source"
SortExpression="Source" />
<asp:BoundField DataField="Destination" HeaderText="Destination"
SortExpression="Destination" />
<asp:BoundField DataField="Comment" HeaderText="Comment"
SortExpression="Comment" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="BookingsSQL" runat="server"
ConnectionString="<%$ ConnectionStrings:BookingsConnectionString %>"
SelectCommand="SELECT [programme name] AS programme_name, [Start], [Finish], [Source], [Destination], [Comment] FROM [Bookings]">
</asp:SqlDataSource>
<asp:HoverMenuExtender ID="HoverMenuExtender1" runat="server"
TargetControlID="GridView1"
PopupControlID="PopupMenu"
HoverCssClass="popupHover"
PopupPosition="Left"
OffsetX="0"
OffsetY="0"
PopDelay="50">
</asp:HoverMenuExtender>
<asp:Panel CssClass="popupMenu" ID="PopupMenu" runat="server">
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit" Text="Edit" />
<br />
<asp:LinkButton ID="LinkButton2" runat="server"
CommandName="Delete" Text="Delete" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
使用jquery悬停尝试了几种不同的方法,但这将是最好的解决方案。 请提供任何帮助。谢谢。
Hi there I am trying to achieve the same functionality of the Example Hover menu over at http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/HoverMenu/HoverMenu.aspx
However when my gridview display's and I mouse over the menu comes up but only for the entire gridview not each row like in the example ?. currently the menu buttons do nothing.
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataSourceID="BookingsSQL"
ShowHeader="False" Width="100%" BackColor="Azure" GridLines="None" >
<Columns>
<asp:BoundField DataField="programme_name" HeaderText="programme_name"
SortExpression="programme_name" />
<asp:BoundField DataField="Start" HeaderText="Start" SortExpression="Start" />
<asp:BoundField DataField="Finish" HeaderText="Finish"
SortExpression="Finish" />
<asp:BoundField DataField="Source" HeaderText="Source"
SortExpression="Source" />
<asp:BoundField DataField="Destination" HeaderText="Destination"
SortExpression="Destination" />
<asp:BoundField DataField="Comment" HeaderText="Comment"
SortExpression="Comment" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="BookingsSQL" runat="server"
ConnectionString="<%$ ConnectionStrings:BookingsConnectionString %>"
SelectCommand="SELECT [programme name] AS programme_name, [Start], [Finish], [Source], [Destination], [Comment] FROM [Bookings]">
</asp:SqlDataSource>
<asp:HoverMenuExtender ID="HoverMenuExtender1" runat="server"
TargetControlID="GridView1"
PopupControlID="PopupMenu"
HoverCssClass="popupHover"
PopupPosition="Left"
OffsetX="0"
OffsetY="0"
PopDelay="50">
</asp:HoverMenuExtender>
<asp:Panel CssClass="popupMenu" ID="PopupMenu" runat="server">
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit" Text="Edit" />
<br />
<asp:LinkButton ID="LinkButton2" runat="server"
CommandName="Delete" Text="Delete" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
Tried a few different ways using jquery hover but this would be the best solution.
Any help please . Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有解决办法。
为每一行实现 HoverExtender 并不那么棘手,因为这在示例工具包示例中显示,为提供带有排序的列标题。
请注意,预订表中添加了代理主键,以允许编辑所有字段值。此外,还使用 jQuery datepicker 插件来编辑“开始”和“完成”字段值。您可以使用 AjaxControlToolkit 中的 DatePickerExtender,但在这种情况下,必须为网格中的每一行单独添加这些扩展程序以及 HoverExtender。
There is solution.
It's not so tricky to implement a HoverExtender for each row since this showed in sample toolkit sample, as to provide columns headers with sorting.
Draw attention that there is surrogate primary key added to Bookings table for allowing editing all fields values. Also there is used jQuery datepicker plugin for editing Start and Finish fields values. You may use DatePickerExtender from the AjaxControlToolkit instead, but in that case those extenders as well as the HoverExtenders must be added for each row in grid separately.
感谢您提供如此大的帮助...它对我有用,我使用 SqlDataSource 而不是使用 objectDataSource...
这是我正在运行的代码,对我来说非常有用......
”
OldValuesParameterFormatString="original_{0}" ConflictDetection="OverwriteChanges"
SelectCommand="从 [AddPages] 选择 *"
DeleteCommand="从 [AddPages] 删除,其中 [PageAddId] = @PageAddID"
Thanks for such a great help... its working for me i have used SqlDataSource instead of using objectDataSource...
here is my running code that is working great for me....
"
OldValuesParameterFormatString="original_{0}" ConflictDetection="OverwriteChanges"
SelectCommand="SELECT * FROM [AddPages]"
DeleteCommand="DELETE FROM [AddPages] WHERE [PageAddId] = @PageAddID"