Click here to Skip to main content
12,247,575 members (56,247 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: .NET Ajax .NET4
I am trying to make several hyperlinks be the target control of a popupcontrolextender. Right now the hyperlink1 triggers everything correctly, but i need to have the panel1 and panel2 popup, with data dynamically filled, for the other links as well. Here is the code:
<asp:Panel ID="Panel3" runat="server">
    <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional" >
    <ContentTemplate>
 <asp:LinkButton ID="LinkButton1" CssClass="calendar" onmouseover="$find(this).showPopup();" 
                    onmouseout="$find(this).hidePopup();" onClick="LinkButton1_Click" value="LinkButton6"
                rel="nofollow" runat="server">hi</asp:LinkButton>
                <asp:LinkButton ID="LinkButton60"  onmouseover="$find(this).showPopup();" 
                    onmouseout="$find(this).hidePopup();" onClick="LinkButton1_Click" value="LinkButton6" 
                    runat="server">LinkButton</asp:LinkButton>
                <asp:LinkButton ID="LinkButton120"  onmouseover="$find('this').showPopup();" 
                    onmouseout="$find(this).hidePopup();" onClick="LinkButton1_Click" value="LinkButton12" 
                    runat="server">LinkButton12</asp:LinkButton>
//many more links....
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:Panel ID="Panel1" CssClass="popup" runat="server">
        <Triggers>
                <asp:AsyncPostBackTrigger ControlID="LinkButton60" EventName="click" />
        <asp:AsyncPostBackTrigger ControlID="LinkButton120" EventName="click"/>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div>
                Event:
                <asp:Literal ID="Literal1" runat="server"></asp:Literal><br />
                Time:
                <asp:Literal ID="Literal2" runat="server"></asp:Literal><br />
                Location:
                <asp:Literal ID="Literal3" runat="server"></asp:Literal><br />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
     <asp:BalloonPopupExtender ID="BalloonPopupExtender1" BalloonPopupControlID="Panel1"
        Position="TopRight" TargetControlID="LinkButton60" runat="server" BalloonSize="Medium"
        DisplayOnMouseOver="True" DynamicContextKey="value" DynamicControlID="Panel1" DynamicServicePath="DynamicPopulate.asmx.cs"
        DynamicServiceMethod="UpdatePanel1_DynamicPopulateExtender">
    </asp:BalloonPopupExtender>
    <asp:Panel ID="Panel2" runat="server" CssClass="popup">
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
            <asp:Image ID="Image1" Style="height: auto;" ImageUrl="imagename.jpg" 
                AlternateText="Comedy Masque Review"
                BorderColor="green" BorderStyle="Ridge" BorderWidth="6px" 
                runat="server" Width="300px" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>
<asp:PopupControlExtender ID="PopupControlExtender1" runat="server" Position="Bottom" 
    DynamicContextKey="value" DynamicControlID="Panel2" 
    DynamicServiceMethod="PlaceHolder1_DynamicPopulateExtender" DynamicServicePath="DynamicPopulate.asmx.cs" 
    BehaviorID="onclick" PopupControlID="Panel2" TargetControlID="LinkButton60" CommitProperty="value" CommitScript="onOK();"></asp:PopupControlExtender>
    </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI.WebControls;
 
namespace something
{
    /// <summary>
    /// Summary description for DynamicPopulate
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
     [System.Web.Script.Services.ScriptService]
    public class DynamicPopulate : System.Web.Services.WebService
    {
 
        [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
        public string PlaceHolder1_DynamicPopulateExtender(string contextKey)
        {
            string s = "got to service method";
 
            return s;
        }
        [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
        public  string UpdatePanel1_DynamicPopulateExtender(string contextKey)
        {
            string s = "got to service method";
 
            return s;
 
        }
    }
}

CAN'T get into service method call failed: 403(Forbidden). (Although use successfully SlideService WebService in same project)
Did search on internet, and thought i needed to add proxy to config file, but must not be doing it correctly:
I am using an IIS local host:
 http://localhost:50867/RoutingName<pre>
and must not be modifying the code below correctly!  Can you help?
<configuration>
  <system.net>
    <defaultproxy>
      <proxy>
        usesystemdefaults="true"
        proxyaddress="http://192.168.1.10:3128"
        bypassonlocal="true"
      />
Posted 26-Nov-12 13:18pm
Edited 28-Nov-12 12:48pm
v4
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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

        <asp:LinkButton ID="LinkButton1" runat="server" Text="Click here"  onclick="LinkButton1_Click"/>
        <asp:LinkButton ID="LinkButton2" runat="server" Text="Click here"  onclick="LinkButton1_Click"/>
        <asp:LinkButton ID="LinkButton3" runat="server" Text="Click here"  onclick="LinkButton1_Click" />
 

        <asp:Panel ID="Panel1" runat="server" Style="display: none" CssClass="modalPopup">
 

            <asp:Button ID="OkButton" runat="server" Text="OK" />
            <asp:Button ID="CancelButton" runat="server" Text="Cancel" />
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="LinkButton1"  EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="LinkButton2"  EventName="Click"/>
                    <asp:AsyncPostBackTrigger ControlID="LinkButton3"  EventName="Click"/>
                </Triggers>
            </asp:UpdatePanel>
        </asp:Panel>
 

         <asp:LinkButton ID="hiddenbutton" runat="server" style="display:none" />
 

          <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server"
            TargetControlID="hiddenbutton"
            PopupControlID="Panel1"
            BackgroundCssClass="modalBackground"
            OkControlID="OkButton"
            BehaviorID="ModalPopupBehavior"
            CancelControlID="CancelButton"
            DropShadow="true"
             />
protected void LinkButton1_Click(object sender, EventArgs e)
  {
 
      Label1.Text = ((LinkButton)sender).ID;
      ModalPopupExtender.Show();
  }

You can also use JavaScript to show the ModalPopup.
<ajaxToolkit:ToolkitScriptManager runat="Server" ID="ScriptManager1" />
 
       <asp:LinkButton ID="LinkButton1" runat="server" Text="Click here" OnClientClick="$find('ModalPopupBehavior').show();return false;" />
       <asp:LinkButton ID="LinkButton2" runat="server" Text="Click here" OnClientClick="$find('ModalPopupBehavior').show();return false;" />
       <asp:LinkButton ID="LinkButton3" runat="server" Text="Click here" OnClientClick="$find('ModalPopupBehavior').show();return false;" />
 
       <asp:Panel ID="Panel1" runat="server" Style="display: none" CssClass="modalPopup">
           <asp:Button ID="OkButton" runat="server" Text="OK" />
           <asp:Button ID="CancelButton" runat="server" Text="Cancel" />
 
       </asp:Panel>
 
        <asp:LinkButton ID="hiddenbutton" runat="server" style="display:none" />
       <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server"
           TargetControlID="LinkButton1"
           PopupControlID="Panel1"
           BackgroundCssClass="modalBackground"
           OkControlID="OkButton"
           BehaviorID="ModalPopupBehavior"
           CancelControlID="CancelButton"
           DropShadow="true"
            />
  Permalink  
Comments
Member 9445358 27-Nov-12 0:50am
   
BUT cannot have okbutton and cancel for them...there are many links, and update panel is inside the popup!!!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Sorry. dynamic method was referencing ".asmx.cs" and needed to be ".asmx"
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160426.1 | Last Updated 29 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100