473,385 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

AJAX error with GridView

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

Mar 5 '07 #1
2 5653
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
Mar 6 '07 #2
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:openPopup('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

Mar 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: davidjgonzalez | last post by:
I have a GridView that has paging enabled. Each item (as defined in an ItemTemplate) includes several controls which have operations i would like to Atlas-enable. Everything is working well except...
1
by: ashish ranjan | last post by:
Hi there, I m new in Ajax and right now i m trying to do small operation on gridview like add row in gridview, update and delete row from gridview with the help of Ajax. Please help me in...
1
by: William Youngman | last post by:
I have a gridview displaying data and would like to use the AJAX dropdown extender so that when the user clicks on a record a dropdown menu will display providing the user with a menu of selections...
0
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to...
0
by: jrnail23 | last post by:
I have a user control which contains an UpdatePanel, which contains a MultiView inside, with a GridView in one of the views. In my GridView, I have a ButtonField which is supposed to trigger a...
2
by: Raymond Du | last post by:
Hi, I am looking for a way to use Ajax inside gridview. I am not talking about putting a gridview inside an updatepanel and refresh the gridview, I want to use Ajax on per row basis, when user...
3
by: Jonathan Wood | last post by:
I am completely new to AJAX. I have a GridView control and my client is complaining that, whenever they select a row in the grid, the page resets to the top of the page. It seems like AJAX...
1
by: Cirene | last post by:
I had a non-ajaxed page with a gridview. I wanted to ajax it. I added the scriptmanager at the top. I added an updatepanel below. I dragged the gridview into it. In my design view I got...
1
by: wagswvu | last post by:
I am trying to enclose SPGridView inside an UpdatePanel control in a user control page (.ascx), however whenever I click on the paging links for the grid, it still postbacks instead of partial page...
6
by: SAL | last post by:
hello, I'm using a radiobuttonlist in an updatepanel in an item template in a Gridview control. I'm populating the radiobuttonlist in the RowDataBound event. I have the control toolkit registered...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.