Showing posts with label extend. Show all posts
Showing posts with label extend. Show all posts

Wednesday, March 28, 2012

How do I modify the AutocompleteExtender?

I want to extend the AutoCompleteExtender so that a if the search returns a large number of results, the first 10 results are displayed and the user is given some indication that there are additional matching results, with the option for them to fetch more results. Can anyone give me any pointers as to how to get started with this as I'm new to Atlas?

Hi,

I think it will be difficult to accomplish this task with the AutoCompleteExtender since it's not possibile to pass additional paramters to the auto-complete service method.

Thanks for the reply Garbin.

That seems a real shame since the nature of my application means that unless I can provide this functionality the AutoCompleteExtender is not going to be any use to me... back to the drawing board I guess!

How do I modify the AutocompleteExtender?

I want to extend the AutoCompleteExtender so that a if the search returns a large number of results, the first 10 results are displayed and the user is given some indication that there are additional matching results, with the option for them to fetch more results. Can anyone give me any pointers as to how to get started with this as I'm new to Atlas (and the toolkit)?

This question doesn't involve the Atlas Control Toolkit; please try asking on one of the Atlas forums instead! Thanks!

Monday, March 26, 2012

How do I extend an Atlas extender?

Let's say I create my own Atlas Control Extender. For example, I create an extender called MyHoverExtender. But instead of extending Control or WebControl, I want to extend the HoverMenuExtender. But when I change it to use that, I get this error:

error BC32044: Type argument 'SearchResultItem.MyHoverExtenderProperties' does not inherit from or implement the constraint type 'Microsoft.AtlasControlExtender.TargetControlPropertiesBase(Of AtlasControlToolkit.HoverMenuExtender)'.

Can anyone help me with this error?

Thanks

The extender class and the properties class have to travel in pairs. So if you derive from the extender, you need to also do so from the properties class. I think if you just have your MyHoverExtenderProperties class inherit from HoverMenuProperties you should be OK.



So here's what I've got right now:

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

MyHoverExtenderDesigner.vb:

Class MyHoverExtenderDesigner
Inherits Microsoft.AtlasControlExtender.Design.ExtenderControlBaseDesigner(Of MyHoverExtenderProperties, AtlasControlToolkit.HoverMenuExtender)
End Class

Produces this error:

error BC32044: Type argument 'SearchResultItem.MyHoverExtenderProperties' does not inherit from or implement the constraint type 'Microsoft.AtlasControlExtender.TargetControlPropertiesBase(Of AtlasControlToolkit.HoverMenuExtender)'.

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

MyHoverExtenderExtender.vb:

<Assembly: System.Web.UI.WebResource("SearchResultItem.MyHoverExtenderBehavior.js", "text/javascript")>

<System.ComponentModel.Designer(GetType(MyHoverExtenderDesigner))> _
<Microsoft.AtlasControlExtender.ClientScriptResource("MyHoverExtender", "MyHoverExtenderBehavior", "SearchResultItem.MyHoverExtenderBehavior.js")> _
Public Class MyHoverExtenderExtender
Inherits Microsoft.AtlasControlExtender.ExtenderControlBase(Of MyHoverExtenderProperties, AtlasControlToolkit.HoverMenuExtender)
End Class

Produces this error:

error BC32044: Type argument 'SearchResultItem.MyHoverExtenderProperties' does not inherit from or implement the constraint type 'Microsoft.AtlasControlExtender.TargetControlPropertiesBase(Of AtlasControlToolkit.HoverMenuExtender)'.

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

MyHoverExtenderProperties.vb

<System.ComponentModel.DefaultProperty("MyProperty")> _
Public Class MyHoverExtenderProperties
Inherits Microsoft.AtlasControlExtender.TargetControlPropertiesBase(Of AtlasControlToolkit.HoverMenuProperties)

Public Property MyProperty() As String
Get
Return GetPropertyStringValue("MyProperty")
End Get
Set(ByVal value As String)
SetPropertyStringValue("MyProperty", value)
End Set
End Property

End Class

This file builds without any errors as far as I can tell.


Oh, sorry, just find my problem.

The MyHoverExtenderProperties class was declared thusly:

Public Class MyHoverExtenderProperties
Inherits Microsoft.AtlasControlExtender.TargetControlPropertiesBase(Of AtlasControlToolkit.HoverMenuProperties)

But it should be declared:

Public Class MyHoverExtenderProperties
Inherits Microsoft.AtlasControlExtender.TargetControlPropertiesBase(Of AtlasControlToolkit.HoverMenuExtender)


That's closer. Does that work?

I think you actually want:

public class MyHoverExtender inherits HoverMenuExtender

public class MyHoverExtenderProperties inherits HoverMenuProperties

What you have above says that you'll be extending controls of type HoverMenuExtender, which I don't think you want.


Yeah, I think you're right. I'm in the process of confusing myself today between wanting to extend my own custom control using a modified version of the hover extender. I think I've almost got my head around it all.

:) Okay if you want more help confusing yourself, just let us know and we'll be glad to lend a hand.

Seriously, our refresh should help with this - I'm concerned you may run into some issues getting the right scripts to load as is. I haven't tried what you're doing so do let us know.

How do I extend a DataGrid/DataList for ATLAS behavior?

I have two inherited DataGrid and DataList classes that render a paged grid and list with some enhanced behaviors (better pagers and retreiving only items that are shown with NHibernate). I would like paging not to refresh the page.

It's easy with an UpdatePanel: add a panel, add an event OnDataBinding( ) and Update the panel. For my project (www.foodcandy.com) this means updating a hundred grids and lists.

So instead I would like to build the panel behavior into the actual DataGrid and DataList and have all my grids behave this way. The first easy thing is to add a panel property and tell the grid/list that it's inside an update panel. But I still have to modify a 100 pages to add the update panels.

How do I do something like that?

Thx
dB.

hello.

maybe building a usercontrol will be the faster way to get what you want...though i still think that i'd add the panel to all the pages..


I doubt it will be faster Luis - this is a datagrid, I would need to expose all the methods for various properties like PagerStyle and I am not even sure what to do with ItemTemplates. No?

hello.

well, i was thinking in adding a property to the usercontrol that lets you get a reference to the datagrid.


Luis Abreu:

well, i was thinking in adding a property to the usercontrol that lets you get a reference to the datagrid.

I haven't tried this, but can you nest this in the aspx pages by having MyUserControl expose the DataGrid member?

<MyUserControl>
<DataGrid>
<TemplateColumn ... />
</DataGrid>
<MyUserControl>