Showing posts with label extender. Show all posts
Showing posts with label extender. Show all posts

Wednesday, March 28, 2012

Extending the AutoComplete extender

I am trying to add more to the functionality of the AutoComplete extender. I would like to write my own and inherit from AutoCompleteExtender.

I would like to add a member variable that will hold the results from the last search ( similar to what the cache does, but just for the last search ) and then at a later point be able to compare a given string a see if it is one of the strings returned from the last search.

I am having trouble with the js. Any help would be appreciated

here is what my js file looks like, but I am not sure how to save the results from the last search.

Type.registerNamespace('CustomAutoCompleteControl');

CustomAutoCompleteControl.CustomAutoCompleteControlBehavior = function(element) {
CustomAutoCompleteControl.CustomAutoCompleteControlBehavior.initializeBase(this, [element]);
}

CustomAutoCompleteControl.CustomAutoCompleteControlBehavior.prototype = {

this._suggestions: null,

clearSuggestions: function() {
this._suggestions = null;
}
}

CustomAutoCompleteControl.CustomAutoCompleteControlBehavior.registerClass('CustomAutoCompleteControl.CustomAutoCompleteControlBehavior', Sys.Preview.UI.AutoCompleteBehavior);


I also created the .cs class and added the ClientScriptResource entry to make reference to the js file.

Do I need to overwrite the _update function, or what should I do to save the results? Any code would be helpful.

Thanks in advance

Looking at the AutoCompleteExtender, the completion list handles the mouseDown and Enter/Tab keypress events and calls a function by the name of setText which sets the textbox.

You may be able to use the existing property _currentPrefix...


_setText: function(text) {
this._timer.set_enabled(false);
this._currentPrefix = text;
var element = this.get_element();
var control = element.control;
// todo: should check for 'derives from' too and should somehow manually cause TB to raise property changed event
if (control && control.set_text) {
control.set_text(text);
}
else {
element.value = text;
}
this._hideCompletionList();
},


I would like to save the suggestions right before they are displayed to the user. There is a method called _update that is called which I think I would need to override, but I am not sure what the correct syntax to overriding a method is with this framework. Do I just rewrite that method the way I want it in my class and it will know to use that version for that method and the parent class' methods for the others? Do I need to override any other methods in order to make it work.

I think I have an idea on what I need to do, but the syntax is holding me back here. Any suggestions are appreciated.


Sorry, I misunderstood the first post. I thought you wanted to save the last finalized choice.

Extenders: Sub-categories for properties in design-mode?

I noticed that when creating properties for an extender control that they appear by default on the target control properties display in the designer all under the same category (the extender control name). The <category> attribute of the extender properties seems simply to be ignored. My control has a lot of properties (client-side charts) and it would be nice to be able to categorize them.

Is there a way to actually create sub-categories under the ExtenderName category for properties on the targeted control?

Thanks in advance,
Pascal

Unfortutately not, the property grid doesn't support categories on sub-objects. There really isn't a clean solution for this as an extender, but based on your description, I'm not sure an extender is what you really want to be using.

My guess is that you want to write a control that emits an extender as part of it's rendering process. That way, you can expose the properties via your control as you would a normal component, and then just pass those values down to the extender via code.

Extenders for controls inside TabContainer/TabPanel

Hi,

I have a textbox control (ID="'PasswordTxtBox' ") inside TabPanel and I am trying to attach watermark extender to it. In design mode TargetControlID for watermark extender does not appear and when I manually write it in the markup I get run time error saying

The TargetControlID of 'TextBoxWatermarkExtender1' is not valid. A control with ID 'PasswordTxtBox' could not be found

Please guide.

Regards & thanks

Kapil

My bad. I was _not_ putting the extender control in the contenttemplate of tabpanel.

Regards

Kapil

Extenders and windowed control problem

Hi,

we are using a couple of extenders such as the Calendar extender, Autocomplete extender etc...

The problem with those is when the form contains windowed controls such as the select box just below them... in that case, the usual "problem" of seeing the select through the extender div happens.

Before today, we were building our forms by keeping that in mind... making sure to avoid such positions. But now, our system should allow external people to define forms; which has quickly led to the above problem...

There is a workaround to this problem, using an empty iframe positioned right below the div; but is there any way to have extenders do the same to avoid the problem ? (as this problem is quite common, we think it is weird that it is not part of the extender functionality)

Thanks

/Tharn

ok, issue closed. They actually do it; but it does not work anymore as soon as controls are in relatively positioned elements.

I'll better report that to the codeplex project.

/t

ExtenderControlProperty expression without quotes

How do I create an extender control property that will refer to a client function handler (or client object, or any client expression)?

If I create an extender propety as string (eg. string Property1), it will be rendered in client control creation as a quoted string:

$created(myComponent,{"Property1" : "value in quotes", ...

However I want it to be passed as client-side expression like that:

$create(myComponent,{"Property1": value without quotes, ...

I need something similar to ExtenderControlEvent attribute, which references a client-side handler, but it can only reference the ajax handler like MyFunction(EventArgs), and not any function with custom parameters, nor any custom client object).

In your client-side setter for the property, you can use: "this._expression = eval(value);".
I would suggest that, in your server-side setter, you make sure to check to make sure the developer doesn't try to use any parameters and to remove "()" from the value. If you don't, the above expression will execute the function and set this._expression to the return value of that function instead of setting this._expression to the function itself.

Hope that helps.

Extender with inclusion of JS files in particular order.

Right now I'm working on an extender that needs to include numerous .js files I'd like to register for inclusion on a page.

I've added:

[assembly: System.Web.UI.

WebResource("first.js","text/javascript")]

[assembly: System.Web.UI.

WebResource("second.js","text/javascript")]

In the root of the Extender.cs class... as well as...

[ClientScriptResource("first","first.js")]

[

ClientScriptResource("second","second.js")]

Seems like if it were just one of the scripts by itslef it seems to do an ok job... but for scrips that rely on eachother, the straight up fail. Is the extender model only destined to have one script file period? If not, are scripts loaded and rendered in the order I add the ClientScriptResource attributes?

Is there another way I SHOULD be doing this? The .js files are being bundled in as Embedded Resource which is desired functionality, however the js variables that are now supposed to be present at the document scope simply arent. Somethign strange about which scripts are being loaded, or what order they are being loaded in.

Any advice would be greatly appreciated. Thanks

ClientScriptResource also takes named parameters, of which there is a LoadOrder and you can specify a load order. I found this to be the solution to my problem. Couple small little hurdles and I should be on my way.

Extender web service method is called differently

For a reason i do not understand, i have a web service which the the signature corresponds to what it is supposed to be (I see the signature everywhere) and this extender calls a completly different web method signature...

The extender is the cascading drop down list extender, it is supposed to call :

Public

Function GetDropDownContents(ByVal knownCategoryValuesAsString,ByVal categoryAsString)As AjaxControlToolkit.CascadingDropDownNameValue()

But instead it calls :

Public

Function GetDropDownContents()As AjaxControlToolkit.CascadingDropDownNameValue()

What this does is that it prevents me from knowing what values where already selected. Usually, this could be done by parsing the knownCategoryValues but since i don't get this param anymore, i'm a bit clueless at how to do this.

Can anyone help me understand this problem?

Hi,

I think ASP.NET AJAX will actually fail if it can't find a matching signature (this includes correctly cased parameter names). I'm guessing something else is the culprit here. You might want to take a look at your CascadingDropDown declaration to make sure it's calling the web service you're expecting (and when in doubt, compare against the sample website).

Thanks,
Ted
The problem is not the source or the function being called cause if you read what i said again, it is triggering something in the right web service, it's just not triggering the right function... and to fix the error 500 i had earlier i have to create a parameter less web method which is completly useless in this case...

Extender TargetControlId not sufficient enough to reference controls not in NamingContaine

Through reflection i see OnPreRender searches for a TargetProperty's TargetControl via its TargetControlID.
It only searches in NamingContainer of the Control this Extender is contained in.
I need ExtenderProperty to take both a NamingContainer and a TargetControlID so I can extend objects directly
on the page when this Extender may appear in a subcontrol.
Are ther plans to support extending Controls outside of the parent's NamingContainer space?
protectedoverridevoidOnPreRender(EventArgs e){base.OnPreRender(e);if ((this.._page;" href="http://links.10026.com/?link=http://www.aisto.com/roeder/dotnet/Default.aspx?Object=4">_page ==null) && (this.Page !=null)) {this.._page;" href="http://links.10026.com/?link=http://www.aisto.com/roeder/dotnet/Default.aspx?Object=6">_page =newPageWrapper(this.Page); }ScriptManagermanager1 =ScriptManager.GetCurrent(this.._page;" href="http://links.10026.com/?link=http://www.aisto.com/roeder/dotnet/Default.aspx?Object=12">_page);if (manager1 ==null) {thrownewInvalidOperationException("You must have a ScriptManager to use an ExtenderControl."); }Controlcontrol1 =this.NamingContainer;using (" href="http://links.10026.com/?link=http://www.aisto.com/roeder/dotnet/Default.aspx?Object=16">IEnumerator<T>enumerator1=this. Microsoft.Web.UI.ExtenderControl.TargetProperties { ... }" href="http://links.10026.com/?link=http://www.aisto.com/roeder/dotnet/Default.aspx?Object=17">TargetProperties. System.Collections.ObjectModel.Collection.GetEnumerator();" href="http://links.10026.com/?link=http://www.aisto.com/roeder/dotnet/Default.aspx?Object=18">GetEnumerator()) {while ( enumerator1 // Local Variable">enumerator1.MoveNext()) {Tlocal1 = enumerator1 // Local Variable">enumerator1..get_Current();" href="http://links.10026.com/?link=http://www.aisto.com/roeder/dotnet/Default.aspx?Object=20">get_Current();Controlcontrol2 =control1.FindControl(local1.TargetControlID);if (control2 !=null) {IScriptControlcontrol3 =manager1.RegisterControl(control2);control3.RegisterBehavior(this);continue; }thrownewInvalidOperationException(string.Format(CultureInfo.InvariantCulture,"Target control with ID '{0}' could not be found for extender '{1}'.",newobject[] {local1.TargetControlID,this.ID })); } }}

The Toolkit doesn't actually run this code - we have an override that will also search for controls at the page level.

Even if the extenders took a NamingContainer property, it doesn't fix the problem. NamingContainers can be nested, so you could end up in the same situation where you can't find the naming container.

In the May 4th release of the Toolkit, we added a "ResolveTargetControlID" event that you can handle to do these types of resolutions yourself. The if the extender can't locate the Control referenced by TargetID, this event will fire and you can return the control instance.

Extender Request: textarea maxlength

Please oh please oh please oh please would someone create an Extender that makes TextAreas (ie, Multiline TextBoxes) obey the maxlength property?

Sexy "characters remaining" indicator optionalStick out tongue

Actually you can do that by using the existing extender you want, inherit and add the MaxLegth. I do believe that already exist in the new ASP.NET AJAX. I'll try to find it for you, I just download it yesterday and still trying to finish my next extender to submit to MS

Did you have any luck with this, as I'm looking for the same thing.

thanks.

alex


not yet... sorry :-/
Any news on this one ? Trying to get the MaxLength work is driving me insane (JavaScript part). Does extender like this exist at all ?

Extender properties do not show up in the VS 2005 "Properties" Pane

Hi all,

I am a newbie and just trying to use the extender samples and made my first extender today, therefore maybe I am doing wrong...Confused

I followed all steps from the documentation but neither my extender nor those installed in my toolbox with the AtlasControlToolkit.dll (i.e. ConfirmButtonExtender) seems to work.Indifferent

I can see the controls into the toolbox but once dropped into the aspx page attempting to hook their properties to the respective control, by expanding them in the Properties pane, nothing happens, they do not show up.

Any suggestions?! (the release is obviously the latest available)

Thanks!

Tix

Known issue. We're close to an updated release which will have a fix for this.

Hi,

We actually just released version 60914 on 9/15 that should fix your problem.

Thanks,
Ted

Extender not working after partial page postback in Beta 2

Hi

I have a custom extender that worked fine under Beta 1 but has problems withUpdatePanels and partial page postbacks under Beta 2.

It appears that the behavior.js script resource associated with the extender is not send to the client after a partial page postback. The 'initialize' function on the behavior is not called after the partial page postback. The 'dispose' function is call the first time the partial page postback is execute so I would assume that the 'initialize' function should be called after the partial page postback has completed in order for the event handlers to be hooked up again.

The extender works perfectly when used outside of anUpdatePanel.

Any suggestions would be appreciated.

Cheers

I have the same problem with the collapseable panel. Did you find a solution?

I'm getting extremely annoyed, I've been searching and trying things for three days straight related to this. It seems that with Beta 2 your custom extender registers the $create() statement fine and is intialized properly within an update panel, but when you do a partial postback of this updatepanel the dispose method is never called, and the initialize is never recalled, so while you have the appropriate HTML Dom elements you no longer have anything hooked up to your client extender. I have seen SEVERAL posts about this in all the forums and not one response from microsoft. THis is the biggest issue keeping us from moving forward with our development. I at least want someone to acknowledge it's a problem. PLEASE MICROSOFT I'M BEGGING YOU TELL ME WHY MY CONTROLS WON'T DISPOSE FOR THE LOVE OF PETE.... okay I feel better now, but only slightly because my controls still don't work.

I also noticed this is a problem with any of the tookit extenders, I threw a watermark extender in anupdate panel and it works fine on the initial load, but fails to after a partial postback.


I have a sample app ready to go, very simple and it clearly identifies the problem, one page with an updatepanel a scriptmanager and a watermark extender and a button inside the update panel. When the page loads, the extenderhas the watermark text in it, when you hit the test button performing a partialpostback, no more watermark. Problem is I can't include it, anyone know how?


hello.

can you put it somewhere and send us the link?


I don't really have a public site I can put it to. I tried to attach it to the thread but it said I didn't have permission. Any ideas, if not send me a private reply and I'll send it to you if you have a place you can put it. Luckily it's a real simple website with only one page but it doe show the problem.

hello.

send it to my mail (get it from the profile) and refer the thread id on the mail message.


Thanks to Luis doing some work this weekend he figured out that in the simple example all that was needed was to change the enableeventvalidation to true and this caused the extender to work properly. However, now that I flip that in my main application I'm getting this error.

Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@.Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the
data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

So the pain continues. Luis did make a point I agree with, whether or not EnableEventValidation="true" should not hinder these controls from working, specifically when to get the cascadingdropdown to work it needs to be set to false as I've seen in other posts. I'm opening a bug in codeplex this morning, but if anyone has been able to get their custom controls to work within an update panel please let me know. These bugs or incosistencies or whatever they are, are killing us. Everything was working great till this Beta release.


I've entered this as a bug

http://www.codeplex.com/WorkItem/View.aspx?ProjectName=AtlasControlToolkit&WorkItemId=5795


reading this post 2 days agou would have saved me 2 days of debugging (if only it would have been posted 2 days ago)


Anyway, I totally confirm this issue and I am voting it now on codeplex (http://www.codeplex.com/WorkItem/View.aspx?ProjectName=AtlasControlToolkit&WorkItemId=5795)


Thank god I no longer feel alone :) I've been trying everything for about 5 days straight now, our development has totally come to a crawl. I have a workaround in ming I am going to try this week, it'll be a temporary hack but I'll pst it when I'm done if it works.


zuke004:

Thank god I no longer feel alone :) I've been trying everything for about 5 days straight now, our development has totally come to a crawl. I have a workaround in ming I am going to try this week, it'll be a temporary hack but I'll pst it when I'm done if it works.

:)

You are not alone mate! My last 2 days were hell because of this issue. would you mind to share the temporary hack you had in mind?


And I am getting all my friends and colleagues that I've dragged with me into this issue trying to spot the problem to vote the bug you've logged on codeplex so that it gets prioritized

hello.

well, unfortunatelt, this seems to be an internal error which is very difficult to debug, i've found where the problem, but i still haven't understood why the code was written like that. the problem lies in the renderformcallback method of the pagerequestmanager class.

here's the code that is responsible:

if (this._owner.IPage.EnableEventValidation)
{
HtmlTextWriter writer2 = new HtmlTextWriter(TextWriter.Null);
foreach (Control control1 in containerControl.Controls)
{
control1.RenderControl(writer2);
}
}
rendering the control is necessary for the watermark extender to add the necessary scripts into the page (they'll ony be added if the render method of the scriptmanager control renders itself, ie, if its render method is called and this will only happen when EnableEventValidation is true as you can see from the previous code).

since this is a private auxiliary class used by scriptmanager, there's not much that can be done for now...


Hi Luis and thank you very much for your answer.

Could you recommend any partial/temporary solution that we could use for the moment (sorry for being lazy and asking such questions :)

Extender not collapsing when button clicked - code posted. Using Fridays build 11/10

When I click on the button - the extender should collapse. It collapses when I click on the header of pnlHeader. But not when I click on the button.
This code worked in beta 1. If I get rid of the updatepanel it works.

<form id="form1" runat="server">
<atlas:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<atlas:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" RenderMode="inline">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<ajaxToolkit:CollapsiblePanelExtender ID="cpe" runat="Server" TargetControlID="pnlAddAccounts"
ExpandControlID="pnlHeader" CollapseControlID="pnlHeader" Collapsed="False" ImageControlID="Image2"
SuppressPostBack="true">
</ajaxToolkit:CollapsiblePanelExtender>
<asp:Panel ID="pnlHeader" runat="server" Visible=true style="cursor: pointer;" CssClass="collapsePanelHeader">
<table border=0 cellpadding=3 cellspacing=0 width="100%" height="20px">
<tr><td align=center valign=middle width="97%">Additional Accounts</td>
</tr></table>
</asp:Panel>

<asp:Panel ID="pnlAddAccounts" runat="server" Visible="true" style="overflow:hidden;">
asdfaslkdjflajsfdlj
</asp:Panel>
</ContentTemplate>
</atlas:UpdatePanel>
</div
</form>

protected void Button1_Click(object sender, EventArgs e)
{
cpe.Collapsed = true;
cpe.ClientState = "true";
}

I've just createdwork item 5688, "Switch to ScriptManager.RegisterHiddenField for ClientState backing store", to track this problem. Here's the description from the work item:

The investigation ofhttp://forums.asp.net/thread/1462069.aspx led to the realization that an ASP.NET AJAX behavior change between Beta1 and Beta2 such that Extender controls now have their GetScriptDescriptors methods called during Render (instead of PreRender) can cause breaking changes for users who update ClientState during async postbacks. Specifically, the updated ClientState value won't necessarilly be included in the updated UpdatePanel content that's sent back to the browser. The fix for this is to use ScriptManager.RegisterHiddenField to create the relevant backing store. It's supposed to be fairly straightforward to do.

Sorry for the trouble, we'll get this fixed for our next release!


I don't have this property ScriptManager.RegisterHiddenField in my scriptmanager...

When the next release is supposed to go out?

Thanks


With luck, sometime soon-ish. :)

Extender for two controls (Toggle-able Collapsible Panels)

I'm looking to build my first extender and the one I've chosen is a variation on the CollapsiblePanel so I've started with that control as my base. I've removed the ExpandControlID property and forced the CollapseControlID to always be a toggle. I've also added a property, CollapsePanelID, which is the ID of a second panel. At startup, the TargetControlID is expanded, the CollapsePanelID is collapsed and the CollapseControlID is used to toggle the two of them together.

I'm having trouble setting up the animation for the second panel. For the first, I see the line:
_animation.set_target( this );
I can't figure out how to call a similar function for the CollapsePanelID. I thought maybe there was a Sys.UI.Panel object I could create and configure for the second panel but I don't see one. The idea is that I would set up a second animation for the second panel, then in the _doOpen and _doClose functions, I'd play it along with the existing one.

This is for my own edification, not for any specific problem. I've already been able to do this functionally with two CollapsiblePanels. Just picked this as my project for learning extenders. Even as I write this, I'm thinking there might be a better way to do this but it would still involve the ability to create a Sys.UI control that maps to an asp:panel object.

Thanks,
Kyle

Hi Kyle,

Check out the JavaScript inFAQ item #13. It does essentially what you want - given an ID"Link1" it creates a newSys.UI.Control wrapper for it. This is what you need to pass intoset_target.

It's also worth mentioning that we've got a similar control in the works for the next release of the Toolkit. You check it out in the Prototypes project on CodePlex if you're interested.

Thanks,
Ted

Thanks, Ted. That FAQ item does look like what I want. I'll check it out.

Downloaded the source from CodePlex and had trouble opening the Prototypes project ("The project type is not supported by this installation"). I'll get it worked out but thought I'd raise the issue.

Thanks again,
Kyle


Never mind about the error. Read the instructions, installed the web app update and all is well.

Extender fails after partial postback in IE7 only

I have a simple extender which sets focus to a textbox when the page loads. In IE after a partial postback this control doesn't reset the focus. It does work on page load however and it works every time in FireFox. Any suggestions? Below is the JS for the extender:

Type.registerNamespace('AjaxFocus');

AjaxFocus.AjaxFocusBehavior = function(element)
{
AjaxFocus.AjaxFocusBehavior.initializeBase(this, [element]);
}

AjaxFocus.AjaxFocusBehavior.prototype =
{
initialize : function()
{
AjaxFocus.AjaxFocusBehavior.callBaseMethod(this, 'initialize');

var e = this.get_element();

if (e != null)
e.focus();
},

dispose : function()
{
AjaxFocus.AjaxFocusBehavior.callBaseMethod(this, 'dispose');
}
}

AjaxFocus.AjaxFocusBehavior.registerClass('AjaxFocus.AjaxFocusBehavior', AjaxControlToolkit.BehaviorBase);

Is the Extender inside of the update panel?

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>

Extender Controls not compiling

Hello ,

I recently started working with Ajax/Atlas. I have set up atlas extensions , and am trying to add the control toolkit . I follwoed the instructions , The items show up in the toolbox. When I drag any of the controls onto a webform . Intellisense tell me that the control is not a known element.

I realize this is vague, but if anyone can point me in the right. direction .

Thanks in advance

It seems to be related to how the controls are registered in the site . I have opened other sample projects where the controls are being used and they work fin, in that project .

Extender controls may not be registered before PreRender.

Anytime I insert a calendar extendar control or any other control from the Ajax toolkit in gridview or detailsview template. I get the page exception error. "Extender controls may not be registered before PreRender". I am using the latest Atlas DLL's.

I noticed other posts about the same subject but no clear or detailed answer to the solution. Any help will be greatly appreciated. Preferebly in vb.net please.

Hi,

by "latest Atlas DLL" do you mean ASP.NET AJAX 1.0 ?


Yes,

I meant ASP.NET AJAX 1.0 Garbin. Thanks for the offer to help. I did eventually found the fix for this problem by trial and error. I simply took the ScriptManager out of the Detailsview Control -Insertview section and placed it on the page I had the Detailsview control and Walla! problem resolved. I am sure this is probably cheating but hey it worked. If anybody has any insight as to why this happens and what is the right fix for it please enlight us all.

Once again to recreate the problem try the following steps.

1. Drag and drop a detailsview control on your page.
2. Bind the detailsview control to any datasource.
3. In Detailsview Insert mode drag and drop a textbox then any drag and drop any Atlas control ( I tried Calendar Extendar) right inside the Detailsview insert item template.
4. Bind Calendar extender to the Textbox.
5. Preview your page on your web browser and you will see the ugly exception "Extender controls may not be registered before PreRender."


Hi,

I'm not sure why it's happening, but the ScriptManager control should always be declared in the page (or in the Master Page) rather than in a control's template.


Thanks man! This fixed my problem.

I ran into this problem after I added a Login Control on my Master Page. I had to move my script manager from my "inner page" into my Master Page and that fixed the problem.

Cheers!

Extender controls arent actually doing anything??

Everything builds correctly but I'm haven't seen any of the extender features in action.

I have a text box and a watermark extender. Nothing happens when I view the page... Also when I tried to run the examples the extender features didn't work there either... Its seems like I'm missing something somwhere... (maybe I need to copy some script files to an asp.net folder or place the ajaxcontroltoolkit.dll somewhere)

Here's what I did for installation:
Downloaded the examples from herehttp://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=AtlasControlToolkit to my desktop
Grabbed the ajaxcontroltoolkit.dll and dragged it to my toolbox of visual studio

Lastly... my other ajax stuff is working fine (using script manager and updatepanel)
Maybe there's an installation package for the ajaxcontroltoolkit that I missed.

Here's my sample page:

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

<asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager>
<ajaxToolkit:TextBoxWatermarkExtenderID="TextBoxWatermarkExtender1"runat="server"TargetControlID="TextBox1"WatermarkText="test"></ajaxToolkit:TextBoxWatermarkExtender>
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox></form>

Thanks,
Paul

well... uninstalling and reinstalling everthing ajax related fixed it

Extender Control properties in a switch/case

Hello,

I have problems using properties of an Extender Control in a switch/case selection.

I wrote an ASP.NET AJAX Extender Control to control a GridView with keyboard shortcuts. For that, the user can configure declaretively what keys to use for e.g. paging in the GridView. The key values are mapped to properties in the JavaScript part of the Extender Control (Sys.UI.Behavior class).

In a handler function I determine which key the user has pressed and call the porper _postBack. This works fine with if/else, e.g. if (KeyEvent.keyCode == this._delKeyCode). But with switch/case, e.g. switch (KeyEvent) { case this._delKeyCode: ... break; .. the pressed key is not determined and nothing happens with the GridView. There are also no JavaScript errors. It seems, that with switch/case a control property can't be determined as with if/else.

Thank You

Regards

Rolf

The switch should be:

switch (KeyEvent.keyCode) {
case this._delKeyCode:
// Something
break;
}

-Damien


Thanks Damien,

but sorry it is a typo in my post. I'am actually using

switch (KeyEvent.keyCode) instead ofswitch (KeyEvent) as I wrote. So I'am actually using the switch statement you suggest.

Regards

Rolf


My only guess why it isn't working is because you are comparing against a variable (e.g. this._delKeyCode), try using the actual numeric key code...

-Damien

Extender control nested in 2 DataControls

Hello all!

I have problem when using The CollapsiblePanel Extender control nested in 2 dataControls.

My Code like this

1<asp:DataList id="1" DataSourceID="sds1" runat="server">2 <ItemTemplate>3 <asp:Panel id="pl1" runat="server">4 <asp:Label id="lbl1" runat="server" text="<%# Bind("NewsTitle")%>"/>5 </asp:Panel>6 <asp:LinkButton runat="server" id="lb1"/>7 <asp:Repeater id="gv1" runat="server" DataSourceID="sds2">8 <ItemTemplate>9 <asp:Label id="lbl1" runat="server" text="<%# DataBinder.Eval(Container.DataItem,"NewsTitle")%>"/>1011<atlasToolkit:CollapsiblePanelExtender ID="cpe" runat="Server">12 <atlasToolkit:CollapsiblePanelProperties13 TargetControlID="pl1"14 CollapsedSize="0"15 ExpandedSize="300"16 Collapsed="True"17 ExpandControlID="lb1"18 CollapseControlID="lb1"19 ScrollContents="True"20 TextLabelID="Label1"21 CollapsedText="Show Details..."22 ExpandedText="Hide Details"23 ImageControlID="Image1"24 ExpandDirection="Height"/>25</atlasToolkit:CollapsiblePanelExtender>262728 </ItemTemplate>29 </asp:Repeater>30 </ItemTemplate>31</asp:DataList>

Then when view this page in browser, it throw the message "Can't find Control 'pl1' for the extender 'cpe'"

How can i fix this error? Thank all!

If you move the CollapsiblePanel declaration up a level so that it sits right next to the label/panel it touches, this scenario seems to work fine for me. Have you tried that?

HiDavid!

Thank for your reply! But, i dont want move it up a level, it must be this current DataControl.

Eample, in a news site, i use datalist for display a list of new catalogue, in each news catalogue, i display some news.

My extenderControl is not Collapsible Panel, it my owner, when you click in a news Title (This News Title is in DataControl level 2 -- so DataControl level 2 have more than 1 link like that) , an Panel near this DataControl level2 and in DataControl level 1 will display some text from server (This text get by My Extender control).

So, do you know why i cant not move it up a level?

I have try Reflector and saw this error message in OnPreRender (At Microsoft.Web.UI.ExtenderBase...<T>). And this Code only support for Control in this.Page or this.NamingContainer,...

I think Atlas not good in processing it, for the best, i think this code (or another code like this ^_^) is require to find All Control that name "ID"

Control myctl =this;Control control1;while (myctl !=null){ control1 = myctl.FindControl("ID");if (control1 ==null) myctl = myctl.Parent;else myctl =null;}

Do you think so?

Thank!


oh! Im so sorry! My code:


1Control myctl =this;23Control control1;45while (myctl !=null)67{89 control1 = myctl.FindControl("ID");10if (control1 ==null) control1 = myctl.NamingContainer.FindControl("ID");11if (control1 ==null) myctl = myctl.Parent;1213else myctl =null;1415}16

Okay, there's a way to do this, but it's subject to change in the future, so it's probably best not to rely on it. But what you can do to help resolve controls that couldn't otherwise be found is to add a OnResolveTargetControlID property to your extender and then write a simple method that does the resolution for you. The OnResolveTargetControlID method is called when the extender fails to resolve the TargetControlID using its usual steps (current naming context, parent naming context, page naming context). This applies only for TargetControlID, but when it works, it's nice. :) Here's a complete sample to demonstrate the concept. Note that I've got the same basic structure you have with the extender nested deeper than the control it's targetting. Hope this helps!

<%@. Page Language="C#" %><%@. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlastoolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected override void OnLoad(EventArgs e) { base.OnLoad(e); xds1.DataFile = HttpContext.Current.Server.MapPath("~/App_Data/CarsService.xml"); } protected void ResolveTargetControlID(object sender, Microsoft.AtlasControlExtender.ResolveControlEventArgs e) { if ("p1" == e.ControlID) { e.Control = ((Control)sender).NamingContainer.NamingContainer.NamingContainer.FindControl(e.ControlID); } }</script><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <atlas:ScriptManager ID="sm1" runat="server"> </atlas:ScriptManager> <asp:XmlDataSource ID="xds1" runat="server"></asp:XmlDataSource> <asp:DataList ID="dl1" runat="server" DataSourceID="xds1"> <ItemTemplate> <asp:Panel ID="p1" runat="server" BackColor="Lime"> Hello </asp:Panel> <asp:Repeater ID="r1" runat="server" DataSourceID="xds1"> <ItemTemplate> Hi <atlastoolkit:DropShadowExtender ID="dse" runat="server" OnResolveTargetControlID="ResolveTargetControlID"> <atlastoolkit:DropShadowProperties TargetControlID="p1" Width="2" /> </atlastoolkit:DropShadowExtender> </ItemTemplate> </asp:Repeater> </ItemTemplate> </asp:DataList> </div> </form></body></html>

e.Control = ((Control)sender).NamingContainer.NamingContainer.NamingContainer.FindControl(e.ControlID);

^_^
So many "NamingContainer" --> so fun.
Thank you first! I will try your help!

Hello again! i've try your help and get the best! thanks you very much, with other control, not the target, there is no problem!

But i want to know: Is there an other way to do this? Some time, we dont know how many 'NamingContainer' needed!


You could build a more flexible implementation that kept searching each naming container up the chain until it reached the top (null) or found the control. But the basic idea's the same as what I showed: find the control near where you expect it to be. Glad this worked for you!