Showing posts with label developing. Show all posts
Showing posts with label developing. Show all posts

Wednesday, March 28, 2012

Disable an AnimationExtender

Hello,

I am developing a C# asp.net application and using the AJAX control toolkit.
I am using the AnimationExtender in order to add a fade effect to my page.
The AnimationExtender is a part of a gridView, since I wanted every row in the gridView to fade seperately.

Here is the gridView's code:
<asp:GridView ID="gvDocuments" runat="server" BorderWidth="0" ShowHeader="false" AutoGenerateColumns="False" Width="90%">
<Columns>
<asp:TemplateField HeaderText="Ticker">
<ItemTemplate>
<asp:Panel ID="pnlDoc" runat="server"><%# DataBinder.Eval(Container, "DataItem.docStart") % ></asp:Panel>
<asp:Panel ID="pnlQuote" runat="server"><%# DataBinder.Eval(Container, "DataItem.quote") %></asp:Panel>
<AjaxToolkit:AnimationExtender ID="AnimationExtender1" runat="server" TargetControlID="pnlQuote">
<Animations>
<OnLoad>
<Sequence>
<FadeIn Fps="20" Duration="0.5" MinimumOpacity=".1" MaximumOpacity="1"/>
</Sequence>
</OnLoad>
</Animations>
</AjaxToolkit:AnimationExtender>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView
The Grid is placed within an updatePanel with a timer.
What I would like to do is disable the AnimationExtender on some cases.

I tried using RowDataBound event:
((AjaxControlToolkit.AnimationExtender)e.Row.FindControl("AnimationExtender1")).Enabled = false;

And got an exception.

Is there a way to do that?

Thank you

Hello,

I do not see the handler defined for RowDataBound on your grid view. Could you provide us with your gridview with this defined and the code behind for RowDataBound and the exception?

Also, did you try to override page render and get teh control inside the grid's row?

Regards,

Louis


Sorry, my mistake.

I forgot to add:

if (e.Row.RowType ==DataControlRowType.DataRow)

So, it failed when going over the header first.

Thank you for trying to help...

Development with Atlas. Should we work with beta, or incorporate later

We're going to be developing all our new applications with Atlas, but my bosses are concerned because it's in beta, and not fully released.

Which would be the best option for developing. My bosses would like us to develope our applications as if there were no atlas, but when it's release we could implement it.

I'm against this because we will have to chuck out so much code to use atlas fully. (I don't want to just stick updatepanels everywhere).

Any thoughts / arguments that can be used to help persuade? How much will atlas change before it is released?

Thanks.

Atlas is still under development, so it is likely some thing will change from refresh to refresh. Ajax is also still somewhat on the bleeding edge right now. :-)

I think the core concetps of updatepanel are fairly baked right now, though, so while there will probably be additions in functionality I don't think the model of existing features will change.

Hope this helps,

Scott


The reason I ask, is about time. I could spend 2 weeks designing an application before we start coding. Each page will be build using "standard" features of ASP.NET 2.0. However, with Atlas, I'd change how I design these pages entirely. I'd be using a more client-centric approach, to improve efficiency and overall speed.

Developing forums using Atlas

Hello,
I was interested in adding a 'dynamic' forum to my site (something somewhat similar to these forums) - I am currently developing in .NET as well as using some components of Atlas

Was curious as to whehter there is a project anyone is working on, or if there is free code available to tinker with

(I searched around but have not found anything worthwile)

Thanks in advance
--
I have not done ity et, but I think a forum is a great place to add that kind of functionality. If you're already working on the site, then I'd probably think about starting with wrapping some of your existing controls with updatepanels and / or the collapsible panel that the toolkit has.

Monday, March 26, 2012

developing composite control that combines Ajax controls

Hi,

Is it possible to write a composite control that consists of UpdatePanels, and other control from Ajax Control Toolkit?

I would be happy to view some examples on developing this kind of control.

Thanks

Hello,

You can do this. It is possible.

I suggest that you use a scriptmanagerproxy in your control in case the page containing the control has a scriptmanager already. Aslo, you may have an easier time using the update panel in the containing page instead of in the control to get the ajax capabilities.

Good Luck,

Louis


Hi,

Thanks for the reply, do you suggest to put the composit control inside an update panel?

Im planning to build two build two composite controls:

one of them should contain an AutoCompleteExtender and other simple web controls . so I guess there wont be any problem with it.

but the other control will contain a TabContainer (from the Ajax Control Toolkit) I thought to put on each tab panel's content template an update panel (to reduce the amont of rerendered data, and save bandwith)

do you think that in this case its better to locate the whole TabContainer inside one UpdatePanel?

Thanks,

Tal


Yes, I suggest not including the update panel in the usercontrol.


Hi,

Im writting a composite control as I described in my first post (combines AutoCompleteExtender and FilteredTextBoxExtender and a TextBox)

I wrote the following Render function :

1 SearchAutoComplete =new AutoCompleteExtender();2 SearchAutoComplete.ID ="SearchAutoComplete";3 SearchAutoComplete.MinimumPrefixLength = 3;4 SearchAutoComplete.BehaviorID ="AutoCompleteBehavior";5 SearchAutoComplete.EnableCaching =true;6 SearchAutoComplete.CompletionSetCount = 5;7 SearchAutoComplete.UseContextKey =true;8 SearchAutoComplete.ServiceMethod ="GetCompletionList";9 SearchAutoComplete.TargetControlID ="SearchTextBox";10//SearchAutoComplete.OnClientItemSelected = "";1112 SearchFilteredTextBox =new FilteredTextBoxExtender();13 SearchFilteredTextBox.ID ="SearchFilteredTextBox";14 SearchFilteredTextBox.TargetControlID ="SearchTextBox";15 SearchFilteredTextBox.BehaviorID ="FilteredTextBoxBehavior";16 SearchFilteredTextBox.FilterType = AjaxControlToolkit.FilterTypes.Custom | FilterTypes.Numbers;1718 SearchByNameLabel =new Label();19 SearchByNameLabel.ID ="SearchByNameLabel";20 SearchByNameLabel.Text = Resources.Resource.SearchByName;2122 SearchByNumberLabel =new Label();23 SearchByNumberLabel.ID ="SearchByNumberLabel";24 SearchByNumberLabel.Text = Resources.Resource.SearchByNumber;2526 SearchTextBox =new TextBox();27 SearchTextBox.ID ="SearchTextBox";2829this.Controls.Add(SearchAutoComplete);30this.Controls.Add(SearchFilteredTextBox);31this.Controls.Add(SearchByNameLabel);32this.Controls.Add(SearchByNumberLabel);33this.Controls.Add(SearchTextBox);
1 AddAttributesToRender(writer);23 writer.AddAttribute(4 HtmlTextWriterAttribute.Cellpadding,5"1",false);6 writer.RenderBeginTag(HtmlTextWriterTag.Table);7 writer.RenderBeginTag(HtmlTextWriterTag.Tr);8 writer.RenderBeginTag(HtmlTextWriterTag.Td);9 SearchByNameLabel.RenderControl(writer);10 writer.RenderEndTag();11 writer.RenderBeginTag(HtmlTextWriterTag.Td);12 SearchByNumberLabel.RenderControl(writer);13 writer.RenderEndTag();14 writer.RenderBeginTag(HtmlTextWriterTag.Td);15 SearchAutoComplete.RenderControl(writer);16 writer.RenderEndTag();17 writer.RenderBeginTag(HtmlTextWriterTag.Td);18 SearchFilteredTextBox.RenderControl(writer);19 writer.RenderEndTag();20 writer.RenderEndTag();21 writer.RenderEndTag();22

and got the following Exception:

"Error: Sys.ArgumentException: value must not be null for controls and behaviors.

parameter name:element"

Any idea?

Thanks


hi,

change

SearchAutoComplete.TargetControlID ="SearchTextBox"

to be

SearchAutoComplete.TargetControlID = SearchTextBox.ClientID

the script is hassling you about being unable to find the targetControl


Hi,

Thanks for your reply.

I want my WebMethod to be integrated with the CompositeControl (Im not intersted in Exposing it as a top level property).

How can I embed a web-service with the control (I prefer using PageMethod fo GetCompletionList). ?

I read somewhere that I should write a custom HttpHandler ( if i want my CompositeControl to use my embedded webservice) , It seems complicated , do you have en example for this?

or better , a solution for how I can use an "embedded" PageMethod?

Thanks,

Tal


Hi Tal,

It's not recommended to embed the pageMethod inside a UserControl.

By default, a client can't request for a user control( with extension .ascx) directly, it's blocked by the a special handler that prevents accessing. It's not recommend to change this behavior.

May be you are trying to implement a user control that is easy to maintain and use, but if the user has to pay more to get accustom to this.


Hi,

Im Writting a CompositeControl not a UserControl.

so actually Im trying to "embed" the PageMethod or Web-service method (GetCompletionList method) inside the DLL of my CompositeControl.

Is there a way to solve this?

(im not interesting in exposing the AutoCompleteExtender's ServiceMethod property)

I want that the logic of geting the completion results will be a part of my CompositeControl.

Thanks


It's also not allowed to access a assembly on client side directly.

There should always an endpoint( a class implement IHttpHandler interface ) on the server be responsible for processing a request. You may implement a class and use it to invoke the method in the dll.


Hi,

Do you have any refferences for how to implement such a class?

I have know idea how to write an HttpHandler that invokes a web-service that is embedded in a DLL...

Thanks


Hi,

Just create a class that implementIHttpHandlerinterface. And you may refer to the ScriptResourceHandler class in thesource code of ajax extension for a practical implementation of it.


Hi,

Thanks for the reply. I will have a look at the source code of ajax extension.

Do you think I should also implement an HttpHandlerFactory?

As I understand my custom HttpHandlerFactory will check all *.asmx requests,

if the asmx request is for my AutoComplete web service return my custom HttpHandler, otherwise return the default one.

is this correct?


Not necessary, you may register the Handler to a specific file name in web.config.

But if you plan to use .asmx, why don't you add a web service directly. It's a implicit httpHandler.


Hi,

what do you mean by "adding the web-service directly"?

Developing Atlas Friendly Controls

I'm working a custom control that requires client-side javascript. Is there a list of best practices for making a control Atlas friendly?

I'm currently using the ClientScriptManager to register the necessary scripts, but something is not working properly.

hello.

though i still haven't developed none, i think that an atlas control is supposed to implement the IScriptControl interface (this interface introduces a method that is called when you need to register the xml-script emitted by the control).

since there still is no info about it, i think that your best option is to use reflector and see how they implemented the atlas server controls.


If you are developing a server-side control that wishes to perform client-side logic or behavior then you can certainly approach it from a number of angles:

Simply generate your own JavaScript and register with the clientscript on the Page. then tie up your client-side events to functions therein