Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Wednesday, March 28, 2012

Extender controls of type AjaxControlToolkit.DragPanelExtender cannot extend controls of t

Hi, I'm getting this error when trying to port an old Atlas Web App to use the latest bits - any help would be nice as to what controls I CAN extend - so if I can't use a DIV what then?:

Server Error in '/GRintranets' Application.

Extender control 'DragPanelExtender1' cannot extend 'divPaginaHTML'. Extender controls of type 'AjaxControlToolkit.DragPanelExtender' cannot extend controls of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.InvalidOperationException: Extender control 'DragPanelExtender1' cannot extend 'divPaginaHTML'. Extender controls of type 'AjaxControlToolkit.DragPanelExtender' cannot extend controls of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.

Source Error:

Line 368: {Line 369:// EnsureProfileScriptService(ScriptManager.GetCurrent(Page), true);Line 370: base.OnPreRender(e);Line 371:Line 372: if (Enabled && TargetControl.Visible)


Source File:E:\My Documents\Visual Studio 2005 Projects\2007\CS\01 - ene2\AjaxControlToolkitSln\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs Line:370

Stack Trace:

[InvalidOperationException: Extender control 'DragPanelExtender1' cannot extend 'divPaginaHTML'. Extender controls of type 'AjaxControlToolkit.DragPanelExtender' cannot extend controls of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.] System.Web.UI.ScriptControlManager.VerifyTargetControlType(TExtenderControl extenderControl, Control targetControl) +262 System.Web.UI.ScriptControlManager.RegisterExtenderControl(TExtenderControl extenderControl, Control targetControl) +74 System.Web.UI.ScriptManager.RegisterExtenderControl(TExtenderControl extenderControl, Control targetControl) +104 System.Web.UI.ExtenderControl.RegisterWithScriptManager() +177 System.Web.UI.ExtenderControl.OnPreRender(EventArgs e) +17 AjaxControlToolkit.ExtenderControlBase.OnPreRender(EventArgs e) in E:\My Documents\Visual Studio 2005 Projects\2007\CS\01 - ene2\AjaxControlToolkitSln\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs:370 System.Web.UI.Control.PreRenderRecursiveInternal() +77 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360



Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

just use an <asp:Panel> control


Thanx Shawn - it works fine now but it doesn't seem to respect the z-index: 999 I'm assigning it (I tried through 'Style' and 'cssClass') - the thing is the window disappears behind other controls.

Could you say something useful about how to go to not let the draggable asp:Panel disappear behind the other page controls? I have explicit a very high value for the z-index but it won't stay on top. TIA

FYI, the page is loaded through AJAX in an iframe inside a table (on a page that uses a MasterPage), like this:

<tr><tdcolspan="10"style="height: 710px; width: 100%; z-index: 999;"valign="top"><!--content-->

<iframerunat="server"frameborder="0"id="ifContent"style="z-index: 999; width: 100%; height: 100%;"/>

<!--content--></td></tr>

Then, the page contains among other controls this combination of controls where I load content from a document in the iframe and make dragging possible through the inner asp:Panel:

<asp:Panelrunat="server"ID="pnlPaginaHTML"CssClass="cssPnlPaginaHTML"Style="z-index: 999">

<asp:PanelID="pnlLeer"runat="server"BackColor="Gray"Style="left: 12px; position: absolute; top: 5px; width: 828px; height: 16px"><spanstyle="font-size: 8pt"> se puede mover la ventana con el mouse rastreando la ventana en esta barra gris</span></asp:Panel><iframerunat="server"id="ifrPaginaHTML"src="#"scrolling="auto"style=" z-index: 999; left: 11px; width: 829px; position: absolute; top: 26px; height: 612px;"frameborder="1"></iframe></asp:Panel><atlas:DragPanelExtenderID="DragPanelExtender1"runat="server"TargetControlID="pnlPaginaHTML"DragHandleID="pnlLeer"></atlas:DragPanelExtender>

Extended controls may not be registered before Pre-Render

hi all,

i get the following error message when trying to load a usercontrol containing a modalpopupextender:
"extended controls may not be registered before pre-render"

no line specified, no more info about what's wrong, and almost everything is done with click 'n' drag in design mode (vwd 2005).

default.aspx and its codebehind:http://www.aspsidan.se/code/default.asp?c=9359

editcontent.ascx and its codebehind:http://www.aspsidan.se/code/default.asp?c=9361

the error message:http://www.aspsidan.se/code/default.asp?c=9360

editcontent.ascx is, as you can see, within a loginview, and it's not until i log on that i get the problem. i guess this error has something to do with the page life cycle, but i have no clue of how to get around it...

(i posted the code already in another forum, so i refer to those pages. i hope they're available even if you're not logged on. i've tried when i was offline and it worked, so it shouldn't be a problem...)

Hi lycken,

It is a common issue. You should add base.OnPreRender at the beginning ofvoid OnPreRender(EventArgs e){};

For more , pleaseread this. If it doesn't work, please feel free to let me know.

Best regards,

Jonathan


hi jonathan,

thanks a lot for the reply! it really does save my day that there is a solution to this.

however, neither your answer nor the article you linked me to helped me all the way. i understand i have to call the base.OnPreRender routine, but i can't figure out where in my code to put the call. i am coding in vb, so if you could explain it with vb examples instead of c# it would help me ;)

thanks again for your help!

-tomas


Hi Lycken,

Would you please give us a tiny and workable repro? So you can benefit from it directly. Thanks for your understanding.

Best regards,

Jonathan


hi again jonathan,

i provided all my source code in the first post - unless the links are not working. it's pasted below anyway - excuse the lenghtyness... and again - thanks for helping out!

the db is designed as follows:

Texts
******
TextID | int (identifier, primary key)
TextName | varchar(15)
Text | varchar(max)

Default.aspx

1<%@. Page Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" CodeFile="Default.aspx.vb"Inherits="_Default" title="Untitled Page" Theme="SMK" Trace="true" %>
2<%@. RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
3<%@. Register TagPrefix="list" TagName="Concerts" src="~/konsertprogram/Concerts.ascx" %>
4<%@. Register TagPrefix="ucl" TagName="EditContent" src="~/admin/EditContent.ascx" %>
5
6<asp:Content ID="Content1" ContentPlaceHolderID="Left" Runat="Server">
7 <asp:Image ID="LeftPaneImage" runat="server" ImageUrl="~/image/bredvid_konserter.jpg" />
8</asp:Content>
9<asp:Content ID="Content2" ContentPlaceHolderID="Content" Runat="Server">
10 <asp:Label ID="TextLabel" runat="server" />
11 <div style="text-align:right; width:100%;">
12 <asp:LoginView ID="LoginView1" runat="server">
13 <RoleGroups>
14 <asp:RoleGroup Roles="Admin">
15 <ContentTemplate>
16 <ucl:EditContent ID="EditContentUserControl" runat="server" TextToEdit="hem" />
17 </ContentTemplate>
18 </asp:RoleGroup>
19 </RoleGroups>
20 </asp:LoginView>
21 </div>
22
23 <div class="row">
24 <div style="float:left;">
25 <h1>N?sta konsert:</h1>
26 <list:Concerts ID="Concerts" runat="server" ItemsToShow="1" />
27 </div>
28
29 <div style="float:left;">
30 <h1>En till ruta</h1>
31 <p>med lite info</p>
32 </div>
33 </div>
34
35</asp:Content>

Default.aspx.vb

1Imports System.Configuration
2Imports System.Data.SqlClient
3Imports System.Data.SqlDbType
4Imports ErrorHandling
5
6PartialClass _Default
7Inherits System.Web.UI.Page
8
9Dim objConnAs New SqlConnection(ConfigurationManager.ConnectionStrings("SMK").ConnectionString)
10
11Protected Sub Page_Load(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Me.Load
12Dim objCmdAs New SqlCommand("SELECT [Text] FROM [Texts] WHERE [TextName] ='hem'", objConn)
13
14Try
15 objConn.Open()
16 TextLabel.Text = StringFunctions.FormatText(objCmd.ExecuteScalar)
17Catch exAs Exception
18 Err.Log(ex)
19Finally
20 If objConn IsNotNothing Then objConn.Close()
21End Try
22 End Sub
23End Class

EditContent.ascx

1<%@. Control Language="VB" AutoEventWireup="false" CodeFile="EditContent.ascx.vb"Inherits="admin_EditContent" %>
2<%@. RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
3<asp:ScriptManager ID="ScriptManager1" runat="server">
4</asp:ScriptManager>
5<asp:LinkButton ID="EditText" runat="server" CssClass="textr">Redigera texten</asp:LinkButton>
6<asp:Panel ID="ModalPanel" runat="server" CssClass="modalpu">
7 <asp:Button ID="btnBold" runat="server" Font-Bold="True" Text="F" Width="30px" />
8 <asp:Button ID="btnItalic" runat="server" Font-Italic="True" Text="K" Width="30px" />
9 <asp:Button ID="btnUnderline" runat="server" Font-Underline="True" Text="U" Width="30px" />
10 <asp:Button ID="btnHeader" runat="server" Text="Rubrik" Width="80px" />
11 <asp:Button ID="btnText" runat="server" Text="Text" Width="80px" /><br />
12 <asp:TextBox ID="tbContent" runat="server" Height="400px" Width="430px" TextMode="MultiLine" /><br />
13 <asp:Button ID="OKButton" runat="server" Font-Bold="True" Text="Skicka" Width="90px" />
14 <asp:Button ID="CancelButton" runat="server" Text="Avbryt" Width="90px" /><br />
15 <asp:Label ID="lblStatus" runat="server" />
16</asp:Panel>
17<cc1:ModalPopupExtender ID="ModalPopupExtender" runat="server"
18 TargetControlID="EditText"
19 PopupControlID="ModalPanel"
20 x="0"
21 Y="0"
22 DropShadow="true"
23 RepositionMode="none"
24 OkControlID="OKButton"
25 OnOkScript="__doPostBack('ctl00$Content$LoginView1$EditContentUserControl$OKButton','')"
26 CancelControlID="CancelButton"
27 BackgroundCssClass="modalbg" />
EditContent.ascx.vb
1Imports System.Configuration
2Imports System.Data.SqlClient
3Imports System.Data.SqlDbType
4Imports ErrorHandling
5
6PartialClass admin_EditContent
7Inherits System.Web.UI.UserControl
8
9Dim objConnAs New SqlConnection(ConfigurationManager.ConnectionStrings("SMK").ConnectionString)
10Private _textToEditAs String
11
12 Public WriteOnly Property TextToEdit()As String
13 Set(ByVal valueAs String)
14 _textToEdit = value
15End Set
16 End Property
17
18 Protected Sub Page_Load(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Me.Load
19Dim objCmdAs New SqlCommand("SELECT [Text] FROM [Texts] WHERE [TextName] = @.TextName", objConn)
20
21Dim objParamAs New SqlParameter("@.TextName", VarChar)
22 objParam.Value = _textToEdit
23 objCmd.Parameters.Add(objParam)
24
25Try
26 objConn.Open()
27 tbContent.Text = objCmd.ExecuteScalar
28Catch exAs Exception
29 Err.Log(ex)
30Finally
31 If objConn IsNotNothing Then objConn.Close()
32End Try
33 End Sub
34
35 Protected Sub OKButton_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles OKButton.Click
36Dim objCmdAs New SqlCommand("UPDATE Texts SET [Text] = @.Text WHERE [TextName] = @.TextName", objConn)
37
38Dim objParamAs New SqlParameter("@.Text", VarChar)
39 objParam.Value = tbContent.Text
40 objCmd.Parameters.Add(objParam)
41
42 objParam =New SqlParameter("@.TextName", VarChar)
43 objParam.Value = _textToEdit
44 objCmd.Parameters.Add(objParam)
45
46Try
47 objConn.Open()
48 objCmd.ExecuteNonQuery()
49 lblStatus.Text ="Uppdaterat!"
50Catch exAs Exception
51 Err.Log(ex)
52Finally
53 If objConn IsNotNothing Then objConn.Close()
54End Try
55
56 objConn =Nothing
57 objCmd =Nothing
58 End Sub
59End Class



Hi Luken,

Would you please add this code to EditContent.ascx.vb?

protected override void OnPreRender(EventArgs e)
{
// add base.OnPreRender(e); at the beginning of the method.
base.OnPreRender(e);

// codes to handle with your controls.
...
}

I have copied your code to my project and did some modifications(comment and rename work only) , it works well on my machine. Also where's your master page? If it doesn't work, would you please create aworkable sample and give us the links so that we can download your project. Thanks

Best regards,

Jonathan


i'd love to add it to editcontent.ascx.vb, but i don't know how to re-write it to vb. i get syntax errors on "base" when i try. what is it called with vb syntax?


Hi Lycken,

For example,

C# code

protected override void OnPreRender(EventArgs e)
{
// add base.OnPreRender(e); at the beginning of the method.
base.OnPreRender(e);

// codes to handle with your controls.
...
}

Convert to VB Code,

Protected Overloads Overrides Sub OnPreRender(ByVal e As EventArgs) ' add base.OnPreRender(e); at the beginning of the method. MyBase.OnPreRender(e) ' codes to handle with your controls.

End Sub

Here is anuseful tool.

I hope this help.

Best regards,

Jonathan


thanks a lot! it's working fine now - or at least this part of the solution is... i have a couple of other things that aren't doing so well at the moment, but i'll work on those for yet a while before i post here.

again, thanks!

Monday, March 26, 2012

Exporting GridView Values to Excel...

Hey... i get this error when i am exporting a gridview to a excel file. I know that is something with AJAX...

sys.webForm.PageRequstManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are the response is modified by calls to response.write(), response filters, http modules or server trace is enable.

Tongue Tied

You can't use the Response object to write a file directly back on a partial postback's response. That's the source of your error.

However, you canuse an iframe to simulate an AJAX file download.


hello.

just to add a link to my post about that subject:

http://msmvps.com/blogs/luisabreu/archive/2007/10/17/asp-net-ajax-some-ideas-on-how-to-export-the-contents-of-a-gridview-to-an-excel-file-without-a-full-postback.aspx

Exporting gridview to excel and Ajax page get an error

hello I trying to export a gridview to excel in my project, but I got this error:

"Sys.WebForms.PageRequestManagerParserErrorException:The message received from the server could not be parsed. Common causesfor this error are when the response is modified by calls toResponse.Write(), response filters, HttpModules, or server trace isenabled."

is there a way to export this without response.write or to solve this issue with ajax

I solve the problem like this:

protectedvoid Page_Init()

{

PostBackTrigger trigger =newPostBackTrigger();

trigger.ControlID = ((Button)pnGridViewProcess.FindControl("btnExcel")).UniqueID.ToString();

((System.Web.UI.UpdatePanel)Page.Controls[0].FindControl("UpdatePanel1")).Triggers.Add(trigger);

}

Export to Excel within a AJAX Updatepanel

Hi, I'm getting an "pagerequestmanagerparsererrorexception" error when trying to export a gridview to an excel spreadsheet within an updatepanel.

here is the code below ;

Protected Sub Export2Excel() Response.Clear() Response.AddHeader("content-disposition", "attachment;filename=TestExcel.xls") Response.Charset = "" 'If you want the option to open the Excel file without saving than 'comment out the line below Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.ContentType = "application/vnd.xls" Dim stringWrite As System.IO.StringWriter = New System.IO.StringWriter() Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite) Try Results_GridView.RenderControl(htmlWrite) Response.Write(stringWrite.ToString) Catch ex As Exception End Try Response.End() End Sub
 Any help would be greatly appreciate..
 Thanks,
Clint 

You need to open up the excel in a pop up window or in an iframe. You can not send that content down through the Ajax Request and expect it to download on the users computer.

Eric


Hi Clint,

I think the simplest way is do not put the button inside any update panel.

Hope this helps.


Hi,

I am using a link button within the update panel, this is when I am getting the error.

Thanks


i could make it, adding an

<Triggers>
<asp:PostBackTrigger ControlID="ExportingButton" />
</Triggers>

to the updatepanel... hope this helps!!!

by!


Hi, the problem it's that when you use ajax you can't continue using theresponse.write,because the big idea of Ajax is not write all the page, only someparts, well the solution it's very easy, add an page and send StringWrite to a session variable, and add an Response.Redirect to the new page without ajax and in the load of the new page write your Response.write, and that's all, that will only open a windows in the client side asking if want to save or open the file, hope this be usefull fou U.


I've handled this in this post:

http://forums.asp.net/t/1047851.aspx

Hope it helps!

Bebandit

Explorer Error: Sys is not defined

Hi,

I'm trying to create a profile to mantain the position of one panel. When this user open the web page this panel should be in the same position as before. I read the Atlas reference and copied the code of the examples, but the explorer returns me this error:

'Sys' is not defined.

Here is the code of my web.config file:

<microsoft.web>

<profileService enabled="true"

setProperties="PanelRelogTop;PanelRelogWidth"

getProperties="PanelRelogTop;PanelRelogWidth" />

</microsoft.web>

And here is the code I use:

<atlas:ProfileScriptService ID="pss1" runat="server"></atlas:ProfileScriptService>

<script type="text/javascript" language="JavaScript">

var PanelReloj = $("PanelReloj");

//This will load the profile data into the various HTML elements

//when the page loads.

function OnPageLoad() {

//Turn off automatic saving of the profile back to the server each time

//a profile property changes.

Sys.Profile.set_autoSave(false);

//Assign an event handler that runs once the profile has been loaded from the server

Sys.Profile.loaded.add(onProfileLoadComplete);

//Assign an event handler that runs once the profile has been successfully saved on the server

Sys.Profile.saved.add(onProfileSaveComplete);

//Load the profile from the server. As with all web service calls in "Atlas", the load

//occurs asynchronously.

Sys.Profile.load();

}

//Called when the profile data has been loaded from the server

function onProfileLoadComplete()

{

PanelReloj.top = Sys.Profile.properties.PanelRelogTop;

PanelReloj.width = Sys.Profile.properties.PanelRelogWidth;

}

function OnUpdateProfile()

{

Sys.Profile.properties.PanelRelogTop = PanelReloj.top;

Sys.Profile.properties.PanelRelogWidth = PanelReloj.width;

//Saves the profile on the server. The save occurs asynchronously.

Sys.Profile.save();

}

function onProfileSaveComplete() {

alert('The profile has been saved.');

}

</script>

Does anybody know if I'm doing something wrong or do I need to do something else?

Thanks!!!

When does OnPageLoad function gets called? Is it after Atlas has finished loading or when the window or body onload is fired? If it is the later case try removing the event handler and putting it in a javascript function called pageLoad (which gets fired when Atlas is loaded).

function pageLoad()
{
OnPageLoad();
}


It does on bdy onload event.

<body onload="OnPageLoad()">


Hi!

Instead of making your initial function call in <body onload=''> you should use the following snippet in the document:

 <script type="text/javascript"> function OnApplicationLoad() { MyFunc(); return false; } </script>

This is because the Ajax framework takes some time to initialize and your call is being made before the Sys object is created. The "OnApplicationLoad" is raised from Ajax when initialization is done.

--
Mattias Lindsj? | Fivestarday Sweden | www.fivestarday.se |


I think I solve the problem, I have to use Web object instead of Sys object. It's something I discover looking at the Atlas scripts or the object Browser on the Atlas reference.

Now, I do profile on web controls but only while the user is in the page. If the explorer is closed and then the user loads the same web page, there isn't values for the profile. I suppose after reading the documentation that these values are saved in some way and returned when the page is loaded again. How I do this using client code? And, what is the funcionality of the ProfileScriptService control?


hello.

if you're still using the Web namespace (instead of the Sys), then that means that you're running an old version of ATLAS (the March CTP is the latest release).

I've updated the new Atlas version and works fine with Sys object. Thanks for this point Luis.

Mattias, thanks for this code. It works with your suggestion and on the Load event of the body with the new version of Atlas.

Someone of you know how I can keep the profile for maintain configuration of pages?


I suggest starting a new thread with a descriptive title to focus on this. It's general best to limit one thread to a single issue, so that others can simply look at the title and know what it's about.

thanks,
David

Saturday, March 24, 2012

Exceptions and javascript errors

If you have an updatepanel, and an exception is thrown during postback, a javascript error is generated. Is there any way that atlas could display the exception that was generated?

Not with the current release. We'll be adding some support for error handling.

What I am curious is why you'd want to show the exception on the server to the user. Exceptions really aren't meant for end users to see, given they have not much context to interpret them.


Well, it's nice for debugging purposes, I don't mean to necessarily show the error to an end user. Right now, as far as I can tell, the easiest way to see the exception that is generated is to temporarily turn off EnablePartialRendering.

Yes, the plan would be to make sure you can get the exception info, but the plan would probably not provide an out-of-the-box way to display it (you could do that if it makes sense for your app).

What I use right now for seeing exception info is my web development helper's http tracing (the response shows the exception info). Check outhttp://www.nikhilk.net/Projects.WebDevHelper.aspx.

Exception Error with Ajax - Remove Alert

I want to show the Exception Error in the browser, when use AJAX the error open a alert message...

Thank's

Antonio Dornellas

Hi Antonio,

Please refer tothis for how to customize the error message, inUsing Client Script to Customize Error Handling section.

Hope this helps.

Exception / Error 500 on using UpdatePanel and postback of value starting with "less than"

We are using the December, 19, release of AJAX CTP (and Control Toolkit) and are noticing the following behaviour:

If you are putting for example a TextBox into an UpdatePanel, filling the box with a value like "<x" and do a postback of that value then you will receive the following error message:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occured while processing the request on the server. The status code returned from the server was: 500

If you use empty braces (<>) everything works fine, if you uses only the closing brace (>) there is also no problem.

Does anybody have more detailed information on this problem or how to avoid it?

Regards,
ReneMT

put validaterequest="false" in the <%@. %> at the top.

NOTE: when you do this you must provide your own validation, because leave it out might introduce security risks of scripts injecting attacks.


Hmmm...

That may be a solution - but I think basically this is no real good one (as you are already pointing out) [:-)]. I thought about something like HTML encoding for postback values... Any possibilities in this direction?

ReneMT


hello.
well, not out of the box. btw, this is not an ajax problem...if you build a simple asp.net page, you'llget the same results.

Arrrrrrgh...

If this is a fact it is really sadIndifferent So in my eyes the only workaround were

Forbid input of the "<" sign or

I'm posting this response at the root because it may be beneficial...

I tried all the methods discussed here, but then I ran across a different thread in which they were running into a problem with all 3 releases (AJAX 1.0, CTPs, Atlas) where physical file names did not match up with the file name in the URL. Of course this can happen anytime you do a postback and the associated Code Behind (CB) page flips you out to a different page without updating the URL in the browser.

So my fix didn't involve any fix at all. I just went to the actual page (instead of being flipped over there by my CB code) andw00t! everything is kosher. I also tried using symbols discussed here (my AJAX dll versions are 1.0) and I verified that ICANput symbols in text fields with no resulting errors.

Please let me know if this is confusing.


I have a related problem with the TImer control in Ajax. I inject a <br> tag into a READ-ONLY text box, but when the Timer refreshes the TextBox I get the same error. Seehttp://forums.asp.net/thread/1626704.aspx

Ivan


I'm suddenly having this problem with FireFox 2.0.0.3. If my editor/textarea contains only text, good, if it's HTML - no go. Tried the ValidateRequest="false" hack, it did kinda work, but I ended up with firefox sending the old values from the textarea!

Anyone else working on this?


Any updates or fix on this issue?

EventValidation error msg!

one of the Atlas control popup me something that i need to implement an event agrument or something!! ?? tha happen on a click of a ListBox control.

i am verry confuse here !

"Invalide postback or callback argument. Event validation is enabled using <page enableEventValidation=true> in configuration or in the page. For security purposes, this features verifies taht arguments to postback or callback events origiante from the server control that originally rendered them. If the data is valid and expected, use the ClickScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation."

What im suppose to do with that now?

I fix it !!

this is what i did.. i had a UpadatePanel inside a UpdatePanel.. and thats what was causing a script Popup msg !!

Wednesday, March 21, 2012

Event handler Javascript error: Sys.InvalidOperationException: Handler must be a function

This should be easy. I'm not sure what I'm missing here. The Javascript is really basic (it works), but the CalendarPopupExtender's event calls it and it bombs even with a return value at the end of it (currently null).

Any help would be greatly appreciated. Thanks in advance

Here's the code:

<%

@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="AjaxCalendarTest.aspx.cs"Inherits="AjaxCalendarTest" %>

<%

@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server"><title>Date Label Text</title><scriptlanguage="javascript">function ChangeRelativeDateLabelText()

{

//var testLabel = Sys.UI.Label($get('MyLabel'));var relativeDateDiv = document.getElementById('RelativeDateDiv');//var selectedDateTextBox = new Sys.UI.TextBox();//selectedDateTextBox = $get('DateTextBox');var selectedDateText = document.getElementById('DateTextBox').value//var textBoxString = document.getElementById('SelectedDateTextBox').value;

var dateTokens = selectedDateText.split('/');var month = dateTokens[0];var day = dateTokens[1];var year = dateTokens[2];

var currentDate =new Date()// current datevar dateToCompare =new Date()

dateToCompare.setMonth(month )

dateToCompare.setDate(day)

dateToCompare.setYear(year)

currentDate.setMonth(month);

function GetDaysDelta(value1,value2) {var delta = 0;var date1 = value1;var date2 = value2;if (value1.getTime() < value2.getTime()) {

date1 = value2;

date2 = value1;

}

delta = date1.getTime() - date2.getTime();

// in msecs

delta /= (1000 * 60 * 60 * 24);

// daysif (value1.getTime() > value2.getTime()) {

delta = delta * -1;

}

return delta;

}

function GetDateLabelString(delta)

{

if (delta < 0)

{

return''

}

elseif (delta >= 0 && delta < 1)

{

return'(Today)';

}

elseif (delta >= 1 && delta < 2)

{

return'(Yesterday)'

}

else

{

return'(' + delta +' Days Ago)'

}

}

var _X = 4.5// in thousands!var delta = GetDaysDelta(dateToCompare,currentDate);

var dateLabelString = GetDateLabelString(delta);

relativeDateDiv.innerHTML = dateLabelString;

returnnull;

}

</script>

</

head>

<

body><formid="form1"runat="server"><div><asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager>

</div><asp:TextBoxID="DateTextBox"runat="server"></asp:TextBox><asp:LabelID="MyLabel"runat="server"Text="Label"></asp:Label><divID="RelativeDateDiv"style="width: 100px; height: 100px"></div><cc1:CalendarExtenderID="CalendarExtender1"runat="server"OnClientDateSelectionChanged="ChangeRelativeDateLabelText()"TargetControlID="DateTextBox"></cc1:CalendarExtender></form>

</

body>

</

html>

I have rearranged(functions "GetDaysDelta" and"GetDateLabelString", where within "ChangeRelativeDateLabelText", I moved it outside.) your code now it seems to be working(atleaset no error message). Still seems to be having some logical errors.

The error " Handler must be a function" is becasuse

OnClientDateSelectionChanged="ChangeRelativeDateLabelText()"

correct one is OnClientDateSelectionChanged="ChangeRelativeDateLabelText" (with out brackets)

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="AjaxCalendarTest.aspx.cs" Inherits="AjaxCalendarTest" %
<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %
<%
@. 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>Date Label Text</title>
<script language="javascript" >
function ChangeRelativeDateLabelText()
{
//var testLabel = Sys.UI.Label($get('MyLabel'));
var relativeDateDiv = document.getElementById('RelativeDateDiv');
//var selectedDateTextBox = new Sys.UI.TextBox();
//selectedDateTextBox = $get('DateTextBox');
var selectedDateText = document.getElementById('DateTextBox').value
//var textBoxString = document.getElementById('SelectedDateTextBox').value;
var dateTokens = selectedDateText.split('/');
var month = dateTokens[0];
var day = dateTokens[1];
var year = dateTokens[2];
var currentDate = new Date() // current date
var dateToCompare = new Date()
dateToCompare.setMonth(month )
dateToCompare.setDate(day)
dateToCompare.setYear(year)
currentDate.setMonth(month);
var _X = 4.5 // in thousands!
var delta = GetDaysDelta(dateToCompare,currentDate);
var dateLabelString = GetDateLabelString(delta);
relativeDateDiv.innerHTML = dateLabelString;
return true;
}
function GetDaysDelta(value1,value2) {
var delta = 0;
var date1 = value1;
var date2 = value2;
if (value1.getTime() < value2.getTime()) {
date1 = value2;
date2 = value1;
}
delta = date1.getTime() - date2.getTime();
// in msecs
delta /= (1000 * 60 * 60 * 24);
// days
if (value1.getTime() > value2.getTime()) {
delta = delta * -1;
}
return delta;
}
function GetDateLabelString(delta)
{
if (delta < 0)
{
return ''
}
else if (delta >= 0 && delta < 1)
{
return '(Today)';
}
else if (delta >= 1 && delta < 2)
{
return '(Yesterday)'
}
else
{
return '(' + delta + ' Days Ago)'
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</div>
<asp:TextBox ID="DateTextBox" runat="server"></asp:TextBox>
<asp:Label ID="MyLabel" runat="server" Text="Label"></asp:Label>
<div ID="RelativeDateDiv" style="width: 100px; height: 100px"></div>
<cc1:CalendarExtender ID="CalendarExtender1" runat="server"OnClientDateSelectionChanged="ChangeRelativeDateLabelText"TargetControlID="DateTextBox">
</cc1:CalendarExtender>
</form>
</body>
</html>


That was it. It works perfectly. Thanks for your help.

ErrorTemplate

Hi, How can I reposition the errorTemplate to the center of the screen when an error occurs? Any chance of an example?

Hi Ian,

In design view in your ASPX page, go to the ScriptManager and in its Smart Tasks menu there's a link to create a default error template. That template gets rendered in the center of the screen, so you could probably work off of that.

Thanks,

Eilon


Wow... Thanks guys. I'll remember to look for the smart tags in future.

How can the errorTemplate be centered vertically, so that despite where the user is on the page the errorTemplate appears in the viewable window. Another words what if the viewable area is at the bottom of the page and an error occurs. At the moment the template appears at the top of the page.


Hi Ian,

Those are known issues with the April CTP of Atlas. We have opened bugs to track these issues.

Thanks,

Eilon

Errors with UpdatePanel & WebPart stuff after upgrade

I recently upgraded from Atlas CTP to Ajax beta 1. I beleive that I properly updated my web.config et. al.; however I keep getting this error regarding the UpdatePanel:

Element 'UpdatePanel' is not a known element. This can occur if there is a compilation error in the Web site.
Element 'AsyncPostBackTrigger' is not a known element. This can occur if there is a compilation error in the Web site.
Validation (XHTML 1.0 Transitional): Element 'Triggers' is not supported.
Validation (XHTML 1.0 Transitional): Element 'ContentTemplate' is not supported.

I can drag the UpdatePanel from the IDE toolbox onto the page, but the Intellisense doesn't work and it causes errors.

On a related note, none of my WebParts stuff is recognized either:

Element 'WebPartManager' is not a known element. This can occur if there is a compilation error in the Web site.
'WebPartZone' is not a known element. This can occur if there is a compilation error in the Web site.

Anyone know what is causing this, and how I can fix?

TIA

hello.

hum...have you changed the web.config entries on the page section?


I've got the same problem. My web.confg page section looks like this:

<system.web><pages><controls>

<addtagPrefix="asp"namespace="Microsoft.Web.UI"assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addtagPrefix="asp"namespace="Microsoft.Web.UI.Controls"assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<addnamespace="Microsoft.Web.Preview.UI"assembly="Microsoft.Web.Preview"tagPrefix="atlas"/>

<addnamespace="Microsoft.Web.Preview.UI.Controls"assembly="Microsoft.Web.Preview"tagPrefix="atlas"/>

</controls>

I should be using <asp:UpdatePanel...> NOT<atlas:UpdatePanel...> correct? The only items showing up w/ intellisense are <atlas:AutoCompleteExtender>,<atlas:DragOverlayExtender>,<atlas:ProfileService>,<atlas:Script>,<atlas:TimerControl>, and<atlas:UpdateProgress>.

I'm also a bit lost with what I should have in my toolbox after the migration and adding in the value-add controls. Currently, I still have the ATLAS controls in my toolbox, same as I did from before the migration. Should I have removed these? I also removed the .dll's from my BIN directory before the migration (before the installs) and then added back both "AjaxControlToolkit.dll" and "Microsoft.Web.Preview.dll" after the BETA+ValueAdd+Toolkit installs.

Please help, I am LOST! Thanks!!

--c--


Change you asp tags to something else (Atlas" or "ajax" or whatever... will fix it - its a known bug...

Thanks Jody, that did it!!

Someone should consider updating the Migration Guide document. Step #3 specifically says to use "asp" for the tag. After I had already renamed all my <atlas> tags to <asp> I had to go back and put them back :( ...what a pain.

Thanks again!


Thanks Jodi. That helped me a lot. Just a note here. Change the tag prefix in web.config file pages section as well as in the html design file.

Shaun


I have the same error with the installation of AJAX 1.0, without any beta version installed , and the solution was the same, I changed the tags in the web config and in the html and the problem was solved.


Hi,
I don't know to wich categories this belongs butSmartNavigation="true" seems to cause also a "Sys.WebForms.PageRequestManagerParserErrorException" also.

Just some tip if you looking for hours just as I did ;)

Grtz


I've heard that you do not use SmartNavigation with AJAX (or even VS2005)

Errors with Update Panel

Hi,

I am using an update panel for a seamless change when someone changes something on the page. However, I get an error message the second time I change something. The first time i used the update panel was to chan ge the contents of one dropdown list after another list was changed, it would work once but as soon as you change it again in that same session it would error out. I am now trying it again with a checkbox and the ToggleButtonExtender so that images toggle back and forth and I am getting the same error again. Here are the details:

Event Viweer - Application warnings:

Event code: 3009

Event message: Unable to make the session state request to the session state server. Details: last phase='Sending request to the state server', error code=0x80072749, size of outgoing data=0

Event time: 7/21/2007 11:15:09 AM

Event time (UTC): 7/21/2007 5:15:09 PM

Event ID: 9010d9cb58c2471b99f8c0988127eaf5

Event sequence: 181

Event occurrence: 1

Event detail code: 50016

Application information:

Application domain: 7fb7c3c2-1-128295113834687500

Trust level: Full

Application Virtual Path: /AjaxControlToolkitWebSite2

Application Path: D:\WebProjects\AjaxControlToolkitWebSite2\

Machine name: SATURN-V

Process information:

Process ID: 4652

Process name: WebDev.WebServer.EXE

Account name: LAUNCHZONE\CurtisL

Exception information:

Exception type: HttpException

Exception message: Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection. If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.

Request information:

Request URL: http://localhost:2536/AjaxControlToolkitWebSite2/images/minus.gif

Request path: /AjaxControlToolkitWebSite2/images/minus.gif

User host address: 127.0.0.1

User: LAUNCHZONE\CurtisL

Is authenticated: True

Authentication Type: NTLM

Thread account name: LAUNCHZONE\CurtisL

Thread information:

Thread ID: 4

Thread account name: LAUNCHZONE\CurtisL

Is impersonating: False

Stack trace:

Custom event details:

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Error on page:

Sys, WebForms.PageRequestManagerServerErrorException: an unknow error occured while processing the request on the server. the status code returned from the server was: 500

My Code:

<%@dotnet.itags.org.PageLanguage="VB"AutoEventWireup="true"CodeFile="Default.aspx.vb"Inherits="_Default" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<asp:ScriptManagerID="ScriptManager1"runat="server"/>

<div>

<asp:UpdatePanelID="UpdatePanel1"runat="server">

<ContentTemplate>

<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox><asp:CheckBoxID="CheckBox1"runat="server"AutoPostBack="True"/><ajaxToolkit:ToggleButtonExtenderID="ToggleCheckbox"CheckedImageUrl="images/plus.gif"ImageHeight="9"ImageWidth="9"TargetControlID="CheckBox1"UncheckedImageUrl="images/minus.gif"runat="server">

</ajaxToolkit:ToggleButtonExtender>

</ContentTemplate>

</asp:UpdatePanel>

<br/>

<br/>

<br/>

<br/>

</div>

</form>

</body>

</html>

Code Behind:

PartialClass _Default

Inherits System.Web.UI.Page

ProtectedSub CheckBox1_CheckedChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles CheckBox1.CheckedChanged

Dim strValueAsString =""

If CheckBox1.Checked =TrueThen

TextBox1.Text ="in"

Else

TextBox1.Text ="out"

EndIf

EndSub

EndClass

I have had this error more than once now and I'm not sure how to fix it. When I remove the update panel everything works fine, any ideas?

It seems you are uaing different setting for Session other than "InProc". Pls make sure you have configured it properly.


Thanks, I think that helped.

errors with the control toolkit

I just downloaded the ajax extensions, and toolkit, but everytime I add an item from the toolkit to my web form I get an error in the designer file.

It generates code in the designer.vb file like

but I get an error that says:

ProtectedWithEvents RoundedCornersExtender1As AjaxControlToolkit.RoundedCornersExtender

Type 'AjaxControlToolkit.RoundedCornersExtender' is not defined.

I also get an error from my web.config file that says:

Could not load type 'System.Web.UI.Compatibility.CompareValidator' from assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

pointing to the line:

<add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="System.Web.UI.Compatibility.CompareValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

does anyone have any idea what I'm doing wrong, or how I can fix this?

thanks,

smtraber

This post may help youhttp://weblogs.asp.net/scottgu/archive/2007/01/25/links-to-asp-net-ajax-1-0-resources-and-answers-to-some-common-questions.aspx (look down a little bit for the stuff on validators)

Errors with all UpdatePanels after installing the January Release

I installed the January release yesterday and am now getting a strange error with all of my update panels. It happens in both the existing Atlas application I was working on, and in a new test project I created to test the error.

I get the follow message box when any postback action is taken inside an update panel:

An async postback was caused by a control within UpdatePanel '$TestPanel' but the panel could not be found in the page.
I was having no trouble out of the December release, and the update panel that it says it can't find is there (minus the $). I would appreciate any ideas on a fix.

Got it. I fibbed a bit in my previous post, the $TestPanel isn't their exactly, it's missing the underscore I prefix my control ids with. It appears this bug was introduced in the January release.

As soon as I renamed my UpdatePanel from "_TestPanel" to "TestPanel", everything worked as expected.


Hi Nick,

How do you rename from _TestPanel to TestPanel ? Please help me I have the same problem.


Can you post a quick sample repro of what failed for you?
Create the following in page, notice the Update Panel's ID is prefixed with a "_".
<form id="form1" runat="server">
<atlas:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" />
<div>
<atlas:UpdatePanel ID="_Test" Mode="Always" runat="server">
<ContentTemplate>
<asp:TextBox ID="_SomeTextBox" runat="server">
</asp:TextBox>
<asp:Button ID="_SomeButton" runat="server" />
</ContentTemplate>
</atlas:UpdatePanel>
</div>
</form
When you run this sample, and push the button, you should get the error described in the first post. Now, take out the underscore in the Update Panel's name, like this:

<form id="form1" runat="server">
<atlas:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" />
<div>
<atlas:UpdatePanel ID="Test" Mode="Always" runat="server">
<ContentTemplate>
<asp:TextBox ID="_SomeTextBox" runat="server">
</asp:TextBox>
<asp:Button ID="_SomeButton" runat="server" />
</ContentTemplate>
</atlas:UpdatePanel>
</div>
</form
Run it again, and it error is gone.
OK, thanks for the sample Nick. Essentially, the code in the server looking for the Panel is not handling the leading "_".

Just to follow up, this happens any time part of the UpdatePanel's ID has an underscore in it, not just a leading underscore. This also happens if you have other naming containers, such as Content controls in Master Page scenarios, that have underscores in their names.

For the meantime, just remove the underscores. This issue will be fixed in a future release of Atlas.

Thanks,

Eilon


Does this problem happen for other reasons? I have made sure that I have no underscores in any of my master/content/container controls, but I still get that message. The difference is that in my page source, the update panel is named with underscores like: "_ctl0_cphMain_upMyPanel", but in the JS alert window, its referred to as "$ctl0$cphMain$upMyPanel".

The weird thing is that the update panels update when a control event for a control that is NOT in an update panel is fired. The only time it throws the alert is when a control WITHIN one of these update panels is fired.

ANY help is appreciated! Thanks!!!!!!

--
tb


Hi tb,

The problem is happening because of "_ctl0" - though I'm not sure what control that is. If you can figure out what control that is, give it a specific name so that it doesn't get autogenerated to "_ctl0".

Thanks,

Eilon


I think this might be a bug with master pages. the cphMain part of that control id is the content placeholder on my master page. that would lead me to believe that the "_ctl0" is coming from something outside of that tag.

I have tried to change the form name on the master page, since thats the only server control that surrounds my content placeholder (cphMain), but when the controls are rendered, every single one of them has a "_ctl0" at the front of the id, and the rendered form id is still "aspnetForm".

Any thoughts? Thanks!

Errors in code view from AJAX scriptmanager control

When I am working on my page in code view, errors populate the error window ("ScriptManager" is not a known element... and a lot like that relating to any ajax control). But in design view everything works fine. It also is not using any of the ajax controls in the tag suggestion dropdown window. Any suggestions on how to fix this?

Hi

Did you include System.Web.Extension dll in your bin folder

Did you add

<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
<pages>
<controls>
<add tagPrefix="ajax" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>

in your web.config .

Try that out..

Hope that works it out

Bye

Error1Could not load file or assembly Microsoft.Web.Preview or one of its dependencies. Th

Trying to run the samples and this is the error I get. After looking around I see others have gotten this error but with the beta versions.

My install is not a beta release and I have not had any of the betas installed.

Any ideas?

I would look to your web config file or possibly your machine config file. Im betting you somehow got some old beta settings in it. possibly do a search for Microsoft.Web.Preview in your entire solution.

AjaxButter


The other thing i just noticed is you said you were running the samples. Im betting your using an old compilation of the sample files that was meant to use the beta version redownload the sample your using and give it another go.

Sorry for the double post

AjaxButter


Hi,

If you have installed the AJAX Extensions 1.0, the assembly Microsoft.Web.Preview not exists.

You must to replace all the references and assemblies in the samples for run this.

Hope this helps


Replace with what?

How the Microsoft.Web.Preview not exists with the AJAX extension 1.0, you must to work with the System.Web.Extensions assembly and System.Web.Extensions.Design assembly, installed in the Microsoft ASP.NET folder in Program Files folder.

Replace the web.config with the web.config that is generated in a new ASP.NET AJAX Enabled Web Site.

Or replace your web.config with the web.config file that is in the Microsoft ASP.NET folder.



From InstallationInstructions.txt:

Completing the Installation
--------
After downloading and uncompressing the sample files, copy Microsoft.Web.Preview.dll from the
ASP.NET AJAX CTP installation directory (%Program Files%\Microsoft ASP.NET\ASP.NET 2.0 AJAX
Futures January CTP\v1.0.61025\) to the Bin directory of each sample application. For example,
copy Microsoft.Web.Preview.dll to <installation path>\Contacts\Bin, where <installation path>
is the file path where the ASP.NET AJAX Samples were installed.

You must also copy AjaxControlToolkit.dll from the AJAX Control Toolkit directory to the Bin
directory of each sample application. For example, copy <toolkit installation path>
\AjaxControlToolkit\SampleWebSite\Bin\AjaxControlToolkit.dll to <installation path>\Contacts\Bin,
where <toolkit installation path> is the installation path for the AJAX Control Toolkit and
<installation path> is the file path where the ASP.NET AJAX Samples were installed.

Earlier in InstallationInstructions.txt are the download locations for the Futures CTP and the Control Toolkit.

Error; WebService Not Defined.

Hi,

I realise this has been convered in other posts and on other websites I have found but the fixes suggested have not managed to fix my problem. I'm relativly new to implmenting Atlas so there is a high likelihood i've done something silly. I'll try and make my description of what ive done as comprehensive as possible.

My error is 'TestService' is undefined.

I'll start with the UI code. I am trying to create a web-service, which will be called when an HTML <select> element has its onChange event triggered.

// AddDoors.aspx ~ Javascript Trigger.
Response.Write("<select runat='server' class='select' name='woodAvail" + rsWoods["WoodID"] + "' onchange=\"javascript: testIt();\">");
Response.Write("<option value='unavail_" + rsWoods["WoodID"] + "'>Not Availible</option>");
Response.Write("<option value='avail_" + rsWoods["WoodID"] + "'>Availible</option>");

Simpe yes! Now, the Javascript function...

// AddDoors.aspx ~ Javascript function.
<script type="text/javascript">
function testIt()
{
TestService.HelloWorld(OnComplete);
}
function OnComplete(result)
{
alert(result);
}
</script>

The script manager...

// AddDoors.aspx ~ Atlas Script manager.
<atlas:ScriptManager runat="server" ID="script1" EnablePartialRendering="true">
<Services>
<atlas:ServiceReference Path="~/TestService.asmx" />
</Services>
</atlas:ScriptManager>

// TestService.asmx simply links to the code-behind file, which lives in the App_Code folder.
<%@dotnet.itags.org. WebService Language="C#" CodeBehind="~/App_Code/TestService.cs" Class="TestService" %>

// App_Code/TestService.cs ~ Web Service Code-Behind.
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class TestService : System.Web.Services.WebService {

public TestService () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
public string HelloWorld() {
return "Hello World WS";
}

}

I have read on other threads and other forums that this problem can be often caused by the web.config file, so here is mine...

// web.config
http://endtable.net/paste/557b86d2.html

I have tried using PageMethods and writing the WebMethod within the AddDoors.aspx page, but this just gave the error PageMethods is undefined.

Again, sorry that this has already been covered in other threads but I just can't find a solution that works.

Thanks,
Dave.

Fixed it...


As I thought i'd missed something simple in the HttpHandlers in the web.config. For anyone with this problem, add the following block of code to your web.config.

<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
<!--
The MultiRequestHandler enables multiple requests to be handled in one
roundtrip to the server. Its use requires Full Trust.
-->
<add verb="*" path="atlasbatchcall.axd" type="Microsoft.Web.Services.MultiRequestHandler" validate="false"/>
<add verb="*" path="atlasglob.axd" type="Microsoft.Web.Globalization.GlobalizationHandler" validate="false"/>
<!--
The IFrameHandler enables a limited form of cross-domain calls to 'Atlas' web services.
This should only be enabled if you need this functionality and you're willing to expose
the data publicly on the Internet.
To use it, you will also need to add the attribute [WebOperation(true, ResponseFormatMode.Json, true)]
on the methods that you want to be called cross-domain.
This attribute is by default on any DataService's GetData method.

<add verb="*" path="iframecall.axd" type="Microsoft.Web.Services.IFrameHandler" validate="false"/>
-->
<add verb="*" path="*.asbx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
</httpHandlers>

It lives within System.Web.

Cheers,
Dave.


In my web.config, those config codes existed, but while I run under iis server the error: webservice is undefined still existed.
I don't know how to fix. Any suggestions? Thanks!

Regards,

Nick.

Error:Type System.Web.UI.ScriptManager does not have a public property named EnableScriptC

This is the error i got when compiling my application with scriptmanger's EnableScriptComponents set to true. Is the property EnableScriptComponents deprecated and if so, is there a replacement?

The ScriptManager public methods and properties are documented on thissite. That property may have been supported in an earlier beta of atlas. I am not sure what that property did but you could try to find something equivalent in the docs or it may be completely unnecessary now.