473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Ajax Toolkit - My brain hurts

The following code is the code behind of a blank page (With a scriptmanager)
on which I'm trying to simulate a problem I'm having elsewhere in a larger
app.

The app is supposed, in this case, to dynamically create a textbox and a
MaskEditExtender and associate the 2 together.

I'm obviously doing something wrong as I'm getting a exception.
-------------------------------------------------------------
[NullReferenceException: Object reference not set to an instance of an object.]
AjaxControlToolkit.MaskedEditExtender.OnLoad(Event Args e) +168
System.Web.UI.Control.LoadRecursive() +65
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +2603
-------------------------------------------------------------
Any Ideas?

--
Rory

-------------------------------------------------------------
Public Partial Class ControlTesting
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Controls.Add(New SpecialControl)
End Sub

End Class
Public Class SpecialControl
Inherits WebControl
Implements INamingContainer

Private Sub SpecialControl_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim ControlAsTextBox As New TextBox
ControlAsTextBox.ID = "TextBox"
ControlAsTextBox.CssClass = "textbox"
ControlAsTextBox.AutoCompleteType = AutoCompleteType.Disabled
Dim Mask As String = "LL-#####"
If Mask <String.Empty Then
Dim MyExtender As New AjaxControlToolkit.MaskedEditExtender
MyExtender.Mask = Mask
MyExtender.TargetControlID = ControlAsTextBox.ID
MyExtender.MessageValidatorTip = True
MyExtender.OnFocusCssClass = "MaskedEditFocus"
MyExtender.OnInvalidCssClass = "MaskedEditError"
MyExtender.MaskType = AjaxControlToolkit.MaskedEditType.None
MyExtender.InputDirection = AjaxControlToolkit.MaskedEditInputDirection.LeftTo Right
MyExtender.AcceptNegative = AjaxControlToolkit.MaskedEditShowSymbol.None
MyExtender.DisplayMoney = AjaxControlToolkit.MaskedEditShowSymbol.None
MyExtender.ErrorTooltipEnabled = True
Controls.Add(MyExtender)
End If
End Class
-------------------------------------------------------------
Jul 10 '08 #1
4 2550
Hello,

What if you add the TextBox to the "Controls" collection ?

--
Patrice
Jul 10 '08 #2
Hello Patrice" http:www.chez.com/scribe/,
What if you add the TextBox to the "Controls" collection ?
Doh! well I definitly needed to do that.

However now I'm getting something else.

I'm guessing it's because the textbox is not in the page hierarchy (only
added thus far to the specialcontrol) when 2 controls are paired up. but
I don't see how it could be as the specialcontrol has not yet been added
to the page
-------------------------------------------------------------
HttpException (0x80004005): Control 'ctl02_TextBox' of type 'TextBox' must
be placed inside a form tag with runat=server.]
System.Web.UI.Page.VerifyRenderingInServerForm(Con trol control) +2049759
System.Web.UI.WebControls.TextBox.AddAttributesToR ender(HtmlTextWriter
writer) +49
System.Web.UI.WebControls.WebControl.RenderBeginTa g(HtmlTextWriter writer)
+17
System.Web.UI.WebControls.TextBox.Render(HtmlTextW riter writer) +17
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer, ControlAdapter
adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter writer, ICollection
children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +20
System.Web.UI.WebControls.WebControl.RenderContent s(HtmlTextWriter writer)
+7
System.Web.UI.WebControls.WebControl.Render(HtmlTe xtWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer, ControlAdapter
adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter writer, ICollection
children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer, ControlAdapter
adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +2558

-------------------------------------------------------------
Jul 10 '08 #3
Well, the error says it all...read it.
" Control 'ctl02_TextBox' of type 'TextBox' must be placed inside a form tag
with runat=server"

I would highlight word "must" here....

George.
"Rory Becker" <ro********@newsgroup.nospamwrote in message
news:3a**************************@news.microsoft.c om...
Hello Patrice" http:www.chez.com/scribe/,
>What if you add the TextBox to the "Controls" collection ?

Doh! well I definitly needed to do that.

However now I'm getting something else.

I'm guessing it's because the textbox is not in the page hierarchy (only
added thus far to the specialcontrol) when 2 controls are paired up. but I
don't see how it could be as the specialcontrol has not yet been added to
the page
-------------------------------------------------------------
HttpException (0x80004005): Control 'ctl02_TextBox' of type 'TextBox' must
be placed inside a form tag with runat=server.]
System.Web.UI.Page.VerifyRenderingInServerForm(Con trol control) +2049759
System.Web.UI.WebControls.TextBox.AddAttributesToR ender(HtmlTextWriter
writer) +49
System.Web.UI.WebControls.WebControl.RenderBeginTa g(HtmlTextWriter
writer) +17
System.Web.UI.WebControls.TextBox.Render(HtmlTextW riter writer) +17
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter writer,
ICollection children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +20
System.Web.UI.WebControls.WebControl.RenderContent s(HtmlTextWriter
writer) +7
System.Web.UI.WebControls.WebControl.Render(HtmlTe xtWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter writer,
ICollection children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558

-------------------------------------------------------------

Jul 10 '08 #4
Hello george,
Well, the error says it all...read it.
" Control 'ctl02_TextBox' of type 'TextBox' must be placed inside a
form tag
with runat=server"
I would highlight word "must" here....

George.

I was about to reply that "as far as I knew" the textbox was in the form.
After all .. what else have I been adding it to?

Then I thought about that question for a moment. For anyone else who might
have come across this....

-------------------------------------------------------------
Controls.Add(SomeControl)
-------------------------------------------------------------
....is not the same as...
-------------------------------------------------------------
Form1.Controls.Add(SomeControl)
-------------------------------------------------------------

Thanks for the tip George :)

Now all I have to do is to sort out that AJaxPro conflict.. ( thats for another
post)

Thanks again

--
Rory

Jul 10 '08 #5

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

Similar topics

0
by: melledge | last post by:
Ajax Developers' Day to Kick Off XTech 2006 Conference Industry experts offer insight into next generation of the Web ALEXANDRIA, VIRGINIA, USA - April 25, 2006 - In response to the rapidly...
1
by: mark4asp | last post by:
Which should I use: 1. "ASP.NET AJAX-Enabled Web Site" or 2. "AJAX Control Toolkit Web Site"? In the first, controls from the control toolkit start as: <cc1:SomeControl></cc1> In the 2nd,...
2
by: =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?= | last post by:
Hi, I am a newbie in AJAX technologies. For my application I need a combination of ListSearchExtender and FilteredTextBox control. I have downloaded the toolkit with source code, and seem to...
2
by: Mike P | last post by:
Whenever I startup an Ajax Control Toolkit Website I get the following error: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,...
2
by: Cirene | last post by:
3 quick questions... 1. Are the controls in the AJAX Futures download "beta" or the release and stable version? 2. Also, where is the best way to learn how to implement these? (Other than by...
2
by: =?Utf-8?B?Q2VzYXI=?= | last post by:
I have the ASP.NET 2.0 AJAX Extensions 1.0 installed (v1.0.61025). As to the web.config file, I'm using the one created using the ASP.NET AJAX-Enabled website ... This error is due to that I'm...
1
by: GaryDean | last post by:
I have an asp.net 2.0 website using the ajax toolkit 1.0 running on server2003 using vs2005 on a 32 bit machine. I need to transfer it to my vista 64 bit machine. I'm following the MSDN article:...
5
by: simon | last post by:
hello, I have a server set up on my local (home) network and can not get an ajax application to run on the box. it works fine on our developement server and also works fine locally. I...
11
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7...
1
by: nehalsmistry | last post by:
Hello.. I am using visual studio 2005. So there is framework 2.0 Now I m using ajax toolkit for 2.0 and installed it. But there is no option like Asp.net ajax enable website. But there is 1...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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

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