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

Wednesday, March 28, 2012

Extending the AutoCompleteExtender

Hi,

I'm trying to extend the AutoCompleteExtender so that is also can return an extra (hidden) value. For now I just do this by passing the text and the value returned by the WebMethod just as a comma separated string, i.e. "AnObject;5" (where 5 is the ID of the object). I just started on this so I'm not sure of I'm doing things the way they are supposed too. So here's a question.

I managed to extend the AutoCompleteBehavior javascript so that I can pass the result of the WebMethod to the TextBox and it just shows the text (the value is split of).

I also added an extra property ValueTextBoxId to the Properties of the AutoCompleteExtender to reference the TextBox which should store the hidden value. I have now the correct ClientId of the TextBox in the javascript. Next step is setting the value of that textbox.

I can use $(this.get_valueTextBoxId()).value to set it. But I guess it's more in the ways of Atlas to use the Sys.Ui.TextBox object. Only I cannot find any documentation how I can use that object when I have just a ClientID.

Anybody an idea?

Not sure of the solution to your other issues, but to use the Sys.UI.TextBox with a client id you need only do this.

var AtlasTextBox = new Sys.UI.TextBox($(ClientID));
AtlasTextBox.initialize(); // I can't remember if this line is required or not.

Jay

Extending Server Controls?

I see this blurb on the tutorials section:

"Extend server controls or control extenders: You might create new behaviors for given server controls by implementing a server control that also implements the IScriptControl to render the ASP.NET "Atlas" client script and register with the ScriptManager in the Web page. Page developers will gain from specific new server-side controls without needing to write ASP.NET "Atlas" script or JavaScript."

This is great to hear, anyone know how this works? ie. I see it says I don't need to write script at all?

Let's say I wanted a input mask textbox - how would I 'extend' the TextBox using IScriptControl and do this code without writing script?

Hi,

check alsothis article from my blog for an introduction to extenders.

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 control CalendarExtender1 cannot extend DropDownList1

there is no problem when i try to extend the Calendar extender to the text box it is running fine, but

the Exception is :'AjaxControlToolkit.CalendarExtender' cannot extend controls of type 'System.Web.UI.WebControls.DropDownList',

im getting this Exception when i try to extend Ajax-calender Extender conrtol to dropdownlist,i have assigned the dropdown list control in the targetcontrolid of the Calender extender and set the dateformat and popup control id ,is ther any other thing i should do get this right,

Prakash,

Telesoft India ,Bangalore.

that is because the calendar extendar is designed to work with a textbox. If you really want the result in a drop down list you could try putting a textbox on your field and making it hidden. Then attach the calendar extender to that hidden textbox and when the user clicks a date, assign the drop down list to the value of the textbox

Extender control ... cannot extend controls of type ...

Hi all,

I have a custom ImageButton that inherits from the standard ImageButton.

When I try to extend this button with ConfirmButtonExtender, I receive the following error:

Extender control 'cbeDelete' cannot extend 'ibDelete'.
Extender controls of type 'AjaxControlToolkit.ConfirmButtonExtender' cannot extend controls of type 'MyControls.ImageButton'.

Thx in advance

Any suggestions?

Even I am having same problem.

Extended class and debug="false"

Does anybody know why the initalizeBase() function fails to extend the current class with the base-class's methods when debug is set to false?

It seems that when in debug mode you are allowed to do this use the parent class' initializeBase function in the constructor. This causes an error with debug=false.

By using the subclass's own initalizeBase, this all works like a charm.

Extend the AutoComplete Class

Is there a way for me to pass an additional parameter to the webservice that returns an array of strings for use in an autocomplete textbox?

Basically, I'd like to add an ID field that queries a database for strings that match the ID and the prefixText.

It should look something like this:

[WebMethod]publicstring[] GetAllNames(string prefixText,int count,int resourceId)

{

ArrayList filteredList =newArrayList();SqlParameter[] p = {newSqlParameter("@dotnet.itags.org.intResourceId", resourceId),newSqlParameter("@dotnet.itags.org.strName", prefixText)

};

SqlDataReader dr =SqlHelper.ExecuteReader(Common.GetDBConnectionString(),

System.Data.

CommandType.StoredProcedure,"prSelectOrganizationPersonnel", p);while (dr.Read())

{

filteredList.Add(dr[1].ToString());

}

return (string[]) filteredList.ToArray(typeof(string));

}

Thanks!

Hi,

sorry, no way to pass additional parameters using the auto-complete stuff at the moment. I can't count the number of times this requirement has been asked, thus I hope the team will provide an improved auto-complete mechanism in the next release.

Extend AutoCompleteExtender behavior

I have written the webservcie to parse the prefixText on semicolom ";" (if present) and return completion list based on the character after the semicolon. That works great, however on the client when a value from the completion list is selected, it overwrites the text box contents.

So for first case I type a charcter 'a' and select ASP from the list, then I add ASP;c to the text box and get a completion list with values {"C#","Code"}. On selecting C# it overwrites the contents in the text box, I want it to be ASP;C#

I want to extend this behavior to append the selection from completion list to the contents of the text box in order to implement gmail type functionality.

Has anyoneout there tried to implement the sutocomplete extender this way.

Thanks in advance.

This is an interesting idea that I had not thought about. It should be possible already using my custom auto complete extender (see signature). I raise an event when an item is selected letting you pass back the string that you want in the textbox. I do this because I use objects instead of just strings returned from my website, so I need to be able to pick the text I want to place in the textbox. So, you could handle this event and append the values and pass the entire value back.


Thank you for a prompt reply.

Its possible to send back the whole string to the completion list. So for first search "a" will yield ASP. Adding ASP;c to the text box will have to get {"ASP;C#","ASP;Code"}

This approach might not help if the text is long (like email address) and won't look as if it is enhancing the user experience either. Is there any other way to achieve this.

Thanks Again


Any other ideas how to achieve this.

Is there a way to add this to the enhancement list with the Atlas team?

Any help is appreciated.

Thanks Again.

extend atlas

H i Alll

atlas is a good framework but there are still limit

i want to extend it with some feature .

are there any solution ?

Yes, of course. You can use the control extenders as explainedin this page. The Atlas Control Toolkit helps you write your own controls or extenders.

HTH
thanks for your reply

Monday, March 26, 2012

Extend an extender?

I am in need of a custom control that utilizes the ModalPopupExtender. Specifically I'm wanting to create some custom properties/methods for several different classes and have the functionality of the ModalPopup. I tried to Inherit the ModalPopupExtender control in my classes, but I'm having no luck creating an extender of an extender. Also, my code is in VB.NET but the CLR should allow me to inherit across languanges (I'd imagine). Anyone have any tips on creating a control or an extension of a control that also incorporates the ModalPopupExtender functionality? I thought of maybe creating a composite control but since I have never created server controls, it will take me a long while to figure out if it was a good idea or not. This may be a silly question, but I have spent many moons trying to figure out what I'm doing wrong.

Thanks everyone in advance! I use this site on a constant, daily basis and I respect everyone's time, knowledge and volunteerism to help out those in need!Big SmileYesBig Smile

Bump?Angel