By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,249 Members | 1,853 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,249 IT Pros & Developers. It's quick & easy.

Hover Menu

P: n/a
To all,

I'm trying to do exactly what is instructed in the following weblink
http://ajax.asp.net/ajaxtoolkit/Hove...HoverMenu.aspx. However, I can't
get the selected item in my griview row to appear in my text box. Can
someone advise?

Here is my samples:

Code behind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not IsPostBack Then

_ds = DataAccess.All_Advertisements()
ViewState.Add("_ds", _ds)
_dv = _ds.Tables(0).DefaultView

gv_advertisements.DataSource = _dv
gv_advertisements.DataBind()

End If
End Sub
Protected Sub gv_advertisements_Sorting(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.GridViewSortEventArgs) Handles
gv_advertisements.Sorting

_ds = CType(ViewState.Item("_ds"), Data.DataSet)
_dv = _ds.Tables(0).DefaultView
_dv.Sort = e.SortExpression

gv_advertisements.DataSource = _dv
gv_advertisements.DataBind()

End Sub

Protected Sub gv_advertisements_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
gv_advertisements.SelectedIndexChanged
TextBox1.Text = gv_advertisements.SelectedRow.Cells(4).Text()

End Sub
Protected Sub btn_Search_Advertisement_by_Date_Click(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
btn_Search_Advertisement_by_Date.Click

_s_date = tb_start_date.Text
_e_date = tb_end_date.Text

_ds = DataAccess.All_Advertisements(_s_date, _e_date)
ViewState.Add("_ds", _ds)
_dv = _ds.Tables(0).DefaultView

gv_advertisements.DataSource = _dv
gv_advertisements.DataBind()

End Sub

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
TextBox1.Text = gv_advertisements.SelectedRow.Cells(4).Text() '"Hello"
End Sub
End Class

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">

</script>

<link href="Styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server" >

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<asp:Panel ID="pnl_Advertisements" runat="server" Height="160px"
Style="z-index: 100;
left: 296px; position: absolute; top: 24px" Width="464px">
<asp:UpdatePanel ID="upp_Advertisements" runat="server">
<ContentTemplate>
<asp:Panel ID="pnl_Scroll_Advertisements" runat="server"
Height="160px" Width="456px" ScrollBars="Vertical">
<asp:GridView ID="gv_advertisements" runat="server"
AllowSorting="True" AutoGenerateColumns="False" CellPadding="4"
ForeColor="#333333" GridLines="None"
Height="152px" PageSize="5" Width="784px"
AutoGenerateSelectButton="True">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True"
ForeColor="White" />
<Columns>
<asp:BoundField DataField="Advertisement Name"
HeaderText="Advertisement Name" SortExpression="Advertisement Name">
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Present Date"
HeaderText="Present Date" SortExpression="Present Date">
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Expiration Date"
HeaderText="Expiration Date" SortExpression="Expiration Date">
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Advertisement ID"
HeaderText="Advertisement ID">
<HeaderStyle HorizontalAlign="Left" />
</asp:BoundField>
</Columns>
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True"
ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White"
HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
</asp:Panel>

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<cc1:HoverMenuExtender ID="HoverMenuExtender1"
runat="server" TargetControlID="gv_advertisements" PopupControlID="Panel1"
HoverCssClass="popupHover" PopupPosition="Top"
OffsetX="-10" OffsetY="-10" PopDelay="50">
</cc1:HoverMenuExtender>
<asp:Panel ID="Panel1" runat="server" Height="50px"
Width="125px">
<asp:LinkButton ID="LinkButton1" runat="server"
CommandName="edit" Text="edit"
OnClick="LinkButton1_Click"></asp:LinkButton></asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger
ControlID="btn_Search_Advertisement_by_Date" />
</Triggers>

</asp:UpdatePanel>
<asp:Button ID="btn_Search_Advertisement_by_Date" runat="server"
Text="Search Advertisements by Date" />
</asp:Panel>
<br />
<cc1:Accordion ID="acc_Search_Panes" runat="server"
SelectedIndex="0" SuppressHeaderPostbacks="true" Width="224px"
Height="248px">

<Panes>
<cc1:AccordionPane runat="server">
<Header>"Test1" </Header>
<Content"Testing This First Content" </Content>
</cc1:AccordionPane>
</Panes>

<Panes>
<cc1:AccordionPane runat="server">
<Header>Dates</Header>
<Content>
<hr />
<asp:TextBox ID="tb_start_date" runat="server" style="z-index:
104;" Width="152px"></asp:TextBox>
<asp:Image ID="img_start_date" runat="server" Height="16px"
Style="z-index: 107;" Width="56px" />
<asp:TextBox ID="tb_end_date" runat="server" Style="z-index:
101;" Width="152px"></asp:TextBox>
<asp:Image ID="img_end_date" runat="server" Height="16px"
Style="z-index: 103;" Width="56px" />
<cc1:CalendarExtender ID="cle_start_date" runat="server"
TargetControlID="tb_start_date" PopupButtonID="img_start_date">
</cc1:CalendarExtender>
<cc1:CalendarExtender ID="cle_end_date" runat="server"
TargetControlID="tb_end_date" PopupButtonID="img_end_date">
</cc1:CalendarExtender>
<hr />
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>
<br />

<asp:Panel ID="pnl_Charts" runat="server" Height="256px"
Style="z-index: 101; left: 296px;
position: absolute; top: 320px" Width="808px">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<hr style="height: 1px" />
<asp:Label ID="lbl_Test2" runat="server" Height="24px"
Text="Label" Width="184px"></asp:Label>
<br />
<br />
<br />
<DCWC:Chart ID="cht_Advertisement" runat="server"
Palette="Pastel" Width="800px">
<Legends>
<DCWC:Legend Name="Default">
<Position Height="8.026756" Width="28.0936451"
X="68.90636" Y="3" />
</DCWC:Legend>
</Legends>
<Series>
<DCWC:Series Color="Red" Name="Failed"
BorderColor="64, 64, 64" ShadowOffset="1" ChartType="StackedColumn">
</DCWC:Series>
<DCWC:Series Color="Yellow" Name="Pending"
BorderColor="64, 64, 64" ShadowOffset="1" ChartType="StackedColumn">
</DCWC:Series>
<DCWC:Series BorderColor="64, 64, 64" Color="Lime"
Font="Mistral, 8.25pt"
Name="Succeeded" ShadowOffset="1"
ChartType="StackedColumn">
</DCWC:Series>
</Series>
<ChartAreas>
<DCWC:ChartArea Name="Default">
<AxisX>
<LabelStyle Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
<MajorTickMark Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
<MajorGrid Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
</AxisX>
<Area3DStyle Enable3D="True" Light="Realistic" />
<InnerPlotPosition Height="74.08244"
Width="75.69049" X="20.13664" Y="3.35106" />
<Position Height="94" Width="62.9063568" X="3"
Y="3" />
<AxisY>
<LabelStyle Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
<MajorTickMark Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
<MajorGrid Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
</AxisY>
<AxisX2>
<LabelStyle Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
<MajorTickMark Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
<MajorGrid Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
</AxisX2>
<AxisY2>
<LabelStyle Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
<MajorTickMark Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
<MajorGrid Interval="Auto"
IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Auto" />
</AxisY2>
</DCWC:ChartArea>
</ChartAreas>
<Titles>
<DCWC:Title Name="ClickedElement">
<Position Width="94" X="3" Y="3" />
</DCWC:Title>
</Titles>
</DCWC:Chart>
<hr style="height: 1px" />
</ContentTemplate>
<%--<triggers>
<asp:AsyncPostBackTrigger ControlID = "button1"
eventname="click" />
</triggers>--%>
</asp:UpdatePanel>
</asp:Panel>

Styles.css:
..sortheaderrowstyle {
background-color: #006699;
text-align: left;
font-weight: bold;
color:White;
}

..popupHover {
background-color:#F5F7F8;
}

..popupMenu {
background-color:#AAFFFF;
}

Mar 28 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.