Showing posts with label functionality. Show all posts
Showing posts with label functionality. 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.

Extending the Accoridon Control to support paging

Has anyone every attempted to add paging to the databinding in the accoridon control. It would be very useful to get some of the functionality of the gridview control (sorting and paging). I haven't built an extender control yet, so I fear I am in over my head. Paging workaround suggestions would be appreciated as well.

Thank you,

Tom Bull

Hello Tom,

maybe you've already found a solution for your problem.

I was faced with the same problem some days ago. I've found a solution that works for me.

I described itin my blog. I hope that solution works for you too, if a solution for that is still needed.

Regards

Rolf

Monday, March 26, 2012

Export to Microsoft Excel

Hello,
IE Functionality of Exporting tables to Microsoft Excel doesn't work properly when used with Asp.NET AJAX,

it always exports the first loaded data ignoring any updates done through AJAX Asynchronous post back

i.e. if a page is loaded with data X and then updated using AJAX update panel and
returned data Y then using Export to Microsoft Excel on this page will export
the first data X and not data Y


how can this be fixed?

Appreciate your help in advance.

maybe you can put some code here so that we can know what actually happen.

currently it work fine to me


Hello,

This is a sample of the code unfortunately i wanted to upload the solution but was not able to add files.

I have a master page, default.aspx and dataclass.cs

Appreciate your help in advance.

"C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
"Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> "ScriptManager1" runat="server">
"DropDownList1" runat="server" AutoPostBack="True"> A B

"UpdatePanel1" runat="server"> "GridView1" runat="server" DataSourceID="ObjectDataSource1"> "ObjectDataSource1" runat="server" TypeName="DataClass" SelectMethod="FillData"> "DropDownList1" Name="text" PropertyName="SelectedValue" Type="String">

using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partialclass _Default : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e){if(!IsPostBack)DropDownList1.SelectedIndex = 1;}}public class DataClass{public DataClass(){//// TODO: Add constructor logic here//}public static DataTable FillData(string text){DataTable dt =new DataTable();dt.Columns.Add("Column");for (int i = 0; i < 100; i++){dt.Rows.Add(new object[] { text });}return dt;}}

Saturday, March 24, 2012

Example of an Atlas Site

Well, I have been using some of the Atlas functionality now for quite a while and have used it to rewrite a site I run for charity.

I must admit, I have been pretty amazed with what you can do with it and the speed which you can develop something new. Thought I would post up my site so people could get ideas and give me suggestions on how it can be improved. Still putting the finishing touches on it.

http://www.scigoalplanning.com/ExerciseSearch.aspx

I am thinking about using the new animation functionality to provide a training demo to teach people how to use the website, as it can be a bit daunting for first time users.

This site is a resource of exercises for people who have suffered a spinal cord injury or like neurological condition. You can perform a search, get a gallery of exercises, choose exercises by clicking on the image and then make up an exercise booklet. You can create your own logons and then customise these booklets for clients and export them to word/PDF etc. It is meant to be used by physiotherapists.

Technical Background :

ASP NET 2, C# - Uses Atlas and Webservices extensively, Atlas Client Library - popups etc, SQL Server database

Super cool Atlas website