Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

populate gridview inside BalloonPopupExtender inside other gridview

$
0
0

Hello all -- I've spent considerable time playing with this over the last few days and have barely got anywhere.  

I have a gridview created from 2 dropdowns selecting county and class.  On class selection the grid populates with the dates of the class, people that are in that county, and whether they have RSVP'd or attended the class.  Here's the grid:

<div id="middle"><asp:UpdatePanel ID="GridUpdatePanel" runat="server" ChildrenAsTriggers="true" RenderMode="Block" UpdateMode="Always" EnableViewState="true"><Triggers><asp:PostBackTrigger ControlID="gridAttend" /></Triggers><ContentTemplate><asp:GridView ID="gridAttend" runat="server" DataKeyNames="Attended, cid, sid, RSVP"
	DataSourceID="SqlAttendance" AutoGenerateColumns="false" ><EmptyDataTemplate><b>There are no contacts in this county that match the search criteria</b></EmptyDataTemplate><Columns><asp:BoundField DataField="cld" HeaderText="Class Date" DataFormatString="{0:MM/dd/yyyy}" /><asp:TemplateField HeaderText="Attended" ><ItemTemplate><asp:LinkButton ID="lnkAtt" runat="server" CommandName="Attended"
			 CommandArgument='<%# Container.DataItemIndex%>'><asp:Image id="imageAttended" runat="server" style="border:0;"   /></asp:LinkButton></ItemTemplate></asp:TemplateField><asp:BoundField DataField="FN" HeaderText="First" /><asp:TemplateField HeaderText="Last"><ItemTemplate><asp:Label ID="lblLastName" runat="server" Text='<%# Eval("LN")%>'   /><ajaxToolkit:BalloonPopupExtender ID="BalloonPopupExtender1" runat="server"
			 TargetControlID="lblLastName"
			 DisplayOnClick="true"
			 DisplayOnFocus="false"
			 DisplayOnMouseOver="true"
			 BalloonPopupControlID="pnlLastNamePopup"
			 BalloonSize="Large"
			 Position="Auto"
			 ScrollBars="Auto"
			 BalloonStyle="Rectangle"
		/><div style="display:none"><asp:Panel ID="pnlLastNamePopup" runat="server" Width="250"  ><asp:Label ID="lblPanelEmail" runat="server" Text="Email:"CssClass="bold" />&nbsp;&nbsp;<asp:Label ID="lblBubbleEmail" runat="server" Text='<%# Eval("Email")%>'  /><br /><asp:Label ID="lblPanelCompany" runat="server" Text="Company:" CssClass="bold" />&nbsp;&nbsp;<asp:Label ID="lblBubbleCompany" runat="server" Text='<%# Eval("Org")%>'  /><br /><asp:Label ID="lblPanelClasses" runat="server" Text="Classes Taken:" CssClass="bold" /><br /><asp:GridView ID="gridBubbleClassesTaken" runat="server" AutoGenerateColumns="true"  OnDataBinding="gridBubbleClassesTaken_DataBinding"
	DataSourceID="SqlBubbleGrid" ></asp:GridView></asp:Panel></div></ItemTemplate></asp:TemplateField><asp:BoundField DataField="County" HeaderText="County" /><asp:TemplateField HeaderText="RSVP"><ItemTemplate><asp:LinkButton ID="lnkRSVP" runat="server" CommandName="RSVP" CommandArgument='<%# Container.DataItemIndex%>' ><asp:Image id="imageRSVP" runat="server" style="border:0;"  /></asp:LinkButton></ItemTemplate></asp:TemplateField><asp:BoundField DataField="Attended"  Visible="true" ItemStyle-ForeColor="White"  /><asp:BoundField DataField="RSVP"  Visible="true" ItemStyle-ForeColor="White" /><asp:BoundField DataField="cid" Visible="true" ItemStyle-ForeColor="White" /><asp:BoundField DataField="sid" Visible="true" ItemStyle-ForeColor="White" /></Columns></asp:GridView></ContentTemplate></asp:UpdatePanel></div>

Here is the SqlDataSource for the grid inside the popup bubble:

<asp:SqlDataSource ID="SqlBubbleGrid" runat="server" 
   ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
  SelectCommand="SELECT s.ClassDate as Date, cl.ClassName as Class, a.Attended as Att, a.RSVP FROM Attendance a 
 LEFT JOIN Schedule s ON a.ScheduleID=s.ScheduleID 
 RIGHT JOIN Classes cl ON s.ClassID=cl.ClassID 
 RIGHT JOIN Contacts c ON c.ContactID=a.ContactID 
 RIGHT JOIN County cty ON  s.CountyID = cty.CountyID 
  WHERE a.ContactID=@cid ORDER BY Att DESC">   <SelectParameters><asp:CookieParameter Direction ="Input" Name="cid" CookieName="CID" /> </SelectParameters></asp:SqlDataSource>

the SQL for the first gridview is in the code behind. 

The bubble pops up fine and the labels show the correct data fine (coming from the primary gridview SQL) but I cannot get the bubble gridview to show the correct information.  In part because the "cid" cookie parameter is not getting set and the WHERE clause literally says "WHERE a.ContactID=@cid ...".   (this is my first attempt at using a cookie so I may not have that right either)  Also the bubble grid never changes after the first hover for each class.  If I change the class dropdown so that the main grid reloads with new data and then hover over a last name and the bubble grid will show different information - but then it stays the same regardless of the last name hovered.

I have tried using the following code in a number of events to set the bubble grid:

Dim icid As Integer
lblSQL.Text = SqlBubbleGrid.SelectCommand.ToString
icid = gridAttend.DataKeys(irow).Item("cid")
Dim cookie As HttpCookie
cookie = New HttpCookie("CID", icid.ToString)
Response.Cookies.Add(cookie)

the events I have tried that code with are:  BalloonPopupExtender_ResolveControlID, BalloonPopupExtender_DataBinding, BalloonPopupExtender_Prerender, BalloonPopupExtender_Load, as well as several with pnlLastNamePopup and SqlBubbleGrid.  All seem to run the code as the primary grid is loading and never during the actual bubble popping up.

So... does anyone know which event runs when the bubble pops up?  I won't know how to populate the bubble grid until the last name is hovered over which displays the bubble so it cannot be any earlier.

thanks in advance.





Viewing all articles
Browse latest Browse all 5678

Trending Articles