AJAX error with GridView

G

Guest

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
 
B

bruce barker

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)
 
G

Guest

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


:
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top