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.EventArg s) Handles Me.Load
If Not IsPostBack Then
_ds = DataAccess.All_ Advertisements( )
ViewState.Add(" _ds", _ds)
_dv = _ds.Tables(0).D efaultView
gv_advertisemen ts.DataSource = _dv
gv_advertisemen ts.DataBind()
End If
End Sub
Protected Sub gv_advertisemen ts_Sorting(ByVa l sender As Object, ByVal e
As System.Web.UI.W ebControls.Grid ViewSortEventAr gs) Handles
gv_advertisemen ts.Sorting
_ds = CType(ViewState .Item("_ds"), Data.DataSet)
_dv = _ds.Tables(0).D efaultView
_dv.Sort = e.SortExpressio n
gv_advertisemen ts.DataSource = _dv
gv_advertisemen ts.DataBind()
End Sub
Protected Sub gv_advertisemen ts_SelectedInde xChanged(ByVal sender As
Object, ByVal e As System.EventArg s) Handles
gv_advertisemen ts.SelectedInde xChanged
TextBox1.Text = gv_advertisemen ts.SelectedRow. Cells(4).Text()
End Sub
Protected Sub btn_Search_Adve rtisement_by_Da te_Click(ByVal sender As
Object, ByVal e As System.EventArg s) Handles
btn_Search_Adve rtisement_by_Da te.Click
_s_date = tb_start_date.T ext
_e_date = tb_end_date.Tex t
_ds = DataAccess.All_ Advertisements( _s_date, _e_date)
ViewState.Add(" _ds", _ds)
_dv = _ds.Tables(0).D efaultView
gv_advertisemen ts.DataSource = _dv
gv_advertisemen ts.DataBind()
End Sub
Protected Sub LinkButton1_Cli ck(ByVal sender As Object, ByVal e As
System.EventArg s)
TextBox1.Text = gv_advertisemen ts.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.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
<script language="javas cript" type="text/javascript">
</script>
<link href="Styles.cs s" rel="stylesheet " type="text/css" />
</head>
<body>
<form id="form1" runat="server" >
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:Panel ID="pnl_Adverti sements" runat="server" Height="160px"
Style="z-index: 100;
left: 296px; position: absolute; top: 24px" Width="464px">
<asp:UpdatePane l ID="upp_Adverti sements" runat="server">
<ContentTemplat e>
<asp:Panel ID="pnl_Scroll_ Advertisements" runat="server"
Height="160px" Width="456px" ScrollBars="Ver tical">
<asp:GridView ID="gv_advertis ements" runat="server"
AllowSorting="T rue" AutoGenerateCol umns="False" CellPadding="4"
ForeColor="#333 333" GridLines="None "
Height="152px" PageSize="5" Width="784px"
AutoGenerateSel ectButton="True ">
<FooterStyle BackColor="#5D7 B9D" Font-Bold="True"
ForeColor="Whit e" />
<Columns>
<asp:BoundFie ld DataField="Adve rtisement Name"
HeaderText="Adv ertisement Name" SortExpression= "Advertisem ent Name">
<HeaderStyle HorizontalAlign ="Left" />
</asp:BoundField>
<asp:BoundFie ld DataField="Pres ent Date"
HeaderText="Pre sent Date" SortExpression= "Present Date">
<HeaderStyle HorizontalAlign ="Left" />
</asp:BoundField>
<asp:BoundFie ld DataField="Expi ration Date"
HeaderText="Exp iration Date" SortExpression= "Expiration Date">
<HeaderStyle HorizontalAlign ="Left" />
</asp:BoundField>
<asp:BoundFie ld DataField="Adve rtisement ID"
HeaderText="Adv ertisement ID">
<HeaderStyle HorizontalAlign ="Left" />
</asp:BoundField>
</Columns>
<RowStyle BackColor="#F7F 6F3" ForeColor="#333 333" />
<EditRowStyle BackColor="#999 999" />
<SelectedRowSty le BackColor="#E2D ED6" Font-Bold="True"
ForeColor="#333 333" />
<PagerStyle BackColor="#284 775" ForeColor="Whit e"
HorizontalAlign ="Center" />
<HeaderStyle BackColor="#5D7 B9D" Font-Bold="True"
ForeColor="Whit e" />
<AlternatingRow Style BackColor="Whit e" ForeColor="#284 775" />
</asp:GridView>
</asp:Panel>
<asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox>
<cc1:HoverMenuE xtender ID="HoverMenuEx tender1"
runat="server" TargetControlID ="gv_advertisem ents" PopupControlID= "Panel1"
HoverCssClass=" popupHover" PopupPosition=" Top"
OffsetX="-10" OffsetY="-10" PopDelay="50">
</cc1:HoverMenuEx tender>
<asp:Panel ID="Panel1" runat="server" Height="50px"
Width="125px">
<asp:LinkButt on ID="LinkButton1 " runat="server"
CommandName="ed it" Text="edit"
OnClick="LinkBu tton1_Click"></asp:LinkButton> </asp:Panel>
</ContentTemplate >
<Triggers>
<asp:AsyncPostB ackTrigger
ControlID="btn_ Search_Advertis ement_by_Date" />
</Triggers>
</asp:UpdatePanel >
<asp:Button ID="btn_Search_ Advertisement_b y_Date" runat="server"
Text="Search Advertisements by Date" />
</asp:Panel>
<br />
<cc1:Accordio n ID="acc_Search_ Panes" runat="server"
SelectedIndex=" 0" SuppressHeaderP ostbacks="true" Width="224px"
Height="248px">
<Panes>
<cc1:AccordionP ane runat="server">
<Header>"Test 1" </Header>
<Content"Testin g This First Content" </Content>
</cc1:AccordionPa ne>
</Panes>
<Panes>
<cc1:AccordionP ane runat="server">
<Header>Dates </Header>
<Content>
<hr />
<asp:TextBox ID="tb_start_da te" runat="server" style="z-index:
104;" Width="152px"></asp:TextBox>
<asp:Image ID="img_start_d ate" 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_dat e" runat="server" Height="16px"
Style="z-index: 103;" Width="56px" />
<cc1:CalendarEx tender ID="cle_start_d ate" runat="server"
TargetControlID ="tb_start_date " PopupButtonID=" img_start_date" >
</cc1:CalendarExt ender>
<cc1:CalendarEx tender ID="cle_end_dat e" runat="server"
TargetControlID ="tb_end_dat e" PopupButtonID=" img_end_date">
</cc1:CalendarExt ender>
<hr />
</Content>
</cc1:AccordionPa ne>
</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:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<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_Adverti sement" runat="server"
Palette="Pastel " Width="800px">
<Legends>
<DCWC:Legend Name="Default">
<Position Height="8.02675 6" Width="28.09364 51"
X="68.90636" Y="3" />
</DCWC:Legend>
</Legends>
<Series>
<DCWC:Series Color="Red" Name="Failed"
BorderColor="64 , 64, 64" ShadowOffset="1 " ChartType="Stac kedColumn">
</DCWC:Series>
<DCWC:Series Color="Yellow" Name="Pending"
BorderColor="64 , 64, 64" ShadowOffset="1 " ChartType="Stac kedColumn">
</DCWC:Series>
<DCWC:Series BorderColor="64 , 64, 64" Color="Lime"
Font="Mistral, 8.25pt"
Name="Succeeded " ShadowOffset="1 "
ChartType="Stac kedColumn">
</DCWC:Series>
</Series>
<ChartAreas>
<DCWC:ChartAr ea Name="Default">
<AxisX>
<LabelStyle Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorTickMar k Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorGrid Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
</AxisX>
<Area3DStyle Enable3D="True" Light="Realisti c" />
<InnerPlotPosit ion Height="74.0824 4"
Width="75.69049 " X="20.13664" Y="3.35106" />
<Position Height="94" Width="62.90635 68" X="3"
Y="3" />
<AxisY>
<LabelStyle Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorTickMar k Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorGrid Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
</AxisY>
<AxisX2>
<LabelStyle Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorTickMar k Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorGrid Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
</AxisX2>
<AxisY2>
<LabelStyle Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorTickMar k Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorGrid Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
</AxisY2>
</DCWC:ChartArea>
</ChartAreas>
<Titles>
<DCWC:Title Name="ClickedEl ement">
<Position Width="94" X="3" Y="3" />
</DCWC:Title>
</Titles>
</DCWC:Chart>
<hr style="height: 1px" />
</ContentTemplate >
<%--<triggers>
<asp:AsyncPostB ackTrigger ControlID = "button1"
eventname="clic k" />
</triggers>--%>
</asp:UpdatePanel >
</asp:Panel>
Styles.css:
..sortheaderrow style {
background-color: #006699;
text-align: left;
font-weight: bold;
color:White;
}
..popupHover {
background-color:#F5F7F8;
}
..popupMenu {
background-color:#AAFFFF;
}
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.EventArg s) Handles Me.Load
If Not IsPostBack Then
_ds = DataAccess.All_ Advertisements( )
ViewState.Add(" _ds", _ds)
_dv = _ds.Tables(0).D efaultView
gv_advertisemen ts.DataSource = _dv
gv_advertisemen ts.DataBind()
End If
End Sub
Protected Sub gv_advertisemen ts_Sorting(ByVa l sender As Object, ByVal e
As System.Web.UI.W ebControls.Grid ViewSortEventAr gs) Handles
gv_advertisemen ts.Sorting
_ds = CType(ViewState .Item("_ds"), Data.DataSet)
_dv = _ds.Tables(0).D efaultView
_dv.Sort = e.SortExpressio n
gv_advertisemen ts.DataSource = _dv
gv_advertisemen ts.DataBind()
End Sub
Protected Sub gv_advertisemen ts_SelectedInde xChanged(ByVal sender As
Object, ByVal e As System.EventArg s) Handles
gv_advertisemen ts.SelectedInde xChanged
TextBox1.Text = gv_advertisemen ts.SelectedRow. Cells(4).Text()
End Sub
Protected Sub btn_Search_Adve rtisement_by_Da te_Click(ByVal sender As
Object, ByVal e As System.EventArg s) Handles
btn_Search_Adve rtisement_by_Da te.Click
_s_date = tb_start_date.T ext
_e_date = tb_end_date.Tex t
_ds = DataAccess.All_ Advertisements( _s_date, _e_date)
ViewState.Add(" _ds", _ds)
_dv = _ds.Tables(0).D efaultView
gv_advertisemen ts.DataSource = _dv
gv_advertisemen ts.DataBind()
End Sub
Protected Sub LinkButton1_Cli ck(ByVal sender As Object, ByVal e As
System.EventArg s)
TextBox1.Text = gv_advertisemen ts.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.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
<script language="javas cript" type="text/javascript">
</script>
<link href="Styles.cs s" rel="stylesheet " type="text/css" />
</head>
<body>
<form id="form1" runat="server" >
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:Panel ID="pnl_Adverti sements" runat="server" Height="160px"
Style="z-index: 100;
left: 296px; position: absolute; top: 24px" Width="464px">
<asp:UpdatePane l ID="upp_Adverti sements" runat="server">
<ContentTemplat e>
<asp:Panel ID="pnl_Scroll_ Advertisements" runat="server"
Height="160px" Width="456px" ScrollBars="Ver tical">
<asp:GridView ID="gv_advertis ements" runat="server"
AllowSorting="T rue" AutoGenerateCol umns="False" CellPadding="4"
ForeColor="#333 333" GridLines="None "
Height="152px" PageSize="5" Width="784px"
AutoGenerateSel ectButton="True ">
<FooterStyle BackColor="#5D7 B9D" Font-Bold="True"
ForeColor="Whit e" />
<Columns>
<asp:BoundFie ld DataField="Adve rtisement Name"
HeaderText="Adv ertisement Name" SortExpression= "Advertisem ent Name">
<HeaderStyle HorizontalAlign ="Left" />
</asp:BoundField>
<asp:BoundFie ld DataField="Pres ent Date"
HeaderText="Pre sent Date" SortExpression= "Present Date">
<HeaderStyle HorizontalAlign ="Left" />
</asp:BoundField>
<asp:BoundFie ld DataField="Expi ration Date"
HeaderText="Exp iration Date" SortExpression= "Expiration Date">
<HeaderStyle HorizontalAlign ="Left" />
</asp:BoundField>
<asp:BoundFie ld DataField="Adve rtisement ID"
HeaderText="Adv ertisement ID">
<HeaderStyle HorizontalAlign ="Left" />
</asp:BoundField>
</Columns>
<RowStyle BackColor="#F7F 6F3" ForeColor="#333 333" />
<EditRowStyle BackColor="#999 999" />
<SelectedRowSty le BackColor="#E2D ED6" Font-Bold="True"
ForeColor="#333 333" />
<PagerStyle BackColor="#284 775" ForeColor="Whit e"
HorizontalAlign ="Center" />
<HeaderStyle BackColor="#5D7 B9D" Font-Bold="True"
ForeColor="Whit e" />
<AlternatingRow Style BackColor="Whit e" ForeColor="#284 775" />
</asp:GridView>
</asp:Panel>
<asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox>
<cc1:HoverMenuE xtender ID="HoverMenuEx tender1"
runat="server" TargetControlID ="gv_advertisem ents" PopupControlID= "Panel1"
HoverCssClass=" popupHover" PopupPosition=" Top"
OffsetX="-10" OffsetY="-10" PopDelay="50">
</cc1:HoverMenuEx tender>
<asp:Panel ID="Panel1" runat="server" Height="50px"
Width="125px">
<asp:LinkButt on ID="LinkButton1 " runat="server"
CommandName="ed it" Text="edit"
OnClick="LinkBu tton1_Click"></asp:LinkButton> </asp:Panel>
</ContentTemplate >
<Triggers>
<asp:AsyncPostB ackTrigger
ControlID="btn_ Search_Advertis ement_by_Date" />
</Triggers>
</asp:UpdatePanel >
<asp:Button ID="btn_Search_ Advertisement_b y_Date" runat="server"
Text="Search Advertisements by Date" />
</asp:Panel>
<br />
<cc1:Accordio n ID="acc_Search_ Panes" runat="server"
SelectedIndex=" 0" SuppressHeaderP ostbacks="true" Width="224px"
Height="248px">
<Panes>
<cc1:AccordionP ane runat="server">
<Header>"Test 1" </Header>
<Content"Testin g This First Content" </Content>
</cc1:AccordionPa ne>
</Panes>
<Panes>
<cc1:AccordionP ane runat="server">
<Header>Dates </Header>
<Content>
<hr />
<asp:TextBox ID="tb_start_da te" runat="server" style="z-index:
104;" Width="152px"></asp:TextBox>
<asp:Image ID="img_start_d ate" 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_dat e" runat="server" Height="16px"
Style="z-index: 103;" Width="56px" />
<cc1:CalendarEx tender ID="cle_start_d ate" runat="server"
TargetControlID ="tb_start_date " PopupButtonID=" img_start_date" >
</cc1:CalendarExt ender>
<cc1:CalendarEx tender ID="cle_end_dat e" runat="server"
TargetControlID ="tb_end_dat e" PopupButtonID=" img_end_date">
</cc1:CalendarExt ender>
<hr />
</Content>
</cc1:AccordionPa ne>
</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:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<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_Adverti sement" runat="server"
Palette="Pastel " Width="800px">
<Legends>
<DCWC:Legend Name="Default">
<Position Height="8.02675 6" Width="28.09364 51"
X="68.90636" Y="3" />
</DCWC:Legend>
</Legends>
<Series>
<DCWC:Series Color="Red" Name="Failed"
BorderColor="64 , 64, 64" ShadowOffset="1 " ChartType="Stac kedColumn">
</DCWC:Series>
<DCWC:Series Color="Yellow" Name="Pending"
BorderColor="64 , 64, 64" ShadowOffset="1 " ChartType="Stac kedColumn">
</DCWC:Series>
<DCWC:Series BorderColor="64 , 64, 64" Color="Lime"
Font="Mistral, 8.25pt"
Name="Succeeded " ShadowOffset="1 "
ChartType="Stac kedColumn">
</DCWC:Series>
</Series>
<ChartAreas>
<DCWC:ChartAr ea Name="Default">
<AxisX>
<LabelStyle Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorTickMar k Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorGrid Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
</AxisX>
<Area3DStyle Enable3D="True" Light="Realisti c" />
<InnerPlotPosit ion Height="74.0824 4"
Width="75.69049 " X="20.13664" Y="3.35106" />
<Position Height="94" Width="62.90635 68" X="3"
Y="3" />
<AxisY>
<LabelStyle Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorTickMar k Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorGrid Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
</AxisY>
<AxisX2>
<LabelStyle Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorTickMar k Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorGrid Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
</AxisX2>
<AxisY2>
<LabelStyle Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorTickMar k Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
<MajorGrid Interval="Auto"
IntervalOffset= "Auto" IntervalOffsetT ype="Auto" IntervalType="A uto" />
</AxisY2>
</DCWC:ChartArea>
</ChartAreas>
<Titles>
<DCWC:Title Name="ClickedEl ement">
<Position Width="94" X="3" Y="3" />
</DCWC:Title>
</Titles>
</DCWC:Chart>
<hr style="height: 1px" />
</ContentTemplate >
<%--<triggers>
<asp:AsyncPostB ackTrigger ControlID = "button1"
eventname="clic k" />
</triggers>--%>
</asp:UpdatePanel >
</asp:Panel>
Styles.css:
..sortheaderrow style {
background-color: #006699;
text-align: left;
font-weight: bold;
color:White;
}
..popupHover {
background-color:#F5F7F8;
}
..popupMenu {
background-color:#AAFFFF;
}