Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, October 24, 2006 4:11 PM
I have a fairly complex web application that loads UserControls dynamically based on what section the user selects.
Me.pnlBodyCell.Controls.Clear()
Me.pnlBodyCell.Controls.Add(Page.LoadControl(PortalInfo.CurrentSectionURL))
The UserControls contain RoundedCornersExtender and CollapsiblePanelExtender controls as well as UpdatePanel controls.
After updating to the latest AJAX Framework Beta, I am now seeing the following JavaScript error:
Line: 1961
Char: 23
Error: Sys.ArgumentException: Value must not be null for Controls and Behaviors.
Parameter name: element
Code: 0
Has anyone else seen this issue and does anyone have any suggestions?
Thanks!
-Joe
All replies (34)
Thursday, October 26, 2006 9:29 AM
I have the same probleme when I put a <asp:UpdateProgress> on my masterpage. I'm using the latest ASP.NET AJAX Control Toolkit. Hopefuly somebody have a solution, because everythings works fine before and now I got this error!!!!
Line: 1961
Char: 23
Error: Sys.ArgumentException: Value must not be null for Controls and Behaviors.
Parameter name: element
Code: 0
many thanks!!
-Pack27
Thursday, October 26, 2006 9:33 AM
Sorry i'm using Microsoft ASP.NET AJAX CTP Beta for the UpdateProgress...
-Pack27
Friday, October 27, 2006 6:34 PM
Yep - I have the same issue - OK in Atlas version not in Ajax version
I'm using a gridview with hovermenu control - Note the error message does not appear in Firefox 2.0 although the layout get screwed but that another problem
The error on page message is the browser is aliitle of putting when demostrate -steve
Friday, October 27, 2006 8:15 PM
That exception comes from the ASP.NET AJAX framework. It's basically saying that it was unable to find the element that a behavior is attached to. There's not enough info here to debug more than that. Make sure the target element is being rendered to the the page and also see the Caveat on my posting (at the top of the forum) about templates and repeaters.
Thanks
Friday, October 27, 2006 11:43 PM
Can you provide a link to the Caveat ?
I have started to rearrange the page and just changing the layout the error has gone. it may have sometine to do with panels and visibility not sure .
I would like to understand how my changes removed the error (I know its almost impossible to share in detail what I'm doing in this forum [:(])- and any thoughts on why was the error not reported in Firefox?
Saturday, October 28, 2006 12:01 AM
Sorry the re-arrangement did not remove the error still searching
Sunday, October 29, 2006 12:40 AM
Found out the problem - The gridview I'm using has a number of columns which are displayed based on a checkbox - One of the columns has a HoverMenuExtender nested in the grid Itemtemplate tag . If the page tries to display itself with this column set to not visible the control throws the page error . Previous code (atlas) did not care - if the columns Visible property was set to false.
I would be interested if the Ajax team might consider returning the previous behaviour ....
Monday, November 6, 2006 9:15 PM
I have the "Re: Error: Sys.ArgumentException: Value must not be null for Controls and Behaviors." problem. For convenience i will name it Xerr. I'v thought that there is a problem if the popup control extender (textbox + calendar + popupcontrolextender scenario) is in a table on a user control which is used in a page having a master page (i name this scenario Serr). Seems that is not the error appearing conditions, because this problem appears random. I'v start a new project (web site) and recreated the scenario and WORKED!. I don't understand where this problemm comes in.
I notice that the problem disappeared after i'v placed an other ScriptManager on the master page. I'v runnned again ang get normally "Only one script manager per page allowed". After that i'v deleted the second ScriptManager from the master page and Xerr never appeared again.
OBS: I think that this problemm is connected to some files/data that ScriptManager stores on the machine / available from all AjaxToolkit projects. Is there any place where the AjaxToolkit stores data common for all AjaxToolkit enabled projects on the machine? Why asking that? Because:
STEP1: I create project P1. Create the scenario Serr. Problem Xerr appears.
STEP2: I create project P2. Create the scenario Serr. Problem Xerr appears.
OBS: P1 and P2 absolutely identical (control, pages names) only site name differend.
STEP3: On P2 i place an extra ScriptManager on the master page.
STEP4: Run P2 and get the error that states that only one script manager allowed per page.
STEP5. Delete second script manager from P2, run P2 and the Xerr DOES NOT APPEARS ANYMORE!!!
STEP6 (The best of all): Run P1 and Xerr DOES NOT APPEAR HERE.
Monday, November 6, 2006 9:16 PM
I have the "Re: Error: Sys.ArgumentException: Value must not be null for Controls and Behaviors." problem. For convenience i will name it Xerr. I'v thought that there is a problem if the popup control extender (textbox + calendar + popupcontrolextender scenario) is in a table on a user control which is used in a page having a master page (i name this scenario Serr). Seems that is not the error appearing conditions, because this problem appears random. I'v start a new project (web site) and recreated the scenario and WORKED!. I don't understand where this problemm comes in.
I notice that the problem disappeared after i'v placed an other ScriptManager on the master page. I'v runnned again ang get normally "Only one script manager per page allowed". After that i'v deleted the second ScriptManager from the master page and Xerr never appeared again.
OBS: I think that this problemm is connected to some files/data that ScriptManager stores on the machine / available from all AjaxToolkit projects. Is there any place where the AjaxToolkit stores data common for all AjaxToolkit enabled projects on the machine? Why asking that? Because:
STEP1: I create project P1. Create the scenario Serr. Problem Xerr appears.
STEP2: I create project P2. Create the scenario Serr. Problem Xerr appears.
OBS: P1 and P2 absolutely identical (control, pages names) only site name differend.
STEP3: On P2 i place an extra ScriptManager on the master page.
STEP4: Run P2 and get the error that states that only one script manager allowed per page.
STEP5. Delete second script manager from P2, run P2 and the Xerr DOES NOT APPEARS ANYMORE!!!
STEP6 (The best of all): Run P1 and Xerr DOES NOT APPEAR HERE.
Monday, November 6, 2006 10:47 PM
First logical conclusion/fact about the Xerr problemm (note/convention: Sys.ArgumentException: Value must not be null for Controls and Behaviors == 'Xerr'):
Scenario:
1. Run the page from APPENDIX and observe that all works just fine (right click\ViewSource... and see that there exists redered the Calendar1 control).
2. Edit the page and set Calendar1.Visible = false from IDE (design time) or from server code in Page_Load event handler.
3. Run and get Xerr (right click\ViewSource... and see that there is no trace of Calendar1 control which determines that JavaScript code from WebResource.axd at line 1961 not find Calendar1, because PopupControlID of the server control PopupControlExtender1 is set to Calendar1)..
Take me to this Conclusion/Guide:
Never set visibility from server code/design attributes to the PopupControl, because ASP.NET does not renders to page output server controls marked as Visible=false.
As i'v seen on this thread, are a lot of cases which led to Xerr problemm (using usercontrols dinamically loaded in pages, datagrids, etc). I think that all the cases have in comun this thing (client side code of Ajax infrastructure does not find controls declared as PopupControlId at design time because they are not rendered.
I'd like that ASP team from Microsoft implement a bool property named RenderInvisible to Control base class. This because there can exist cases when inaccessible server code set the Visible property of the PopupControl controls, which will lead to scarry Xerr. In that way (having accessible the RenderInvisible and set it we assure that the control is rendered to html output (... style='visibility: hidden' ... )) we can avoid Xerr errors (note: Xerr errors are not only for Atlas Toolkit, they may appear even in our server controls ).
The wired thing now:
The bad news are that are cases when even i set Visible = false on a Calendar and it works. This is not logical anymore, is not it? I think that there is more than above Conclusion/Guide. If i found that i will post it here. [Yes]
APPENDIX:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="Microsoft.Web.UI" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
</div>
<cc1:PopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="Calendar1"
TargetControlID="TextBox1">
</cc1:PopupControlExtender>
</form>
</body>
</html>
Tuesday, November 7, 2006 4:43 AM
Yes, as below this is all caused by components that are not rendered by ASP.NET. For TargetControlID, we do check that the target is visible and prevent script hookup if it is not. For other Control IDs, this logic isn't in place. Doing so it a bit more complicated but we'll look into that. Good job debugging that, sorry that it wasn't clear what the issue was.
Changes to the Control base class aren't helpful here, and even if they were, a change to the Framework (System.Web.DLL) bits have to meet a very high bar at this point. This has a workaround so it would not meet that bar. If you don't have access to the server code that's setting Visible=False, you wouldn't have access to RenderInvisible either. In any case, the easy way to do this is just add "style='display:none;' to the element, which creates the correct behavior.
So your best bet is to check the Visiblility on the server side, and if it's not visible, set Enabled on the Extender to false:
if (!Calendar1.Visible) PopupControlExtender1.Enabled = false;
Thanks,
Shawn
Friday, November 17, 2006 3:38 AM
Hey friends, I came up with a very simple solution to this problem....
I was experiencing the same problem from last 6 hours.....
I just went smart and made a small change. Its explained below...
I had this thing in my file:
<!-- <cc1:Accordion ID='Accordion2' runat='server' AutoSize="None" SelectedIndex="-1">
</cc1:Accordion> -->
I mean the Accordion used before was commented out, and I came across this error..
After reading the posts here I realized that the AJAX Script Manager searches for the control which was on the page before and now its commented.
So to satisfy the Script Manager's hunger I removed the comments.
I replaced above code with the following code:
<cc1:Accordion ID='Accordion2' runat='server' AutoSize="None" SelectedIndex="-1">
</cc1:Accordion>
Now, my application runs fine because the hungry Script Manager has found its beloved Accordion2...
And as I haven't wrote anything inside the Accordion it works fine, and its not shown on the page tooo..
Happy Programming guys..
Have a nice time ahead
Sunday, July 29, 2007 2:55 PM
Hi, i have same problem, i use a code that it was in comment :
<!-- <ajaxToolkit:ModalPopupExtender DropShadow="false" BackgroundCssClass="modalBackground" ID="block" runat="server" X="0" Y="300" TargetControlID="blockpanel" PopupControlID="blockpanel" ></ajaxToolkit:ModalPopupExtender>
<center>
<div style=" z-index:10000; font-family:tahoma; font-weight:bold; color:Red; font-size:14px; background-color:White; width:100%; direction:rtl; vertical-align:middle; text-align:center; " id="blockpanel" runat="server">
<center> Some TexT </center></div></center> -->
i remove it , and page load successfully,
Best regards
Saturday, March 1, 2008 7:18 PM
Thanks for the post! Solved my problem too.
I replaced by <!-- --> comments with <%-- --> comment blocks instead. Since <%-- --> comments are not rendered it solved my problem.
Wednesday, August 27, 2008 5:00 PM
Btw, I just wanted to highlight a fix (mentioned above), that worked for me and my AJAX extenders.
It was visibility of my panel, being set to False, that was the problem... The panel (which I copied from another instance) truly wasn't being presented to the browser, thus the ajax-control couldn't find it.
Wild. And I've spent Hours trying to figure out why my extender wasn't working while others' were.... %)
Friday, September 5, 2008 7:10 AM
Hi, come in a bit late on this one, but i'm getting this error and no matter how i jiggle things on the page the error won't budge.
I have a panel with two textboxes on it as the popup. The panel is set to visible = true. I call the popup from the indexselected of the gridview 'select' button.
But when i load the page, the error is thrown, and the panel appears on the page.
I have moved the panel code to the top of the page, thinking it will be appear to the page, the extender code is after the gridview. I am pulling what little hair i have out, refusing to hit the screen. I have just improved my page by following Joe Stagners video http://www.asp.net/learn/ajax-videos/video-85.aspx on the modal popup, it is now only visible until the Select button clicked...BUT the error still appears when i load the page initially.
Any clues?
Saturday, September 6, 2008 3:19 AM
Hmmm... I'd have to see the code to really debug the issue. I DO know that, if the panel is appearing... then the connection has Not been made between the button and the extender.
Also, for gridviews (or datagrids), in my experience, the extender HAD to be in the same ItemTemplate (or whatever column-type you're dealing with) as the button which calls it... thus, in the markup-code, right after the button-markup, to be safe. Thus, an extender is created for each button that is created for each row.
I'm also not too familiar with how you're calling the popup (tho the panel being visible is your 1st problem to fix). It sounds like you're calling the .show() method of the panel, itself, and I'm not familiar with this... as I've struggled a Ton with flaky javascript issues behind AJAX (also having MANY tutorials that "are touted to work", but don't for me).
The best general advice I can also offer is to just create a test-project and get your page down to the most simplest you can. Remove all bells 'n whistles so you have an easier test-case to work with. If it works, then you can start adding portions into the test-case... or at least this might help you narrow in on the problem.
Lemme know if that helps! :)
PS - Those videos (i've been to that one and other similar ones) work Great for the simple-cases. But start doing something more complex... and you're on your own! ;)
Friday, September 12, 2008 4:59 AM
Thanks breakneck.
I 've just got the same problem and your article shows the solution.
Wednesday, September 17, 2008 4:56 AM
captainks...sorry for the delay in replying. i tried to recreate the page. It worked when called from a standalone button, but when i recreated my page I note i'm using the prebuilt in row select links that come with the gridview control. When you click the link, a sub in the codebehind file shows the modalpopup. Is this where the problems lies? Would using a button in the gridview work?
Many thanks
Have included code for you.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Trade Press Database</title>
<link href="css/TPDb.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:scriptmanager runat="server">
</asp:scriptmanager>
<div class="container"> <img src="images/Trade-Press-Layout-2d.jpg" alt="Background Image"/>
<div class ="sInputBox">
<asp:Label
ID="Label3"
runat="server"
Font-Names="Comic Sans MS"
ForeColor="White"
Text="Search Tag(s):">
</asp:Label>
<br />
<asp:TextBox
ID="txtSearch"
runat="server"
Width="108px"
Height="22px">
</asp:TextBox>
</div>
<div class="sDates">
<div class ="sDateFrom">
<asp:Label
ID="Label1"
runat="server"
Font-Size="Small"
Text="Date From:"
Font-Names="Comic Sans MS"
ForeColor="White">
</asp:Label>
<br />
<asp:TextBox
ID="txtDateFrom"
runat="server"
Height="22px"
Width="108px">
</asp:TextBox>
<cc1:CalendarExtender
ID="CalendarExtender1"
runat="server"
TargetControlID="txtDateFrom"
Format="dd/MM/yyyy"
PopupPosition="Right">
</cc1:CalendarExtender>
</div>
<div class ="sDateTo">
<asp:Label
ID="Label2"
runat="server"
Font-Size="Small"
Text="Date To:"
Font-Names="Comic Sans MS"
ForeColor="White">
</asp:Label>
<br />
<asp:TextBox ID="txtDateTo" runat="server" Height="22px" Width="108px"></asp:TextBox>
<cc1:CalendarExtender
ID="CalendarExtender2"
runat="server"
Format="dd/MM/yyyy"
TargetControlID="txtDateTo"
PopupPosition="Right">
</cc1:CalendarExtender>
</div>
</div>
<div class="sSearchBtn">
<asp:Button
ID="btnSearch"
runat="server"
Text="Search"
onclick="btnSearch_Click"
Font-Names="Comic Sans MS"
Width="108px"
Height="28px" />
</div>
<div class="sThisWeek">
<asp:Button ID="btnThisWeek" runat="server" Font-Names="Comic Sans MS"
Font-Size="Small" Height="28px" onclick="btnThisWeek_Click" Text="This Week"
Width="108px" />
</div>
<div class ="dGrid">
<asp:GridView
ID="GV1"
runat="server"
AllowPaging="True"
AutoGenerateSelectButton="True"
Height="282px"
PageSize="5"
Width="526px"
Font-Names="Comic Sans MS"
Font-Size="Small">
<SelectedRowStyle BackColor="#CCCCCC" />
</asp:GridView>
</div>
</div>
<div class="pPopup">
<asp:Panel
ID="Panel1"
runat="server"
CssClass="modalPopup"
Style="display:none"
>
<table cellspacing="1" class="style1">
<tr>
<td class="style2">
</td>
<td class="style4">
<asp:Label
ID="Label4"
runat="server"
Font-Names="Comic Sans MS"
Font-Size="Small"
Text="Created By:">
</asp:Label>
</td>
<td class="style3">
</td>
<td>
<asp:TextBox
ID="TextBox1"
runat="server"
Height="23px"
Width="401px">
</asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
</td>
<td class="style4">
<asp:Label
ID="Label5"
runat="server"
Font-Names="comic sans ms"
Font-Size="Small"
Text="Article Title:">
</asp:Label>
</td>
<td class="style3">
</td>
<td>
<asp:TextBox
ID="TextBox2"
runat="server"
Height="23px"
Width="450px">
</asp:TextBox>
</td>
</tr>
<tr>
<td class="style5">
</td>
<td class="style6">
<asp:Label
ID="Label6"
runat="server"
Font-Names="Comic Sans MS"
Font-Size="Small"
Text="Hyperlink:">
</asp:Label>
</td>
<td class="style7">
</td>
<td class="style8">
<asp:TextBox
ID="TextBox3"
runat="server"
Height="23px"
Width="450px">
</asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
</td>
<td class="style4">
<asp:Label
ID="Label7"
runat="server"
Font-Names="Comic Sans MS"
Font-Size="Small"
Text="Article Body:">
</asp:Label>
</td>
<td class="style3">
</td>
<td>
<asp:TextBox
ID="txtBody"
runat="server"
Height="200px"
Width="450px">
</asp:TextBox>
</td>
</tr>
</table>
</asp:Panel>
<cc1:ModalPopupExtender
ID="ModalPopupExtender1"
runat="server"
PopupControlID="Panel1"
BackgroundCssClass="modalBackground"
TargetControlID="GV1">
</cc1:ModalPopupExtender>
</div>
</form>
</body>
</html>
Wednesday, September 17, 2008 11:43 AM
samuelslade007,
I found a few things that needed correcting... but I gotit working for ya. :)
Here is the summary of changes.. and then I'll post the code, below:
1) Mainly, I noticed that you used the auto-generated "Select" button... and you can't bind an extender to that. You need to use a Template Field, instead, that contains a button with an ID that the extender can "see". I think this was the main problem.
2) Also, your TargetControlID was set to the Grid... and it should be set to the button which will launch the popup (which probably confused you since you had an auto-generated field). Now that we have a button with an ID, I set this property to it.
3) I added a "close" button, so the Popup could be closed.
4) Purely for example usage... I included an xml-file and an XmlDataSource, for the grid to use (since the grid won't display without data). In your project, create a file called "books.xml" and paste the following into it:
<?xml version="1.0" encoding="utf-8" ?>
<books>
<book title="Secrets of Silicon Valley" author="Sheryl Hunter"/>
<book title="Straight Talk About Computers" author="Dean Straight"/>
<book title="You Can Combat Computer Stress!" author="Marjorie Green"/>
</books>
Also, since I don't have your style-sheet, you'll notice the Popup panel doesn't have a background. Just fyi. :)
Okay... here's the whole markup-code (tho I may've made some other slight changes in my debugging... fyi). Enjoy! :)
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Trade Press Database</title>
<link href="css/TPDb.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:scriptmanager ID="Scriptmanager1" runat="server">
</asp:scriptmanager>
<div class="container"> <img src="images/Trade-Press-Layout-2d.jpg" alt="Background Image"/>
<div class ="sInputBox">
<asp:Label ID="Label3" runat="server" Font-Names="Comic Sans MS" ForeColor="White" Text="Search Tag(s):">
</asp:Label>
<br />
<asp:TextBox ID="txtSearch" runat="server" Width="108px" Height="22px">
</asp:TextBox>
</div>
<div class="sDates">
<div class ="sDateFrom">
<asp:Label ID="Label1" runat="server" Font-Size="Small" Text="Date From:" Font-Names="Comic Sans MS" ForeColor="White">
</asp:Label>
<br />
<asp:TextBox ID="txtDateFrom" runat="server" Height="22px" Width="108px">
</asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDateFrom" Format="dd/MM/yyyy" PopupPosition="Right">
</cc1:CalendarExtender>
</div>
<div class ="sDateTo">
<asp:Label ID="Label2" runat="server" Font-Size="Small" Text="Date To:" Font-Names="Comic Sans MS" ForeColor="White">
</asp:Label>
<br />
<asp:TextBox ID="txtDateTo" runat="server" Height="22px" Width="108px"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" Format="dd/MM/yyyy"
TargetControlID="txtDateTo" PopupPosition="Right">
</cc1:CalendarExtender>
</div>
</div>
<div class="sSearchBtn">
<asp:Button ID="btnSearch" runat="server" Text="Search" onclick="btnSearch_Click" Font-Names="Comic Sans MS" Width="108px" Height="28px" />
</div>
<div class="sThisWeek">
<asp:Button ID="btnThisWeek" runat="server" Font-Names="Comic Sans MS" Font-Size="Small" Height="28px" onclick="btnThisWeek_Click" Text="This Week" Width="108px" />
</div>
<div class ="dGrid">
<asp:XmlDataSource runat="server" ID="XMLTemp" DataFile="books.xml">
</asp:XmlDataSource>
<asp:GridView ID="GV1" runat="server" AllowPaging="True" Height="282px"
PageSize="5" Width="526px" Font-Names="Comic Sans MS" Font-Size="Small"
AutoGenerateColumns="False" DataSourceID="XMLTemp" >
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="lnkSelect" runat="server" CausesValidation="False"
CommandName="Select" Text="Select"></asp:LinkButton>
<cc1:ModalPopupExtender ID="lnkSelect_ModalPopupExtender" runat="server" Enabled="True"
BackgroundCssClass="modalBackground"
PopupControlID="Panel1"
CancelControlID="lnkCancel"
TargetControlID="lnkSelect">
</cc1:ModalPopupExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Book Name" DataField="title" SortExpression="title">
</asp:BoundField>
<asp:BoundField HeaderText="Author" DataField="author" SortExpression="author">
</asp:BoundField>
</Columns>
<SelectedRowStyle BackColor="#CCCCCC" />
</asp:GridView>
</div>
</div>
<div class="pPopup">
<asp:Panel ID="Panel1" runat="server" Style="display:none" CssClass="modalPopup">
<table cellspacing="1" class="style1">
<tr>
<td class="style2"> </td>
<td class="style4">
<asp:Label ID="Label4" runat="server" Font-Names="Comic Sans MS" Font-Size="Small" Text="Created By:"></asp:Label>
</td>
<td class="style3"> </td>
<td>
<asp:TextBox ID="TextBox1" runat="server" Height="23px" Width="401px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2"> </td>
<td class="style4">
<asp:Label ID="Label5" runat="server" Font-Names="comic sans ms" Font-Size="Small" Text="Article Title:"></asp:Label>
</td>
<td class="style3"> </td>
<td>
<asp:TextBox ID="TextBox2" runat="server" Height="23px" Width="450px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style5"></td>
<td class="style6">
<asp:Label ID="Label6" runat="server" Font-Names="Comic Sans MS" Font-Size="Small" Text="Hyperlink:">
</asp:Label>
</td>
<td class="style7"></td>
<td class="style8">
<asp:TextBox ID="TextBox3" runat="server" Height="23px" Width="450px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2"> </td>
<td class="style4">
<asp:Label ID="Label7" runat="server" Font-Names="Comic Sans MS" Font-Size="Small" Text="Article Body:"></asp:Label>
</td>
<td class="style3"> </td>
<td><asp:TextBox ID="txtBody" runat="server" Height="200px" Width="450px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="4">
<asp:LinkButton ID="lnkCancel" runat="server">Close</asp:LinkButton>
</td>
</tr>
</table>
</asp:Panel>
</div>
</form> </body></html>
Thursday, September 18, 2008 5:49 AM
Captainks, i can see where i went wrong, it did puzzle me about auto generating a button and not being able to link to it. I admit i revamped the whole project and set the gridview as a datagrid, but even then i came up against a brick wall..your time and solution have been invaluable.
i've gotten your example working and am now comparing to see where i else i went wrong. I noted that as the gridview visible wasn't set as default to false,that setting it to False negated the main error message?? i am now having trouble binding the queried data to gridview as i'm amending you ItemTemplate area, and its now throwing null errors messages
<asp:GridView ID="GV1" runat="server" AllowPaging="True" Height="282px"
PageSize="5" Width="526px" Font-Names="Comic Sans MS" Font-Size="Small"
AutoGenerateColumns="False" Visible="False" >
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="lnkSelect" runat="server" CausesValidation="False"
CommandName="Select" Text="Select"></asp:LinkButton>
<cc1:ModalPopupExtender ID="lnkSelect_ModalPopupExtender" runat="server" Enabled="True"
BackgroundCssClass="modalBackground"
PopupControlID="Panel1"
CancelControlID="lnkCancel"
TargetControlID="lnkSelect">
</cc1:ModalPopupExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Article Title" DataField="strTitle">
</asp:BoundField>
<asp:BoundField HeaderText="Added By" DataField="strCreatedBy">
</asp:BoundField>
<asp:BoundField HeaderText="Add on" DataField="dteDateCreated">
</asp:BoundField>
<asp:BoundField HeaderText="Article Hyperlink" DataField="hypLink">
</asp:BoundField>
<asp:BoundField HeaderText="Article Body" DataField="Body">
</asp:BoundField>
</Columns>
<SelectedRowStyle BackColor="#CCCCCC" />
</asp:GridView>
Any idea what i'm doing wrong? i guess its the DataField and will have to have a play with this.
I'm not doing too well on catching the exceptions, i'm using a codebehind file so guess this is were the exceptions need to be addressed.
Thursday, September 18, 2008 6:41 AM
is the gridview the best control i could use.. would it be better to use a datagrid, like i was going to...does anyone know the benefits one over the other...
Thursday, September 18, 2008 10:02 AM
Samuel,
Lemme I'll look at your latest and see if I can find what the issue is. As for "Datagrid vs. Gridview"... if you google that, you'll find quite a bit to read thru. Personally, I like the Datagrid better, but honestly can't remember the main reason why. [:S] The gridview is supposed to have some better sorting & paging aspects, but I think the main differences I've noticed were in the events. I just remember that, everytime I've used the gridview, there was some event "gotcha" that kept causing probs. The datagrid always worked better for me... but you hafta create your own skin (if you use those) as Microsoft only includes a skin for the Gridview... fyi. :)
Thursday, September 18, 2008 10:20 AM
Hmm.... as for the errors.... I've got some questions for ya:
- Do your Datafield-values match up with your Datasource's fields?
- And, what datasource are you using?
- Is that setup in your code-behind?
- If you put the function-contents (in your code-behind) into try-catch statements... can you track when the errors occur?
:)
Thursday, September 18, 2008 11:56 AM
Samuel,
Lemme I'll look at your latest and see if I can find what the issue is. As for "Datagrid vs. Gridview"... if you google that, you'll find quite a bit to read thru. Personally, I like the Datagrid better, but honestly can't remember the main reason why. The gridview is supposed to have some better sorting & paging aspects, but I think the main differences I've noticed were in the events. I just remember that, everytime I've used the gridview, there was some event "gotcha" that kept causing probs. The datagrid always worked better for me... but you hafta create your own skin (if you use those) as Microsoft only includes a skin for the Gridview... fyi. :)
then maybe i'll redo it as a datagrid as i have a feeling it'll be less of a head ache..
Thursday, September 18, 2008 12:03 PM
Here's my codebehind file. The btn_ThisWeek_Click is the sub i have been debugging. I guess i haven't got the datafields matching, though i felt i had..but the MediaID maybe where its sticking.
I tried to add the try /catch statement but they didn't catch anything, it simply errored.??? :o(
It has been erorring at the binding stage i noticed the last time i tried it. I have even sought to build a dataset and use the accessdatasource prop..but no it conflicts with the databind()..i have a copy of Unleashed at home so i'll be flicking through that on datagrids i think, nothing in there on gridviews (not uptodate)
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.OleDb;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string GetDynamicContent(string contextKey)
{
return default(string);
}
protected void btnThisWeek_Click(object sender, EventArgs e)
{
string SQL;
/*OleDbConnection myConn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\flnt1\MarketDev\MediaGossip_v1.mdb;");*/
OleDbConnection myConn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DEV\Databases\MediaGossip_v1.mdb;");
try
{
GV1.Visible = true;
DateTime dteDate = DateTime.Today.AddDays(-7);
String strDate = dteDate.Month.ToString() + "/" + dteDate.Day.ToString() + "/" + dteDate.Year.ToString();
DateTime dteDate2 = DateTime.Today;
String strDate2 = dteDate2.Month.ToString() + "/" + dteDate2.Day.ToString() + "/" + dteDate2.Year.ToString();
SQL = @"SELECT \[MediaID\], \[strTitle\], \[Body\], \[strCreatedBy\], " +
"[dteDateCreated], [hypLink] FROM [TPB01 - Simple Search] " +"WHERE [Tag_text] = 'News' AND ([dteDateCreated] >=#" + strDate + "# AND [dteDateCreated] <=#" + strDate2 + "#);";
myConn.Open();
OleDbDataAdapter myDA = new OleDbDataAdapter(SQL, myConn);
DataSet myDS = new DataSet();
myDA.Fill(myDS, "TPdb");
GV1.DataSource = myDS.Tables["TPdb"].DefaultView;
GV1.DataBind();
}
catch (ArgumentNullException ex)
{
Response.Write("<script>window.alert('" + ex.Message.ToString() + "')</script>");
}
catch (OleDbException ex)
{
Response.Write("<script>window.alert('" + ex.Message.ToString() + "')</script>");
}
catch (NoNullAllowedException ex)
{
Response.Write("<script>window.alert('" + ex.Message.ToString() + "')</script>");
}
finally
{
myConn.Close();
}
}
}
thanks for all your help captainks, and for keeping me sane,,..
Friday, September 19, 2008 12:20 PM
Hey, no prob at all. I've pulled my hair out with Much of this stuff, too! :)
And btw, I had to create another account. For some reason, I couldn't get back in with my original. [:S]
Anyways... hmm. The main thing I would do is to get back to a good testable state and then move forward 1 step at a time. If your query is returning values... remove all, but 1 of the columns. Then, re-add them to see if one of them is erroring during the binding-stage. I'm wondering if the Date-column is the problem...
If it helps, I've included a couple of links that often helped me (with the ItemDataBound event, too). They work differently than what you may be doing, but they might just be helpful, anyways:
http://www.stardeveloper.com/articles/display.html?article=2003060701&page=1
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/gridview.aspx -- great examples for Gridview, in case you decide to go back to that.
Lemme know how it goes.
Monday, September 22, 2008 4:23 AM
great idea..get one field working, i can see reason in this..i'll check out those links. i guess it doesn't help that examples i have are linking to sql server (and i'm linking to access) but i think i've screwed things up for myself by jumping in feet first and not thinking about what i'm really doing.
ALSOoo doesn't help fixing a router and setting up a pc to dual boot Linux as a web server to which i know nothing BUT the weekend has been very knowledge expanding and painful due to only getting to a GUI at 11 o'clock sunday night!!!
i do believe my original error was fixed by setting the visibility to false for the gridview (if anyone is wondering in my ramblings)
now i just have to find how to transfer the selected record in the gridview to the popup text boxes?? links would be great though my search will not stop....OMG i sound like Buzz Lightyear...next i'll be saying..Infi...NOOOOooooooo
Monday, September 22, 2008 10:32 AM
lol! Knowledge-expanding (especially on new components) is Always quite painful. :):) It seems that most examples are on the "simple cases"... yet those are cases that never mimic real-world usages. ;)
Good luck! And shout back if you run into other walls. And if you find other useful links, you might post'm back here as well.
Thursday, July 16, 2009 10:12 AM
I was having the exact same problem which stumped me all morning until I braved diving into the generated HTML. In my case I was caching the control in question which was causing it to be rendered even though it wasn't visible at the time the page was rendered. As a result the script to create a drop-down extender was being created even though the elements didn't exist.
I have temporarily disabled the caching of the control in question, until I get a proper workaround. Hopefully this will help anyone here. If the element(s) that your AJAX extender(s) are referencing don't exist or aren't visible disable the extender and the script shouldn't get generated.
Alan Kelly
w2meet.com
Thursday, May 20, 2010 2:22 AM
I removed those HTML comments, and that resolved my problem...!!
HTML Comments
<!-- any html code here -->
:-)
Thanks,
Friday, November 19, 2010 7:40 PM
One other way this error is fired, is when there are no async triggers declared around a conditional updatepanel. If say, there is a label inside the contenttemplate, then this control is not visible at load, prompting the error. Remove the control, or add an async trigger will do it.
Monday, February 14, 2011 12:24 PM
My issue was that I had my 'TargetControlID' control with a visible="false" to start with.
Since I was programmatically calling .show() on the modal dialog it was safe to change the TargetControlID to the id of (in this case) the cancel button which was visible, so the event tie ups didn't fail.
Can I ask the asp.net team what the purpose of having TargetControlID as a required property is, when the model extender can be used effectively without this? Seems like it could safely be optional to me, maybe I'm missing something,
Cheers,
Doug
Thursday, April 7, 2011 12:42 PM
For modal popups, the target control should be made to not display using a css style="display: none" property and then you can call show() without a control showing up on the page.
Example:
<asp:Button ID="button_Hidden" runat="server" Text="Modal Popup Button" style="display: none" />