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

Wednesday, March 28, 2012

Multiple Popups using popcontrol extender

In the previous version of the ajax control toolkit I could reference multiply popups with one control. Ie on the page I have one calendar and 10 different textboxs which call popup the same calendar control. This would then run the selection changed code for the calendar and commit the date to which ever control had opened the popup. ie

ProtectedSub Date_Selector_SelectionChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles Date_Selector.SelectionChanged

Date_Popup.Commit(Date_Selector.SelectedDate.ToShortDateString)

EndSub

However with the new version of the toolkit you have to have a different popup for each textbox. So when it goes into the date selector section how do I chosse the right popup to send the data back to.

I think the test case in ToolkitTests\Manual\Repeater.aspx shows how to do this the new way.

I had asimilar problemTed Glaza helped me solve. I have two textboxes with a popupcontrolextender attached to each, both of which call a single calendar, cal1. Some code snippits:

Code behind:

Protected Sub Cal1_SelectionChanged(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Cal1.SelectionChangedDim tmppceAs AjaxControlToolkit.PopupControlExtender tmppce = AjaxControlToolkit.PopupControlExtender.GetProxyForCurrentPopup(Page) tmppce.Commit(Cal1.SelectedDate)End Sub

Declaration on the top of the .aspx page:

<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act" %>
 
Everything works as expected. One thing to note, I'm running a self-compiled version of the toolkit - 9854. 

Multiple Targets for Extenders?????

hi

is there any possibility for using a single extender for multiple targetcontrol ids?

for eg..

if u have 10 textboxes and we wan to addfilteredtextboxextender to all the textboxes,can use singlefilteredtextboxextender for all 10 textboxes?

Thanks in advance

Hi,

no, in beta1 an extender must target one server control.


whether it ll affect the performance when using large number of extenders in a single page

Multiple Update Panel Animation Extenders on one page

Hi there!

I'm developing a web user control that contains an Update Panel and uses an Update Panel Animation Extender.
The animation is quite simple: while the panel is updating, it fades out the contents of the update panel and fades in the "please wait while processing..." message...then the animation reverses the process when the panel is Updated. The animation works quite nicely.

The problem I'm facing is when I have more than one of these web user controls on the page at a time (I'm using 8 of these on one page at a time).
If one web user control's update panel does an asynchronous postback, all of the animations are run!

Does anyone know how to get around this problem?

Thanks in advance,

-Frinny

Hi,

Would you please provide with any code of ypur usercontrol?

Or create a simple repro of this problem?

Thanks,


I forgot that I had posted this question.
I found the solution to my problem a while ago.

The problem I was describing is not actually a problem, it is how the UpdatePanelAnimationExtender works.

Anyways, to get around this problem I ended up using regular Animations instead of the UpdatePanelAnimationExtender.

Cheers!

Monday, March 26, 2012

Multiview, updatepanel, animation extender....bad combo?

I got a multiview inside of an updatepanel. The multiview has a view which has an updatepanel. There's an animation extender on the inner updatepanel. The extender has an animation of fadeout on onloading and fadein on onloaded.

When I run it, when the inner updatepanel is to update, I see it fadeout ever so slightly in IE and not at all in firefox. The updated data doesn't fade in, it just shows up. I set the duration of the fadeout/in to high values to test. didn't help. The change just shows without animation.

Is there a way to do this?

Did some more fiddling. It seems putting an updatepanel inside an update panel removes the animation.

Just had to remove the children as triggers and always update and it works.

MutuallyExlcusiveCheckBox problems after postback

Hello all.

I have added a MutuallyExlcusiveCheckBox extender to my user controll to make sure just one checkbox is checed at the time. My user controll is then added to a web form, and it works great until I do a post back. When I do a postback I can check more than one checkbox. Is this a bug or something I do wrong. I set the key runtime, would this have something to say?

Endre

A small update:

I have just figured out that none of my ajax stuff works!

So now i think the problem might be related to the use of UpdatePanels on my page. Anyone know something about this?

Endre


Hello again.

This post is just a wast for your time, sorry. My app is a bit f**ked up... I have found some sort of solution by moving the Exlusive controls out of my update panel, the way it should be. I tried to recreate the problem, but couldn't, so I guess the reason was lots of messy code and many developers doing the same thing in different ways.

Endre

MutuallyExclusiveCheckBoxExtender with ValidatorCallout Extender?

is there a way to useAjax Mutually Exclusive CheckBox Extender withAjax ValidatorCallout Extender ?

combining togather and let say if i did not check the checkbox then i should get validator callout extender - possible ?

thanks.

Hi Nisarkhan,

As far as I know, there's no direct way unless we modify ValidatorCalloutExtender's source code. ValidatorCallout is designed to use with Validators. In your situation, I think you should better use Javascript + Div and draw the propmt div by yourself. Thanks.

Best regards,

Jonathan.

my Calendar extender is so slow

I have a textbox, linked to calendar extender, and validationcallout attached to it. But the calendar extender displays so slowly, it takes for ever to see the calendar.

Any solution please.

One more question pls, does the calendar extender pop up after a round trip to the server, or is it purely on the client?

Help, Help Help :) :). Thnks a lot.

tutus:

One more question pls, does the calendar extender pop up after a round trip to the server, or is it purely on the client?

The calendar extender is all done on client side using javascript.

I also get slow performance on the calendar extender when I have a few on the page and if I try to open and close them repeatedly while selecting dates.


is there any other alternative pls? or is the calendar server control faster?

Thanks.


tutus:

or is the calendar server control faster?

The calendar asp.net control will cause a full page postback.

I can see that the calendar extender is a tad slow but not to the extent where it is frustrating users or where it is such a delay that I would rather do a full page post back

My Calendar Extender does not display in my Formview

I have two calendar extenders corresponding to a texbox each. They are all inside a Formview. When the textboxes are clicked nothing displays.

I have tried the calendar extender outside the Formview and everything seems to work fine.

I have tried the script manager in and outside the formview to no avail. Is the script manager supposed to be inside the Formview as well ? Any particular place where those controls are supposed to be to function properly??

When I first started to apply the extenders I inserted the script manager control after the extender, I wonder if that may have screwed up things. Althought, I have redone it to no avail. Anyideas ?

I've tried this code and works fine:
 <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:FormView ID="FormView1" runat="server" DefaultMode="Insert"> <InsertItemTemplate> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1"> </ajaxToolkit:CalendarExtender> </InsertItemTemplate> </asp:FormView>

You should post your code here to resolve your problem.

My Custom Control Extender no longer works

I have a control extender that disabled a button when clicked to prevent multiple clicks. It worked well on my test.aspx page but when I moved it over to my big project, I get this error:

"Sys.ArgumentException: Value must not be null for Controls and Behaviors.Parameter name: element"

The page I moved it on contains a MasterPage with a home.aspx, and within that there is a .ascx and in there is where my button + control extender are found. Here is the code.

.cs:

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI;

[assembly: System.Web.UI.WebResource("OneClickExtender.OneClick.js","text/javascript")]

namespace OneClickExtender
{
[TargetControlType(typeof(Button))]
[TargetControlType(typeof(ImageButton))]
public class OneClick : ExtenderControl
{
private string _submitScript = null;
protected override IEnumerable<ScriptDescriptor> GetScriptDescriptors(Control targetControl)
{
ScriptBehaviorDescriptor behavior = new ScriptBehaviorDescriptor("OneClickExtender.OneClickBehavior",targetControl.ID);
behavior.AddProperty("submitScript", _submitScript);

yield return behavior;

}

protected override IEnumerable<ScriptReference> GetScriptReferences()
{
ScriptReference sr = new ScriptReference();
sr.Name = "OneClickExtender.OneClick.js";
sr.Assembly = "OneClickExtender";

yield return sr;
}

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Control target = new Control();
target = FindControl(this.TargetControlID);
if (target != null)
_submitScript = Page.ClientScript.GetPostBackEventReference(target, string.Empty);
}
}
}

.js:


Type.registerNamespace('OneClickExtender');

OneClickExtender.OneClickBehavior = function(element) {
OneClickExtender.OneClickBehavior.initializeBase(this, [element]);
var _clickDelegate = null;
var _onSubmitScript = null;


}

OneClickExtender.OneClickBehavior.prototype = {
initialize : function() {
OneClickExtender.OneClickBehavior.callBaseMethod(this, 'initialize');
var e = this.get_element();
this._clickDelegate = Function.createDelegate(this,this._onClickDelegate);
$addHandler(e,"click",this._clickDelegate);
},

_onClickDelegate : function() {
this.get_element().disabled = true;
eval(this._onSubmitScript);
},

get_submitScript : function() {
return this._onSubmitScript;
},

set_submitScript : function(value) {
this._onSubmitScript = value;
},

dispose: function() {
$clearHandlers(this.get_element ());
OneClickExtender.OneClickBehavior.callBaseMethod(this, "dispose");
}
}

OneClickExtender.OneClickBehavior.registerClass("OneClickExtender.OneClickBehavior", Sys.UI.Behavior);

--

Any ideas?

hello.

instead of using targetcontrol.id i think that you should use targetcontrol.clientid.


This fixed it. However, because I am using asp:RequiredFieldValidator, my button gets disabled and never re-enables itself. I would have to make sure all fields were valid first. I will look into this right now.

My extender control wires its events, then seems to forget what it is!

I've created an extender using the Ajax Extender Control Template. It takes a TextBox as its TargetControl and adds a couple of drop downs to its child controls. Then it responds to the onblur event of the text box. It is supposed to set the values of the drop downs before it posts back. The problem is that when the text box fires its 'blur' event I can't use the 'this' keyword to refer to any of the classes properties or methods. Here is a brief snippett:

Company.Web.MASW.ProductAutoCompleteBehavior.prototype = { initialize : function() { Company.Web.MASW.ProductAutoCompleteBehavior.callBaseMethod(this,'initialize'); $addHandler(this.get_element(),'blur',this._elementChanged ); $addHandler(this._DiameterElement,'click',this._setElementValue ); $addHandler(this._TypeElement,'click',this._setElementValue ); },... _elementChanged : function(e) { alert(this.get_element()); }, _setElementValue : function(e) { alert( this._DiameterElement ); }}
 

The alert commands just verify that I've managed to make the connection to the right input element. It should pop up and say [object] but I get a script error saying object does not support this property or method. I just can't understand how it's calling the right event but can't see it's own properties. Could It be that it's inheriting from the AjaxToolkit.BehaviorBase class?

It seems as though I have a lot to learn about how to connect everything in Ajax. I've done a fair amout of JavaScript and I've done a fair amount of JScript in ASP. I have got a lot to learn about how Ajax connects ECMA, EMCA, E=MC2, or what ever it's called. I just can't fool with it much more for now so consider this 'resolved'. Thanks to all those who read this and said "what in the world is he up to?"

Saturday, March 24, 2012

My PasswordStrength extender doesnt work properly in modal popup

I am using a password Strength extender in a modal pop up but the bar indicating the strength does not show up. I removed it to the main page and it was working properly.

So what would be wrong here ? The only thing that I thought might be wrong was CSS file but it seems like the extender can access it on the main page.

Any help is appreciated.

Thank you.


Have you included CSS in the main page ?

Can u provide some code details here...?


Whether you are using Master page concept ?

Thanks

Yes I am using CSS file.

.BarIndicator { color:Blue; background-color:Blue; padding-bottom:1px; }.BarBorder { border-style:solid; border-width:1px; width:200px; vertical-align:middle; }.modalBackground {background-color:Gray;filter:alpha(opacity=70);opacity:0.7;}.modalPopup {background-color:#ffffdd;border-width:3px;border-style:solid;border-color:Gray;padding:3px;width:480px; height:250px;}

When I use PopupControlExtender instead of Modal, everything work good. I can even see the bar. Is there something wrong with Modal Popup extender that prevent the bar to show itself ?



Please, any body know what is wrong ? is there any ideas ?

Check this one may it will help you

http://www.asp.net/learn/videos/view.aspx?tabid=63&id=97


The reason it does not display is because there is a background colour specified for the modal popup display. If you removw the background colour delcaration from the CSS, you can see the bar indicator. While this is not optimal, its got to do with the way the ModalPopup sets the z-index and the way the PasswordStrength extender also displays its indicator elements.

Might want to raise this as a bug on codeplex.com.


Thanks ..Smile


Has there been a fix for this issue? I have the same problem ...

Adam

Need an idea for clientside-loaded control container

I am working on an Expandable Row Extender that ideally youwould apply on a gridview (or any other databound control that renders a table)to give it an expandable row functionality. However, I want to do as much aspossible in client side (I've seen the approach of adding an item in thedataset, override onitembound to draw it accordingly and then rebind the datato the control to redraw it, and place it all in an update panel but I don'tlike this approach - obvious reasons). Nor do I like the idea of having every"details" row rendered and hidden.

I kind of like how this feels:http://www.codeproject.com/aspnet/MasterDetail.asp and I very much like how asimilar implementation on www.titlez.com.

That being said, I am trying to make the control as genericas possible (and as easy to use as possible), therefore I think the easiest foranybody to use for the details row would be a usercontrol (so that you can useyour own control, which eventually you might reuse as a webpart as well).

Here is where I need the idea: how to dynamically render thecontrol triggered from the client side (to render it in the expanded row).

The trivial solution would be to use an iframe and load aweb form that would load the control, but there is something that doesn't feelright about this approach.

Any ideas?

I think you can embed user controls to a GridView and implement a inline GridView similar to the demo in www.titlez.com.Besides,maybe a third party user control can be used in a GridView,specially about Chart/Graph controls.
Try to take a look at Ajax website - http://Ajax.asp.net.There are a lot of useful Ajax controltoolkit which can help you to implement it and get a nice web page.

Hi Jasson and thank you for your reply.

I know you can embed user controls in a gridview but what I am trying toachieve is a control that does as much as possible on client side (so when youwould expand a row I wouldn't want to hit the server to add a control in thegrid and rebind the grid, even if this would be in an updatepanel especially asyou might have some time-consuming info in the details row and if you wouldhave several open at the same time this architecture would severely affectperformance. Nor do I want to pre-render everything in one go and initiallyhide the rows for the same reason). Also I am not interested at this time aboutthe graphs and other nice things in those rows, I am just down to the very ideaof the extender control. I am well aware of the ajax controls toolkit and what I am doing isan extender using the same framework, actually extending the extenderbase inthe toolkit.

What I have done so far uses IFrames to render the details row and lets youdefine a usercontrol that will be rendered in the expanded row. It goes througha complicated process of autogenerating a form to host the control at runtime.I was looking for ideas of how to do this without IFrames, using somethingsimilar to an updatepanel that would be able to add the user control atruntime.

Hope this makes sense ..


If you would like to achieve a control as much as possible on the client side,javascript is the unique selection.Ajax control toolkit gives us a good direction to this,however,it can not implement what we need now.I believe it can be done in the near future.I agree with you that if we load too many user controls at runtime in the server side and embed them in a complicated control such as Grivew,DetailsView or FormView,it will affect the server performance. Do you mind MagicAjax which also provides a Ajax framework for us to do further development?MagicAjax is open source and we can extend it to meet our requrements.I don't know if you are inerested in it.

Try to take a look at this reading about MagicAjax for your reference -http://www.c-sharpcorner.com/UploadFile/mosessaur/magicajax02112006060506AM/magicajax.aspx?ArticleID=ddd4757e-7ab7-49da-a3f2-d88b340230c3

Wish this can give you some ideas.


Thanks for sharing the idea. I am afraid I am familiar with MagicAjax as well but I don't see it solving this particular issue. MagicAjax is actiong more like the UpdatePanel control in Ms. Ajax. That wouldn't work without rebinding the grid on the server which wouldn't be any faster. Further more, MagicAjax stores everything on the session so it might bring even more concerns.

Wednesday, March 21, 2012

need help to start, Scriptmanager

Hello,

First time I try to include an atlas control.

I get an error "Extender controls require a ScriptManager to be present on the page."

Attempting to create cascading drop down lists, so here is the aspx code: (took cars sample and edited)

<atlasToolkit:CascadingDropDownID="CascadingDropDown1"

runat="server">

<atlasToolkit:CascadingDropDownProperties

TargetControlID="projectDDL"

Category="Project"

PromptText="Select a manufacturer"

ServiceMethod="populateProjectDDL"/>

<atlasToolkit:CascadingDropDownProperties

TargetControlID="wellDDL"

ParentControlID="projectDDL"

PromptText="Select a well"

ServiceMethod="populateWellDDL"

Category="Well"/>

<atlasToolkit:CascadingDropDownProperties

TargetControlID="sectionDDL"

ParentControlID="wellDDL"

PromptText="Select a section"

ServiceMethod="populateSectionDDL"

Category="Section"/>

</atlasToolkit:CascadingDropDown>

<asp:DropDownListID="projectDDL"runat="server"CssClass="label"Style="z-index: 105;

left: 281px; position: absolute; top: 92px"AutoPostBack="True"TabIndex="1">

</asp:DropDownList>

<asp:DropDownListID="wellDDL"runat="server"CssClass="label"Style="z-index: 106;

left: 281px; position: absolute; top: 154px"AutoPostBack="True"TabIndex="2">

</asp:DropDownList>

<asp:DropDownListID="sectionDDL"runat="server"CssClass="label"Style="z-index: 107;

left: 281px; position: absolute; top: 214px"TabIndex="3">

</asp:DropDownList>

In the code behind I have three populate subs that fetch data from sql db:

PrivateSub populateProjectDDL()

PrivateSub populateWellDDL()

PrivateSub populateSectionDDL()

Also had some*_SelectedIndexChanged subs, that used to do the job atlas is now going to do I suppose.

Back to the problem: scriptmanager?! What is that - where do I put it? Please help me get my first alas control going... Would be very nice..

A ScriptManager tag looks like:

<atlas:ScriptManager ID="ScriptManager1" runat="server" />

You may want toread more on Atlas itself to understand what one is and what it can do.


Yeah, sry, kinda rushed that question in,

didn't think this post would even be approved, delete, close, whatever... hehe

Thx for reply, sry about this post.

need help with a modal extender control

I am working on a project that has two modal extenders on one page, and two panels. Which have their own separate buttons which can trigger each panel to open. On the same form there is a gridview control, the user will select a row then in the code behind i trigger the click event for one of the button, so that it will oepn one of the panel it seemed to work fine before just using modalextender...1.show() when it stop working i added the code to raisethe click event for the control. After doing so it doesn;t open the panel instead, i have to click the button that that is setup as theTargetControlID two or three time just for the pop up menu to open. What is the right way to go about doing this. I wander if anyone else has had the same problem.

((IPostBackEventHandler)lnkPanel2).RaisePostBackEvent(null);

this.ModalPopupExtender2.Show();

Hi Lew26,

My suggestion is use Javascript to show the ModalPopupExtender directly. For example:

use $find("ModalPopupExtender's BehaviorID ").show(); to show the Panel and use $find("ModalPopupExtender's BehaviorID ").hide(); to hide the showing Panel. The Buttons which will lead the ModalPopupExtender to shown or to hidden should be put inside a hidden div. Take an example: <div style="display:none">your Buttons</div>. Here is my sample:

<%@. Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
protected void Page_Load(object sender, EventArgs e)
{
//Attach a Javascript funtion to the LinkButton.
LinkButton myLinkButton;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
myLinkButton = (LinkButton)GridView1.Rows[i].Cells[4].FindControl("LinkButton1");
myLinkButton.Attributes.Add("onclick", "shopModalPopup('" + GridView1.Rows[i].Cells[0].Text + "');return false;");
}
}
</script
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style>
.modalBackground {
background-color:Gray;
filter:alpha(opacity=70);
opacity:0.7;
}

.modalPopup {
background-color:#FFD9D5;
border-width:3px;
border-style:solid;
border-color:Gray;
padding:3px;
width:250px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="EmployeeID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" InsertVisible="False"
ReadOnly="True" SortExpression="EmployeeID" ItemStyle-Width="0" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server">Click On Me</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString%>"
SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [Title] FROM [Employees]">
</asp:SqlDataSource>
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Height="200px" Width="300px" style="display:none">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
EmployeeID:<asp:TextBox ID="tbEmployeeID" runat="server"></asp:TextBox> <br/>
Reason:<asp:TextBox ID="tbReason" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</asp:Panel>
<div style="display: none">
<asp:Button ID="Button1" runat="server" Text="Button" /></div>
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button1"
PopupControlID="Panel1" CancelControlID="btnCancel" BackgroundCssClass="modalBackground">
</ajaxToolkit:ModalPopupExtender>
<script type="text/javascript" language="javascript">
function shopModalPopup(employeeID){
//show the ModalPopupExtender
$get("<%=tbEmployeeID.ClientID%>").value = employeeID;
$get("<%=tbReason.ClientID%>").value ="";
$find("<%=ModalPopupExtender1.ClientID%>").show();
}
</script>
</form>
</body>
</html>

I hope this help.

Best regards,

Jonathan

Need help with CalendarExtender Control

Hi,

I'm a beginner to ASP.NET AJAX and ASP.NET itself. I have a calendar extender for a textbox and it works fine until I click the 'Submit' button in my form. Apparently in the UI the date will show but when I do an insert to my database by using the Convert.ToDateTime function first, I get thrown an exception where it says:

'The string was not recognized as a valid DateTime. Tehre is a unknown word starting at index 0'

I would like to get some help to troubleshoot this problem.

Thanks in advance,
Nick

HI, probably your date format is not correct, the calendar extender format should be the same that the database format check that both formats be mm/dd/yy or mm/dd/yyyy or mm/dd/yyyy hh:mm:ss.


Hi, apparently something was wrong with the AJAX calendar extender. I didn't realise it until I deleted it and created a new one.

Thanks for the help anyway!Smile

Cheers,
Nick