Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > AJAX error with GridView

Reply
Thread Tools

AJAX error with GridView

 
 
=?Utf-8?B?c3Jpbml2YXM=?=
Guest
Posts: n/a
 
      03-05-2007
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



 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      03-06-2007
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
>
>
>

 
Reply With Quote
 
 
 
 
=?Utf-8?B?c3Jpbml2YXM=?=
Guest
Posts: n/a
 
      03-06-2007
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="javascriptpenPopup('NewCity.aspx?LaneID=<% #
DataBinder.Eval(Container.DataItem, "LaneID") %> &Type=0')" id='lnkOrigin'
name='lnkOrigin'>Add New</a>

<div>
<aspanel 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>
</aspanel>
<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
> >
> >
> >

>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
An Ajax Dictionary... My first AJAX project... GreatDomainz@gmail.com HTML 20 03-31-2008 01:24 PM
ASP.NET AJAX Enabled Website Web.config error (newbie to AJAX) Tony K ASP .Net 2 05-04-2007 04:23 AM
AJAX IDE and AJAX TOOL--The Release of JoyiStar AJAX WebShop 3 Beta minnie Java 1 12-13-2006 06:29 AM
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
beginner AJAX questions (AJAX.net) darrel ASP .Net 5 04-28-2006 06:42 PM



Advertisments