Saturday, March 24, 2012

a:Unknown server tag ctlex:MyFirstControlExtender

<%@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true" %>

<%@dotnet.itags.org.RegisterAssembly="MyFirstControlExtender"Namespace="MyFirstControlExtender"TagPrefix="ctlex" %>

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

<scriptrunat="server">

</script>

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

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

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

<div>

<asp:scriptmanagerrunat="server"></asp:scriptmanager>

<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>

<ctlex:MyFirstControlExtenderID="a"runat="server"></ctlex:MyFirstControlExtender>------->Not getting recognized but i have registered the namespace

</div>

</form>

</body>

</html>

using System;

using System.Web.UI.WebControls;

using System.Web.UI;

using System.ComponentModel;

using System.ComponentModel.Design;

using AjaxControlToolkit;

[assembly: System.Web.UI.WebResource("MyFirstControlExtender.MyFirstControlExtenderBehavior.js","text/javascript")]

namespace MyFirstControlExtender

{

[Designer(typeof(MyFirstControlExtenderDesigner))]

[ClientScriptResource("MyFirstControlExtender.MyFirstControlExtenderBehavior","MyFirstControlExtender.MyFirstControlExtenderBehavior.js")]

[TargetControlType(typeof(TextBox))]

publicclassMyFirstControlExtenderExtender :ExtenderControlBase

{

// TODO: Add your property accessors here.

//

[ExtenderControlProperty]

[DefaultValue("")]

publicstring MyProperty

{

get

{

return GetPropertyValue("MyProperty","");

}

set

{

SetPropertyValue("MyProperty",value);

}

}

}

}

Hi,

Is the assembly put in the bin folder?


Hi Raymond ,

the ajaxcontroltoolkit.dll is in bin folder only

Is there any other cause for such error.

Swati


Swati,

I mean the assemblyMyFirstControlExtender.dll, not the AjaxControlKit.dll. It seems your control is defined in an assembly MyFirstControlExtender, did you put it in the bin folder? Or did you add a reference to it?


Hi Raymond ,

Now the problem is solved ,thank u for replying.But now I am getting the javascript runtime error 'MyFirstControlExtender is undefined'

where this is the .aspx page where I am invoking the javascript (........In debug mode........)

<!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">

<head><title>

Untitled Page

</title></head>

<body>

<formname="form1"method="post"action="TextboxControlExtender.aspx"id="form1">

<div>

<inputtype="hidden"name="__EVENTTARGET"id="__EVENTTARGET"value=""/>

<inputtype="hidden"name="__EVENTARGUMENT"id="__EVENTARGUMENT"value=""/>

<inputtype="hidden"name="__VIEWSTATE"id="__VIEWSTATE"value="/wEPDwUKMTU2MDU1MzMyNmRkUxTiL0EJdFsaC+4LaXPyMoM+vY0="/>

</div>

<scripttype="text/javascript">

<!--

var theForm = document.forms['form1'];

if (!theForm) {

theForm = document.form1;

}

function __doPostBack(eventTarget, eventArgument) {if (!theForm.onsubmit || (theForm.onsubmit() !=false)) {

theForm.__EVENTTARGET.value = eventTarget;

theForm.__EVENTARGUMENT.value = eventArgument;

theForm.submit();

}

}

// -->

</script>

<scriptsrc="/WebSiteWithGridviewPopup/WebResource.axd?d=e1hMZA7bMS-12l4OlpBVog2&t=633094919250343210"type="text/javascript"></script>

<scriptsrc="/WebSiteWithGridviewPopup/ScriptResource.axd?d=bE9iCeXnsNaxZepCeJrty10Zp2JA17bfqyZtisl5QV__GgJ4zDkkp5l_tGlziZuExBp8ems-lTwWk2u6YfeRro3bMqTrzNSsBjjqAFrNt-k1&t=633100951944922711"type="text/javascript"></script>

<scriptsrc="/WebSiteWithGridviewPopup/ScriptResource.axd?d=bE9iCeXnsNaxZepCeJrty10Zp2JA17bfqyZtisl5QV__GgJ4zDkkp5l_tGlziZuExBp8ems-lTwWk2u6YfeRrlq_c6_bQWq0PxUbMmydKJrxdf-jb5cSD-zE5axCSJ7z0&t=633100951944922711"type="text/javascript"></script>

<scriptsrc="/WebSiteWithGridviewPopup/ScriptResource.axd?d=PeotOllo8RY_OCHMgv8uw9r9M6gR875CAT1qAC-lJ7eFqmPW68sQAINc6k0F4Ps5XMkdtZrqvwdB6e-F8yMgqeF0dIbyqGWAubV9C_cG6N41&t=633101585623459589"type="text/javascript"></script>

<scriptsrc="/WebSiteWithGridviewPopup/ScriptResource.axd?d=rVEfgG4vRl0htTZGeKoLT0CKHIIwdlo3pUYXt42k4BjbSDk3QJKJceVatRGv5Y9pbtKpRcgog8x795kh4YBDrir0qiCcwj9iyBSw6mD0SA2gHIUe3MKo9n05DDgJPjgq0&t=633162945908465060"type="text/javascript"></script>

<div>

<scripttype="text/javascript">

//<![CDATA[

Sys.WebForms.PageRequestManager._initialize('scr', document.getElementById('form1'));

Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);

//]]>

</script>

<inputname="TextBox1"type="text"id="TextBox1"/>

</div>

<div>

<inputtype="hidden"name="__EVENTVALIDATION"id="__EVENTVALIDATION"value="/wEWAgLMyZPkBwLs0bLrBpj28gA/EqHsgfILt/81sNEsbi+S"/>

</div>

<scripttype="text/javascript">

<!--

Sys.Application.initialize();

Sys.Application.add_init(function() {

$create(MyFirstControlExtender.MyFirstControlExtenderBehavior, {"id":"MyFirstC"},null,null, $get("TextBox1"));---->this is in yellow shadow after debugging

});

// -->

</script>

</form>

</body>

</html>

What is the scriptResource.axd?How it is helpful do debug the ajax errors

In callstack I got the error

> JScript anonymous function JScript


Please refer to this: http://ajax.asp.net/docs/tutorials/ExtenderControlTutorial1.aspx

Raymond I refered the site .

But i am not getting the exact cause of the error.

Can you clarify some more abt cause of the error so that i will check out the respective code

Swati


Can you compress the project that contains this control and send it to me?


Hi Raymond ,

thank u for the solution,

MyFirstControlExtender.MyFirstControlExtenderBehavior =function(element) {

MyFirstControlExtender.MyFirstControlExtenderBehavior.initializeBase(this, [element]);

// TODO : (Step 1) Add your property variables here

//

this._myPropertyValue =null;

-------------------------------------,Previously hadI $addHandlers(this.get_element(), function here

}

MyFirstControlExtender.MyFirstControlExtenderBehavior.prototype = {

initialize :function() {

MyFirstControlExtender.MyFirstControlExtenderBehavior.callBaseMethod(this,'initialize');

$addHandlers(this.get_element(), ------------------------Now Rectified

{'focus' :this._onfocus },

this);

// TODO: add your initalization code here

},

No comments:

Post a Comment