AJAX error with GridView

Discussion in 'ASP .Net' started by =?Utf-8?B?c3Jpbml2YXM=?=, Mar 5, 2007.

  1. Hi All,
    I'm having a grid view(GridView1) with a hyperlink column.It's ID is Link1
    I want to show a popup on hyperlink click.
    I'm using ajaxToolkit:ModalPopupExtender for that.
    But when i'm using TargetControlID="Link1" for ajaxToolkit:ModalPopupExtender
    I'm getting an error

    System.InvalidOperationException: The TargetControlID of
    'ModalPopupExtender1' is not valid. A control with ID 'Link1' could not be
    found.

    My ajaxToolkit syntax is

    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
    TargetControlID="GridView1"
    PopupControlID="Panel1"
    BackgroundCssClass="modalBackground"
    DropShadow="true"
    CancelControlID="CancelButton" />

    Thanks in advance
     
    =?Utf-8?B?c3Jpbml2YXM=?=, Mar 5, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?c3Jpbml2YXM=?=

    bruce barker Guest

    the popup extender must be declared in the row/col template, so instead
    of a link column, put a link and the extender in the row/column template.

    -- bruce (sqlwork.com)

    srinivas wrote:
    > Hi All,
    > I'm having a grid view(GridView1) with a hyperlink column.It's ID is Link1
    > I want to show a popup on hyperlink click.
    > I'm using ajaxToolkit:ModalPopupExtender for that.
    > But when i'm using TargetControlID="Link1" for ajaxToolkit:ModalPopupExtender
    > I'm getting an error
    >
    > System.InvalidOperationException: The TargetControlID of
    > 'ModalPopupExtender1' is not valid. A control with ID 'Link1' could not be
    > found.
    >
    > My ajaxToolkit syntax is
    >
    > <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
    > TargetControlID="GridView1"
    > PopupControlID="Panel1"
    > BackgroundCssClass="modalBackground"
    > DropShadow="true"
    > CancelControlID="CancelButton" />
    >
    > Thanks in advance
    >
    >
    >
     
    bruce barker, Mar 6, 2007
    #2
    1. Advertising

  3. hi Bruce
    Thanks for the reply.
    I tried the way you suggested.But still i'm getting the same error.
    System.InvalidOperationException: The TargetControlID of
    'ModalPopupExtender1' is not valid. A control with ID 'lnkOrigin' could not
    be
    found.

    Here's the my code

    <asp:GridView ID="gvLaneDetails" runat="server" AutoGenerateColumns="False"
    Width="90%" AllowSorting=True BorderStyle="Solid" CellPadding="4"
    ForeColor="#333333" GridLines="None" BorderColor="White" BorderWidth="1px" >
    <Columns >
    <asp:TemplateField>
    <ItemTemplate>
    <a href="javascript:eek:penPopup('NewCity.aspx?LaneID=<%#
    DataBinder.Eval(Container.DataItem, "LaneID") %> &Type=0')" id='lnkOrigin'
    name='lnkOrigin'>Add New</a>

    <div>
    <asp:panel ID="Panel1" runat="server" CssClass="modalPopup"
    Style="display: none" Width="233px">
    <table style="width: 336px; font-family: Tahoma; height:9em"
    border="1" bordercolor="black">
    <tr style="background-color:#507CD1" >
    <td align="center" colspan="3" style="font-size: 9pt;
    border-top-style: none; border-right-style: none; border-left-style: none;
    border-bottom-style: none; color: white; ">
    Enter a City</td>
    </tr>
    <tr>
    <td align="center" colspan="3" style="border-top-style:
    none; border-right-style: none; border-left-style: none; border-bottom-style:
    none">
    <input id="txtCity" type="text" style="width: 236px"
    /><br />
    <input id="chkAllCities" type="checkbox" /><label
    id="lblAll" style="font-family:Tahoma; font-size:small">Apply to all cities
    with same error</label></td>
    </tr>
    <tr>
    <td align="center" colspan="3" style="border-top-style:
    none; border-right-style: none; border-left-style: none; border-bottom-style:
    none" >
    <input id="btnAdd" type="button" value="Add"
    onclick="win();" style="width: 75px" />
    <asp:Button ID="Button1" runat=server />
    </td>
    </tr>
    </table>

    <div align="center">
    <asp:Button ID="OkButton" runat="server" Text="OK" />
    <asp:Button ID="CancelButton" runat="server" Text="Cancel" />
    </div>
    </asp:panel>
    <br />

    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
    TargetControlID="lnkOrigin"
    PopupControlID="Panel1"
    BackgroundCssClass="modalBackground"
    DropShadow="true"
    CancelControlID="CancelButton" />

    </div>

    </ItemTemplate>
    <ItemStyle Width="50px" BorderStyle="None" />
    <HeaderStyle BorderColor="White" BorderStyle="None" />
    </asp:TemplateField>
    </Columns>
    <AlternatingRowStyle BackColor="White" BorderStyle="Solid"
    Wrap="True" BorderColor="White" BorderWidth="1px" />
    <HeaderStyle BackColor="#507CD1" BorderColor="White"
    BorderStyle="Solid" BorderWidth="2px" Height=10px Font-Bold="True"
    ForeColor="White" HorizontalAlign="Center" />
    <RowStyle height="10px" BackColor="#EFF3FB" BorderColor="White"
    BorderStyle="Solid" BorderWidth="1px" />

    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True"
    ForeColor="#333333" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True"
    ForeColor="White" />
    <EditRowStyle BackColor="#2461BF" />
    <PagerStyle BackColor="#2461BF" ForeColor="White"
    HorizontalAlign="Center" />
    </asp:GridView>

    Thanks
    Srinivas


    "bruce barker" wrote:



    > the popup extender must be declared in the row/col template, so instead
    > of a link column, put a link and the extender in the row/column template.
    >
    > -- bruce (sqlwork.com)
    >
    > srinivas wrote:
    > > Hi All,
    > > I'm having a grid view(GridView1) with a hyperlink column.It's ID is Link1
    > > I want to show a popup on hyperlink click.
    > > I'm using ajaxToolkit:ModalPopupExtender for that.
    > > But when i'm using TargetControlID="Link1" for ajaxToolkit:ModalPopupExtender
    > > I'm getting an error
    > >
    > > System.InvalidOperationException: The TargetControlID of
    > > 'ModalPopupExtender1' is not valid. A control with ID 'Link1' could not be
    > > found.
    > >
    > > My ajaxToolkit syntax is
    > >
    > > <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
    > > TargetControlID="GridView1"
    > > PopupControlID="Panel1"
    > > BackgroundCssClass="modalBackground"
    > > DropShadow="true"
    > > CancelControlID="CancelButton" />
    > >
    > > Thanks in advance
    > >
    > >
    > >

    >
     
    =?Utf-8?B?c3Jpbml2YXM=?=, Mar 6, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    20
    Views:
    1,908
    d1srupt3r
    Mar 31, 2008
  2. darrel

    beginner AJAX questions (AJAX.net)

    darrel, Apr 27, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    2,443
    Flinky Wisty Pomm
    Apr 28, 2006
  3. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    17,979
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
  4. minnie
    Replies:
    1
    Views:
    708
    Andrew Thompson
    Dec 13, 2006
  5. Tony K
    Replies:
    2
    Views:
    1,048
    Tony K
    May 4, 2007
Loading...

Share This Page