Showing posts with label ajax. Show all posts
Showing posts with label ajax. Show all posts

Wednesday, March 28, 2012

Disable Autocomplete extender in code

Is there any way to disable an autocompleteextender?

I have an autocompleteextender that works fine with a textbox but I need to hide that textbox. When I hide it, a javascript exception is thrown because the atlas code can't find the control. What should I do to disable the autocompleteextender in code?

Thanks

I was using this code:

foreach

(AutoCompleteProperties propin AutoCompleteExtender1.TargetProperties) {

prop.Enabled =

false;

}

But it didn't work. However with this it works:

AutoCompleteExtender1.TargetProperties.Clear();

Probably there's a bug somewhere because I think what I was doing should be enough.


hello.

how are you hiding the textbox? i'm guessing that you're setting the visible property to false...unfortunatelly, it looks like the xml script willnot be rendered itht ie enabled property is set to false. you can try to set both the visible and enabled properties of the associated textbox controls to false and this should stop the generation of the xml-script...


It is inside a table row so I set the table row to runat=server and set visible = false to the table row.

I have just tried setting the textbox enable and visible properties to false but it still doesn't work. I think that the correct behaviour should be not to render the xml-script related to the autocomplete textbox when the associated TargetProperty is not enabled.


hello again.

hum...after looking at what's going on, i think that the problem is that the behavior is being registered even when the control is not visible. you can change this by building your own completeextender with code similar to this one:

namespace

LA

{

publicclassBetterAutoCompleteExtender :AutoCompleteExtender

{

protectedoverridevoid OnPreRender(EventArgs e)

{

WebControl ctl =this.NamingContainer.FindControl(this.TargetProperties[0].TargetControlID)asWebControl;if ( ctl !=null && ctl.Visible &&this.TargetProperties[0].Enabled )

{

base.OnPreRender(e);

}

}

}

}

hope this helps (btw, you should open a bug report by adding a new post to the forum and redirect them to this post to get more info about the problem - don't forget to add the [BUG] word on the title).


Thanks Luis.

With that it works properly.

I'll add a new post with the bug.


Hello,

I'm attempting to put the autocomplete extender in a tabbed form. Is there a way to disable the autocomplete when the style of the div layer that the textbox is in gets set to style="display:none"?

Thanks,
Emilie

hello.

hum...in your scenario, you shouldn't need to disable it because if you're setting the display style, that means that all the elements will be loaded and you won't get errors when searching for them...


Here's the simple sample I'm working with:

<body>
<form id="Form1" runat="server">
<atlas:ScriptManager id="AtlasPage1" runat="server" />

<div style="display:none">
<asp:TextBox ID="TextBox1" runat="server"/>
</div>

<Atlas:AutoCompleteExtender runat="server" ID="autoComplete2">
<Atlas:AutoCompleteProperties TargetControlID="TextBox1"
Enabled="True" ServicePath="AutoCompleteService.asmx"
ServiceMethod="GetWordList"
minimumprefixlength="1" />
</Atlas:AutoCompleteExtender>
</form>
</body
Right now it gives me an "invalid argument" exception and cannot find the source code to break to.
However, if I remove style="display:none" from the div, it works fine.
I ran it again this morning and this time it was able to break to the line of code that was failing. In the Webresource.axd file there's a line

completionListStyle.width = (elementBounds.width - 2) + 'px';

But when the div is set to display:none, elementBound.width (referring to the width of the textbox) is 0.

Anyone have ideas on how to get around this?
I'm having the same problem here: when display: none is set, the autocompleteextender throws up an error.

Is there a workaround for this yet?

any news on this one, I have the same problem?

Andy

Disable Atlas things at runtime

I've got a form i am trying to create that if:

An administrator is logged in, a textbox with an AutoCompleteExtender (and TextWaterMark control as well) is available for the Admin to search for companies to look at data for

If it's a company logged in, i want to hide/disable this textbox and instead give them a dropdownlist of their assigned company (or companies) and not allow them to search for companies outside of them

the problem i am running into is that when i set the textbox to "visble = false", that causes Atlas to throw an error "Assertion Failed, could not find HTML element blah blah blah"...

I thought i'd be sneaky and instead of saying:
txtCompany.Visible = False

I instead said in the code
txtCompany.Style.Add("display", "none")

but that still errored, althought this time just a "runtime error has occured"

How can i simply say in code:

"If i am not an administrator, turn off the textbox, autocomplete, and watermark"

I'd probably put the entire textbox (atlas update panel included) inside a usercontrol, and show and hide the usercontrol accordinly.
Excellent suggestion and appears to be doing exactly what i want it to do......

Disable Atlas for a Specific Browser

My website was having a specific problem with Safari that required me to disable partial rendering on that browser.

I am currently using an HTTP module to detect that browser and turn off partial rendering, but I feel like this is something that I should be able to do in a *.browser file.

Is there a way using a .browser file to disable atlas for a specific browser?

hello.

well, if i recall correctly, browser files defined the known characteristics of a browser and yuo'll not be able to do that with a file of that type.


Can you please post the code that you're using for the detection. That would save some time ...

Thx
dB.


Ok, it's pretty simple. Again, I am using this in an HTTP module so it always runs:

If HttpContext.Current.Request.UserAgent.Contains("Safari")Then
Dim smAs ScriptManager =CType(CType(sender, Page).Master.FindControl("ScriptManager1"), ScriptManager)
sm.EnablePartialRendering =False
EndIf

I was just thinking that if I could somehow add something to the browsers file that said Safari wasn't capable of using Atlas (by disabling XMLHttpRequest or otherwise), it would be more efficient than what I am doing now.

If you are curious why I am doing this, it is because I am experiencing a bug with LinkButtons, with Atlas, in Safari. I posted a question about that first, butno one had any answer.

disable an updatepanel during asynch callback?

I have an UpdatePanel on a page, and within the UpdatePanel are a GridView and a Button that updates the GridView when clicked. I click the Button, a couple of seconds later the asynch callback returns and the GridView is re-rendered on the screen. Great. Now, what I would like to do is hook into the beginRequest and endRequest events of the client-side PageRequestManager and add a couple of functions that will replace the inner html of whatever UpdatePanel is making the callback request with a "Please Wait..." message while the callback is processing so that the user cannot change anything within the UpdatePanel until the callback is finished. What I can't figure out how to do is get a client-side reference to the UpdatePanel that initiated the current ajax callback. The UpdateProgress control is very close to what I'm trying to achieve, except that it doesn't "hide" its associated UpdatePanel.

Anybody have any ideas?

My recommendation would be to use the UpdateProgress control, and style it such that it covers the UpdatePanel. That would be easiest.

If you want to go ahead and hook beginRequest/endRequest, to answer your question about determining which UpdatePanel contains the control causing the postback, take a look at the JavaScript behind the UpdateProgress control, specifically this function:

 function Sys$UI$_UpdateProgress$_handleBeginRequest(sender, arg) { var curElem = arg.get_postBackElement(); var showProgress = !this._associatedUpdatePanelId; while (!showProgress && curElem) { if (curElem.id && this._associatedUpdatePanelId === curElem.id) { showProgress = true; } curElem = curElem.parentNode; } if (showProgress) { this._timerCookie = window.setTimeout(this._startDelegate, this._displayAfter); } }

Hai,

can u plz tell me any other sample.Me too facing same prblm...


Does this help?

http://weblogs.asp.net/rajbk/archive/2007/01/08/using-the-updateprogress-control-as-a-modal-overlay.aspx


Thanks for the suggestion Steve. In case anybody else is interested in doing something similar, here's the code for a simple extension of the UpdatePanel class that implements Steve's approach to the problem I originally described:

using System;using System.Collections.Generic;using System.Text;using System.Web;using System.Web.UI;namespace CustomAjaxControls{public class MyUpdatePanel : UpdatePanel{public MyUpdatePanel():base(){this.Load +=new EventHandler(MyUpdatePanel_Load);}private void MyUpdatePanel_Load(object sender, EventArgs e){RegisterClientScripts();}private void RegisterClientScripts(){StringBuilder library =new StringBuilder("");// start-up script (registered once for each instance of MyUpdatePanel on the page)this.Page.ClientScript.RegisterStartupScript(typeof(MyUpdatePanel),"StartUp" +this.UniqueID,"new MyUpdatePanel('" +this.ClientID +"');",true);// function library (registered once for all instances of MyUpdatePanel)library.AppendLine("// MyUpdatePanel javascript class");library.AppendLine("function MyUpdatePanel(panelId)");library.AppendLine("{");library.AppendLine("// properties");library.AppendLine("var _panel = document.getElementById(panelId);");library.AppendLine();library.AppendLine("// methods");library.AppendLine("this._handleBeginRequest = MyUpdatePanel_handleBeginRequest;");library.AppendLine();library.AppendLine("// hook into system events");library.AppendLine("Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(this._handleBeginRequest);");library.AppendLine();library.AppendLine("// MyUpdatePanel methods");library.AppendLine("function MyUpdatePanel_handleBeginRequest(sender, args)");library.AppendLine("{");library.AppendLine("var elem = args.get_postBackElement();");library.AppendLine();library.AppendLine("// find out if the object that requested the callback is our MyUpdatePanel");library.AppendLine("while (elem)");library.AppendLine("{");library.AppendLine("if (elem == _panel)");library.AppendLine("{");library.AppendLine("// hide the contents of the MyUpdatePanel until the asynchronrous callback returns");library.AppendLine("_panel.innerHTML ='Updating...';");library.AppendLine("return;");library.AppendLine("}");library.AppendLine("elem = elem.parentNode;");library.AppendLine("}");library.AppendLine("}");library.AppendLine("}// end class MyUpdatePanel");library.AppendLine();this.Page.ClientScript.RegisterClientScriptBlock(typeof(MyUpdatePanel),"library", library.ToString(),true);}}}

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...

Disable a button using AJAX

I saw this being discussed a couple of time but I wasn't able to figure out a solution. I got a webservice which is fired async by a button on my webform, now I need to disable the button to pretend ppl clicking multiple times on it. I tried it with that Javascript (added it to my .aspx in designer mode):

<scripttype="text/javascript">var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_initializeRequest(InitializeRequest);

prm.add_endRequest(EndRequest);

var postBackElement;

//fired when the update starts

function InitializeRequest(sender, args) {

postBackElement = args.get_postBackElement();

$get('<%= Button1.ClientID %>').enabled =false;

}

//fired when the update ends

function EndRequest(sender, args) {

$get('<%= Button1.ClientID %>').enabled =true;

}

</script>

However, my browser is throwing the error:

Error: prm has no properties
Source File:http://localhost:3889/solution/site.aspx
Line: 48

Anyone knows how to do it properly? Thanks a lot!

My guess is that your above code is firing too early and so when you call the getInstance() you're getting a null value. Try wrapping the var prm= and the prm.add_ calls inside function pageLoad() so that it fires after everything's been initialized.


The Page requestManager does not intercept the WebService Calls. Try Something like this.

For Example if have a button.

<input id="btnFire" type="button" value="ClickMe" onclick="FireWs" /
and JS:

function fireJs()
{

$get('btnFire').disabled = true:

//Now Call Your WS
WS.YourMethod(function()
{
//In the success handler enable your button
$get('btnFire').disabled = false:
}
);
}


To keep pages cleaner, I am also a fan of emitting JavaScript from the codebehind. Just add an attribute to a control like this:

dim controlUniqueID as string = ctype(me.findcontrol("myDisabledControl"), myDisabledControlType).uniqueID ' lets the JavaScript find any control on the page

submitButton.attribute.add("OnClick", "add a reference to a javascript function, or put inline code here.")

----

For more complex functions, I will register a javaScript function library and then reference methods in it.

cheers

Directory Services problem

I am trying to switch one of our sites to Beta 2 from the last pre-Beta version. Our site uses windows authentication and directory services to handle much of the security on the website. With the pre-Beta version it would either log you in. With the Beta 2, it doesn't give authentication errors, but doesn't know which user is there and only gives access that any basic user would have. Does anyone have any ideas how to fix this?We are using Request.ServerVariables.Get("AUTH_USER") to get the logged in user.
Has anyone got that to work with the beta 2?

Directly return the result

Hey there,

What I do now is this:

Namespace.Services.GetNewPosts(OnGetNewPostsComplete);

And then in the function OnGetNewPostsComplete(), I can do some functions...

Butt... I need to do this maybe 20 times or something on different parts of the webapplication and thus with other functions...

So my question is, is it possible to do something like this:

Result = Namespace.Services.GetNewPosts();

No.. this is not possible, I know that, ATLAS is ansynchronious.. but I really need something that does the same thing.. any ideas? (I've looked up events.. but can't seem to program something that does this..)

Padschild, have you tried storing the result in OnGetNewPostsComplete() in a javascript field? Then you use it through out your page.

-jhawk

Direct method call from html event

I'm just beginning trying to get familiar with Atlas and beforehead I'm curious whether it is possible to get a event handler called without having to execute the whole state flow of a page.Hi,

do you mean a server event handler? If so, the page must go through its whole lifecycle.

dinamically adding a webuser control to a Modal Pop Up Extender

I have a page that has two buttons and a text box on it. It also has a panel named pnlPopUp and an modalpopupextender which has 'pnlPopUp' as the PopupControlID.

If you Click Button1 it will display webusercontrol1 and if you click button2 it will display webusercontrol2.

Each user control has two buttons on tem (btnOK and btnCancel).

The web user controls are added dinamically to the panel when I click button1 or button2 (using Page.LoadControl("~/WebUserControl.ascx") andpnlPopup.Controls.Add(webusercontrol) );

I am trying to fill the text of teh textbox in the page according to which button is clicked on the pop-up (if I click Ok it writes "OK" in the textbox),

but my button events aren′t firing!


P.S.: If I load the controls in the page′s Page_Load and making them visible when I need them it will work fine but I didn′t want to do that because in my actual web site i will have too many user controls.

Here′s the sample code. (I′m using the exact code for both user controls):

==================== Default.aspx=============================

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@dotnet.itags.org. Register src="http://pics.10026.com/?src=~/WebUserControl.ascx" TagName="WebUserControl" TagPrefix="wuc" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<link rel="stylesheet" href="http://links.10026.com/?link=back.css" type="text/css" media="screen" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" EnableViewState="true">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<asp:Button ID="btnPopup" runat="server" Text="PopUp" />

<input type="hidden" runat="server" id="hdnPopUp" />

<asp:Panel ID="pnlPopUp" runat="server" CssClass="modalPopup">
</asp:Panel>

<cc1:ModalPopupExtender ID="mpeTestePopUp" runat="server" TargetControlID="hdnPopUp"
PopupControlID="pnlPopUp" DropShadow="true" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>

===========================================================

==================== Default.aspx.cs============================

using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
using AjaxControlToolkit;

public partial class _Default : System.Web.UI.Page
{
WebUserControl ucTestePopUp;

protected void Page_Load(object sender, EventArgs e)
{
}

void Page_Init(object sender, EventArgs e)
{
this.btnPopup.Click += new EventHandler(btnPopup_Click);
}

void btnPopup_Click(object sender, EventArgs e)
{
ucTestePopUp = (WebUserControl)Page.LoadControl("~/WebUserControl.ascx");
this.pnlPopUp.Controls.Add(ucTestePopUp);
this.mpeTestePopUp.Show();
}
}

============================================================

==================== WebUserControl.ascx============================

<%@dotnet.itags.org. Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>
<table>
<tr>
<td>
<asp:Button runat="server" ID="btnSim" Text="Sim" />
</td>
<td>
<asp:Button runat="server" ID="btnNao" Text="Nao" />
</td>
</tr>
</table>

==================================================================

==================== WebUserControl.ascx.cs============================

using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 partial class WebUserControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}

void Page_Init(object sender, EventArgs e)
{
this.btnSim.Click += new EventHandler(btnSim_Click);
this.btnNao.Click += new EventHandler(btnNao_Click);
}

protected void btnNao_Click(object sender, EventArgs e)
{
((TextBox)this.Parent.FindControl("txtTeste")).Text = "Clicou N?o";
}

protected void btnSim_Click(object sender, EventArgs e)
{
((TextBox)this.Parent.FindControl("txtTeste")).Text = "Clicou Sim";
}
}

=================================================================

Hi,

to handle events you need a control with an event handler to instantiated. If you only load your user control once in the click event handler, the button (textbox) in your user control does not exist on the page when postback caused by this button in user control is processed at the server.

Therefore, as you said you need to load your user control in page_load to handle events.

However, you don't need to load all controls. You just need to remeber which control was created last time and create this single control. You can store this information in the ViewState property.

Once you handled events from controls insode user control you can safely remove it from the page.

ALSO: You need to assign ID to your dynamically loaded user control. Otherwise, you will occasionally get problems with events firing from the second click.

-yuriy
http://couldbedone.blogspot.com

Digg-Like Button Animation, Easy Way?

Hi,

I've been trying to create a button with fading/morphing effect for a while now (kind of like digg buttons), but so far I'm not very happy with the results.

I almost got there, but not quite. Any help would be appreciated.

I have the buttons inside a Repeater control. So getting the button's client id is not the simplest thing. I also wanted to change the source image of the button (src attribute), this can't be done thru the StyleAction, so I used a Javascript/ScriptAction solution. The solution works greatly for hover effects, but not for client-side click events.

Here's the code (all client-side):

//first the fake button and animation to init everything, I know there are other ways, but this works fine.

<asp:Button EnableViewState="false" ID="FakeTarget" runat="server" Style="display: none" />
<cc1:AnimationExtender ID="aex" runat="server" TargetControlID="FakeTarget" /
//the repeater and the individual updatepanels:
<asp:Repeater ID="rpt" runat="server" OnItemCommand="rpt_ItemCommand" EnableViewState="False" OnItemDataBound="rpt_ItemDataBound">
<ItemTemplate>
<atlas:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:LinkButton id="btn" runat="server" OnMouseOver="attach(this)"/>
</ContentTemplate>
</atlas:UpdatePanel>
</ItemTemplate>
</asp:Repeater
//the javascript code
function attach(v)
{
if (v != null)
{
//scriptaction to execute (basically change the button's image)
var s = "var x = document.getElementById('" + v.id + "');if (x) x.src = 'img/new.gif';";
var effects = new Array();
effects[0] = new AjaxControlToolkit.Animation.FadeOutAnimation(v, .5, 30, .1, 1, false);
effects[1] = new AjaxControlToolkit.Animation.ScriptAction(v, .1, 20, s);
effects[2] = new AjaxControlToolkit.Animation.FadeInAnimation(v, .5, 30, .2, 1, false);

AjaxControlToolkit.Animation.SequenceAnimation.play(v, 0, 24, effects, 1);
return false;
}
}

this works perfectly, but substituting OnMouseOver for OnClientClick messes things up, as I think it's a timing issue with the updatepanel returning too quickly. The only fix I've found so far is force the Server-side Command Event to sleep for the animation time, but I hope there's a more elegant way of doing this.

Thanks,

Alexbump

Could you explain in more detail what the desired effect looks like?

Is there an example of what you want in the web?

Digg Style Comments

How can you implement a digg style commenting system using AJAX.NET?

I tried to use the CollapsiblePanelExtender within a Repeater. The idea was to fire off an asynchronouspostback to update comment rankings when the collaspe and expand controls are triggered.

Soon after I discovered that CollapsiblePanel doesn't expand/collapse within a Repeater if SuppressPostBack="false". If SuppressPostBack="true", then i could execute some code to update the ranks.

Then I realize once a PostBack occurs all my CollapsiblePanels will revert to their default collapsed or expanded state.

Please provide some ideas or point me in the right direction.

thanks

Try to specify asynchronous post back for the events of?the CollapsiblePanelExtender?through?a?asp:UpdatePanel.Can?you?post?some?codes?here?
This?is?will?help?us?to?fix?the?problem.

Dificult to reproduce : problems with webpartzones inside updatePanel

Hi !

That's very dificult to reproduce.

I'm creating a new website. I'm using the default webserver of Visual Studio 2005.

The home page users master pages and has a lot of user controls. The scriptManager and the webpartmanager are in masterpage.

One of the user controls uses three panels with ColapsiblePanelExtender. It's working now, after discovered It doesn't work without documentType tag.

The user controls are inserted in the master page, including a top menu with a top banner.

In the main page I have an UpdatePanel with two webpartzones and some webparts. I also have an UpdateProgress

The problems started when I tried to put outputcache in some user controls, like header and footer of the page.

1st Problem : The webParts in the middle don't allow to change position any more. When I move the webParts, the server is contacted (UpdateProgress works), answer is received but nothing change.

This happens sometimes. First I thinked it was cache, so I take out outputcache from all user controls and tried again, inserting outputcache one by one.

So I discovered that when I get this problem, if I delete the temporary directory for this application (in ASP.NET temp folder), close the webserver (and related process) and delete the browser cache the problem disappears.

2nd Problem : After insert outputcache in some user controls, something difference started to happend - when I move one webpart it changes, but the top banner change it's position, changing the page layout!

The UpdatePanel and webparts are in default.aspx page. Default.aspx uses one masterPage. Inside this master page is the top.ascx user control. Inside this control is the banner. So, something in the page change the layout, making the banner changes Its position!

In the moment I will undo all the cache changes, one by one, trying to discover wich change created this problema, but I don't believe one of the cache changes could do this.

With all this problems, the development becames too slow.

[]'s

Dennes

Hi !

I solved the banner problem, but I still don't know why it happend.

The original HTML was like this :

<style type="text/css" title="Portal BufaloInfo"><!--#banner {position:absoluteleft:284pxtop:21pxwidth:468height:60z-index:1}--></style><div id="banner"><a href="#"><img src="images/banner_468_60.gif" width="468" height="60" border="0"></a></div>

I changed to :

<div id="banner" style="position:absolute;left:284px;top:21px;width:468;height:60;z-index:1"><a href="#"><img src="images/banner_468_60.gif" width="468" height="60" border="0"></a></div>

So, now it works. Before this change, when the style was applied to DIV tag the banner was correct, when not, the banner apears in other position.

The main question is : Why the updatePanel, after a refresh, was changing the way this style was applied ?

[]'s

Dennes


Hi !

This seems to be a problem between Alas and IE, or something like that.

After I corrected the banner problem, IE stoped to apply the style to the rest of the page, to the entire page.

Like before : The pages start correct, after UpdatePanel has communicate with the server, the style disappears.

[]'s

Dennes

Difficulty in calling web service

Hi all,

The web service which am trying to call takes two string and three array as parameters.am able to call the web service through ajaxpro.dll, but through ajax framework1.0 its not coming. the service returns response class object..pls help me out.

In .aspx page

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

<asp:ScriptManagerID="ScriptManager1"runat="server">

<Services>

<asp:ServiceReferencePath="http://localhost/progressTrack21/ManageProgressTracking.asmx"/>

</Services>

<Scripts>

<asp:ScriptReferencePath="trackingScript.js"/>

</Scripts>

</asp:ScriptManager>

<inputid="Button1"type="button"value="Click here"onclick="funProgress();return false;"/>

In trackingscript.js file

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

function funProgress()

{

debugger;

Sys.Net.WebServiceProxy.invoke("http://localhost/progressTrack21/ManageProgressTracking.asmx","Update",false,{"UserId1":"1","PlanId1":"1","SCOId1":scoid,"ElementName1":EleName,"Value1":EleName},SucceededCallback);

}

function SucceededCallback(result, eventArgs)

{

var RsltElem = document.getElementById("Results1");

alert(result);

}

Are you getting any javascript error ??, because in your function you are directly accessing the results elements

function SucceededCallback(result, eventArgs)

{

var RsltElem = document.getElementById('<%=Results1.ClientID%>');

alert(result);

}


Hi, You do not have to call the WebServiceProxy.invoke. Instead the Ajax Framework generates a JavaScript Proxy class which represents the Server Side Web Service.

For Example if Your WebService Name is DataService and if it contains a method FetchData(), then the JavaScript class will also contain a DataService class with the FetchData Method. You can find the more info from the following links:

http://ajax.asp.net/docs/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx
http://ajax.asp.net/docs/tutorials/ExposingWebServicesToAJAXTutorial.aspx


It is giving internal server error(500)....I tried in all possible ways...


Thank u Kazi,,,,

Difficulty building site after ajax install.

I'm having some trouble with my first AJAX experience namely in the build/publish part. F5 build on VS server works fine only when I want to Publish the application to ready for deployment I get this error underneath. Looked at couple message boards but its not clear me. I've also tried aspnet_regsql without any affect. Does anyone have any idea whether this is AJAX related and how I can solve to build the project? greatly appreciated.

-- Build started: Project: D:\...\Application1\, Configuration: Debug .NET --

Index was outside the bounds of the array.

-- Skipped Publish: Project D:\...\Application1\, Configuration: Debug .NET --

just wanted to add something... if choose Build> Rebuild Webiste instead of publish if gives me 33 warning messages saying

"Could not find schema information for the element 'webServices' and all other elements I've added from the AJAX template.

The template version works fine. Don't see why this should make a difference. Default webserver runs work fine.

Arrgg


just wanted to add something... if choose Build> Rebuild Webiste instead of publish if gives me 33 warning messages saying

"Could not find schema information for the element 'webServices' and all other elements I've added from the AJAX template.

The template version works fine. Don't see why this should make a difference. Default webserver runs work fine.

Arrgg this is cracking my head as I can't find much info on it.

Difficulty After Install. Missing JavaScripts?

Greetings everyone --

I'm investigating Atlas because I have need to drag-n-drop between up to four zones on a single page. Each time I drag an element from one zone to another, it has to persist that action to the database in real time. So I've installed the Atlas framework, but I can't get anything to work at all.

For example, I've created a web project referencing the Microsoft.Web.Atlas.dll along with a page called "Example.aspx". Into that page I copied the source code for the following example on atlas.asp.net.

http://atlas.asp.net/docs/util/srcview.aspx?path=~/atlas/samples/controls/control5.src

When I build and call the webpage, I see the content rendered by the HTML but there's nothing at all related to AJAX/Atlas functionality on the page. My hypothesis is that the appropriate Javascript files are not being referenced correctly, or they haven't been copied to the right place.

I've tried to copy the ScriptLibrary\Release directory to my local web directory but that didn't work. I had no luck either when trying to specify that the ScriptManager should load an explicitly referenced Javascript file like so:

<atlas:ScriptManagerrunat="server"ID="ScriptManager1">

<Scripts>

<atlas:ScriptReferencePath="~/ScriptLibrary/AtlasUIDragDrop.js"ScriptName="custom"/> </Scripts></atlas:ScriptManager>

At this point I'm stuck which is unfortunate 'cause I'd like to use this library given that the rest of the project is .NET. Seems like a good fit. And obviously there are people out there who've gotten this to work, but I'm at a loss.

Any suggestions? Thanks.

hello.

well, i you check the source of the page on the browser, you'll surelly see several "webresource.axd?..." entries. one or more of these should load the script files on the page.


Luis -- Yes, I do see those references when I "View Source". An example is below. However, still no Atlas functionality.

<script src="http://pics.10026.com/?src=/Atlas2/WebResource.axd?d=G9ZZO75SJS72S3-g1JZzk6TyxaOlDwXjSdR4wGRZm45lxhgXFD31v2NV1yxSd_CZ1dUM9aPflYprd8NUj4GeyW2dnZ4TxHWva8leh6b5bPQ1&t=632799165960000000" type="text/javascript"></script>

I wonder...could it be that the .axd extension isn't mapped to the appropriate dll or exe in IIS? I found that when I used the Atlas template in Visual Studio to create a new Atlas Web Site the template doesn't map the .aspx extension to the aspnet_isapi.dll -- which is kind of annoying. Perhaps I better check this hunch.

Trevor


That IS indeed what it was. I had to map the .axd extension to the aspnet_isapi.dll and now the example works.

It's my view that the "Atlas Web Site" template in Visual Studio should set all this up itself -- especially if you specifyhttp://localhost/blahblahblah for your project location.

OK, on to the next thing.

Trevor


hello.

well, in fact, it's an asp.net 2.0 installation issue. if you installed asp.net 2.0 and configured your server to use it, that extension should already be mapped to that dll...

Difficulties using an asp:ImageButton and the PopupControlExtender

I have a textbox and an asp:ImageButton. I would like the Image button to be able to launch the calendar control using the PopupControlExtender and then insert the date into the textbox from selecting it on the calendar. Not sure that I am even close in my example. I am unsure as to what should be in the code behind(C#) as well. Any help would be appreciated.

<

atlas:ScriptManagerID="ScriptManager1"EnablePartialRendering="true"runat="server"></atlas:ScriptManager><asp:TextBoxID="DateTextBox"runat="server"></asp:TextBox><asp:ImageButtonID="ImageButton1"runat="server"ImageUrl="~/Images/Calendar.gif"/><asp:PanelID="Panel1"runat="server"CssClass="popupControl"><atlas:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><atlasToolkit:PopupControlExtenderID="PopupControlExtender1"runat="server"><atlasToolkit:PopupControlPropertiesTargetControlID="ImageButton1"PopupControlID="Panel1"Position="Bottom"/></atlasToolkit:PopupControlExtender><center><asp:CalendarID="Calendar1"runat="server"BackColor="White"BorderColor="#999999"CellPadding="1"DayNameFormat="Shortest"Font-Names="Verdana"Font-Size="8pt"ForeColor="Black"Width="160px"OnSelectionChanged="Calendar1_SelectionChanged"><SelectedDayStyleBackColor="#666666"Font-Bold="True"ForeColor="White"/><TodayDayStyleBackColor="#CCCCCC"ForeColor="Black"/><SelectorStyleBackColor="#CCCCCC"/><WeekendDayStyleBackColor="#FFFFCC"/><OtherMonthDayStyleForeColor="#808080"/><NextPrevStyleVerticalAlign="Bottom"/><DayHeaderStyleBackColor="#CCCCCC"Font-Bold="True"Font-Size="7pt"/><TitleStyleBackColor="#999999"BorderColor="Black"Font-Bold="True"/></asp:Calendar></center></ContentTemplate></atlas:UpdatePanel></asp:Panel>

PopupControl's natural behavior is to add the commit text to its TargetControlID. You want the text to go to a different control, so that's why it's a little more difficult. However, you should be able to get this to work thanks to PopupControl's extensibility. What should work is:

1. Set the CommitProperty property to something handy like "value". This will tell PopupControl to store the commit text in a "value" property on the TargetControlID (an image in your case).

2. Set the CommitScript property to some JavaScript code that reads the commit text from TargetControlID.value and sets it to the intended text box.

That's the general idea - if it doesn't work for you, please follow up here.


Hi David,

I tried the steps you mentioned. Everytime I click on the Imagebutton the calendar displays(flickers) and then disappears, however, when I right click the button the calendar stays open and i can choose a date and it appears in the textbox. What else am I doing wrong?

<

scriptlanguage="javascript"type="text/javascript">function getCalendarValue()

{

document.getElementById('DateTextBox').value = document.getElementById('ImageButton1').value;

} getCalendarValue()

</script>

</head>

<body>

<formid="form1"runat="server"><atlas:ScriptManagerID="ScriptManager1"EnablePartialRendering="true"runat="server"></atlas:ScriptManager><asp:TextBoxID="DateTextBox"runat="server"></asp:TextBox><asp:ImageButtonID="ImageButton1"runat="server"ImageUrl="~/Images/SmallCalendar.gif" />

<asp:PanelID="Panel1"runat="server"CssClass="popupControl"><atlas:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><atlasToolkit:PopupControlExtenderID="PopupControlExtender1"runat="server"><atlasToolkit:PopupControlPropertiesTargetControlID="ImageButton1"PopupControlID="Panel1"Position="Bottom"CommitProperty="value"CommitScript="getCalendarValue()"/></atlasToolkit:PopupControlExtender><center><asp:CalendarID="Calendar1"runat="server"BackColor="White"BorderColor="#999999"CellPadding="1"DayNameFormat="Shortest"Font-Names="Verdana"Font-Size="8pt"ForeColor="Black"Width="160px"OnSelectionChanged="Calendar1_SelectionChanged"><SelectedDayStyleBackColor="#666666"Font-Bold="True"ForeColor="White"/><TodayDayStyleBackColor="#CCCCCC"ForeColor="Black"/><SelectorStyleBackColor="#CCCCCC"/><WeekendDayStyleBackColor="#FFFFCC"/><OtherMonthDayStyleForeColor="#808080"/><NextPrevStyleVerticalAlign="Bottom"/><DayHeaderStyleBackColor="#CCCCCC"Font-Bold="True"Font-Size="7pt"/><TitleStyleBackColor="#999999"BorderColor="Black"Font-Bold="True"/></asp:Calendar></center></ContentTemplate></atlas:UpdatePanel></asp:Panel></form>
You were SO close! You're using an ImageButton which has submit semantics - it's the submit that's causing the flicker and messing stuff up. Change it to an Image instead, and it works great. Here's the code:
<%@. Page Language="C#" %><%@. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit" %><!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 Calendar1_SelectionChanged(object sender, EventArgs e) { PopupControlExtender1.Commit(Image1, Calendar1.SelectedDate.ToString()); }</script><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>Untitled Page</title> <script language="javascript" type="text/javascript"> function getCalendarValue() { document.getElementById('DateTextBox').value = document.getElementById('Image1').value; }// getCalendarValue() </script></head><body> <form id="form2" runat="server"> <atlas:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server"> </atlas:ScriptManager> <asp:TextBox ID="DateTextBox" runat="server"></asp:TextBox> <asp:Image ID="Image1" runat="server" ImageUrl="~/ToggleButton/ToggleButton_Checked.gif" /> <asp:Panel ID="Panel1" runat="server" CssClass="popupControl"> <atlas:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <atlasToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server"> <atlasToolkit:PopupControlProperties TargetControlID="Image1" PopupControlID="Panel1" Position="Bottom" CommitProperty="value" CommitScript="getCalendarValue()" /> </atlasToolkit:PopupControlExtender> <center> <asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="#999999" CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Width="160px" OnSelectionChanged="Calendar1_SelectionChanged"> <SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" /> <TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" /> <SelectorStyle BackColor="#CCCCCC" /> <WeekendDayStyle BackColor="#FFFFCC" /> <OtherMonthDayStyle ForeColor="#808080" /> <NextPrevStyle VerticalAlign="Bottom" /> <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" /> <TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" /> </asp:Calendar> </center> </ContentTemplate> </atlas:UpdatePanel> </asp:Panel> </form></body></html>

Awesome! I changed it and it worked like a charm. Thanks David! The only other thing I noticed was that when the page loads, it seems like the calendar control shows for a brief second and disappears. How would I get around this?
Look at the .popupControl style used by the samples - it applies "visibility:hidden" to the relevant panel from the very beginning. That way the browser never tries to show it until it's popped.
Thanks for your help!! Genious!!!

Hi;

I followed your code.

Can you let me know why the document.getElementById can't find my contols? I had to look into the source of my page and find out that the name is of my text box isctl00$ContentPlaceHolder1$tbActivationDate instead oftbActivationDate?

the javascript function worked when I did this:

document.getElementById('ctl00$ContentPlaceHolder1$tbActivationDate').value = document.getElementById('ctl00_ContentPlaceHolder1_ImgActivationDate').value


The name of the control may have been ctl00$xxx, but the getElementById works off of the id which would have been ctl00_xxx. If you refer to the control by the '_' version, I this should will work fine.
Thanks, this worked like a charm! One question, though...

I was dynamically creating the javascript, like so:

sb.Append("function GetCalendar1Value(){"); sb.Append("document.getElementById('" + tbBeginDate.UniqueID +"').value = " +"document.getElementById('" + imgCal1.UniqueID +"').value;"); sb.Append("}");
However, this created a full name of "ctl00$ContentPlaceHolder1$imgCal1", which didn't work. I hardcoded it to "ctl00_ContentPlaceHolder1_imgCal1" and it works.

Why doesn't the UniqueID work for the <asp:image> control, or is there a better way of doing it? I guess it works as is, I'm just curious. Thanks!
Hi edmicman,

You may want to check out theClientID property. I think this is more along the lines of what you're looking for...

Thanks,
Ted
Thanks! But doesn't .ClientID only return the ASP.NET ID, i.e. "imgImage1" instead of the full name of the control within a master page, etc. ("ctl00_content... etc.)? It seems like I tried that before and it needed the full name or something. I'll try it again...

Thanks a lot, I was looking for this code and it works fine!


When I try to use this with MasterPages, it doesn't work anymore (yesterday I tried it on a single asp.net page for tests).

I have my JavaScript placed in the <head></head> part of my MasterPage (when I try another JavaScript placed on my MasterPage, it just works fine)

What am I doing wrong?


Hi Hopke,

I'm not sure what's going wrong with this. Perhaps you can post a small sample that still contains the problem so I can try to help.

Thanks,
Ted

Difficult to disable ClientState in User Control

Not sure there's a solution for this, but I find it overly difficult to disable the client state field. I'm using HTTP Get for my post, and I have a textbox watermark extender on a field. I don't want the ClientState because it makes my URLs look bad. So I have to set EnableClientState to false BEFORE the client state hidden control is actually set. In a user control, I don't think I get any chance to do this. (The debugger says I don't see OnInit before the contained TextBoxExtender does, and there's no PreInit for the control).

So my only choice would be to derive from TextBoxWatermarkExtender. Not the end of the world, but I don't think it's what was intended. Thoughts?

Your idea about deriving from TBW seems pretty reasonable to me. Any objections?
Yeah, it's an awfully heavy price to pay for simply setting a property. I would much prefer to see this in the core classes.

Difficult problem with the UpdatePanel and State

Hi,

I have a page with an UpdatePanel that display 5 news story headlines, within the UpdatePanel there are two buttons, back and next, to move the to the next 5 headlines set or to move previous 5 headlines set. Each headline has a link that goes to a new page where the full news story is shown. All this is working great, but if the user is on the second or third set of headlines, then clicks on one of the headlines to go to the page that shows the entire news story, then the user click the back button on the browser to get back to the news story headlines, the news story headlines page will display the first set of news story headlines, not the second or third set where the user originally left from.

How I can let the news story headlines page or the UpdatePanel know on which set the user left the page, so when the user came back via the back browser button, the set they left is displayed?

Hope this makes sense! Thank you.

Please, let me know if I should explain this better or differently, need help with it!

differnet image with each tabpanal

hi friends how can i place image with each tabpanal. likeSmilefirst tab,AngrySecondtab...

thanks in advance.

I have not tried this, but I think you might be able to through the control's Theming of Tabs. Here's a good article on customizing the appearance of the Tabs.

http://blogs.visoftinc.com/archive/2007/09/26/ajax-control-toolkit-tab-control-themes.aspx


You could just add the IMG HTML to the HeaderText attribute of the TabPanel, for example:

HeaderText="<img alt='' width='10' height='10' style='margin-right:10px;' src='...ImagePath...'/>Tab 01"

-Damien


can we set the backgroundcolor or give background image when we mouse moves over the tabs.

thanks in advance.


can we set the backgroundcolor or give background image when mouse moves over the tabs.

thanks in advance.


This can be achieved by changing the.ajax__tab_hover css class

George .


.ajax__tab_xp.ajax__tab_header {font-family:verdana,tahoma,helvetica;font-size:11px;background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-line.gif")%>)repeat-xbottom;}

.ajax__tab_xp.ajax__tab_outer {padding-right:4px;background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-right.gif")%>)no-repeatright;height:21px;}

.ajax__tab_xp.ajax__tab_inner {padding-left:3px;background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-left.gif")%>)no-repeat;}

.ajax__tab_xp.ajax__tab_tab {height:13px;padding:4px;margin:0;background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab.gif")%>)repeat-x;}

.ajax__tab_xp.ajax__tab_hover.ajax__tab_outer {background:url(~\images\bt-delete.gif)no-repeatright;}

.ajax__tab_xp.ajax__tab_hover.ajax__tab_inner {background:url(~\images\bt-delete.gif)no-repeat;}

.ajax__tab_xp.ajax__tab_hover.ajax__tab_tab {background:url(~\images\bt-delete.gif)repeat-x;}

.ajax__tab_xp.ajax__tab_active.ajax__tab_outer {background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-active-right.gif")%>)no-repeatright;}

.ajax__tab_xp.ajax__tab_active.ajax__tab_inner {background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-active-left.gif")%>)no-repeat;}

.ajax__tab_xp.ajax__tab_active.ajax__tab_tab {background:url(<%=WebResource("AjaxControlToolkit.Tabs.tab-active.gif")%>)repeat-x;}

.ajax__tab_xp.ajax__tab_body {font-family:verdana,tahoma,helvetica;font-size:10pt;border:1pxsolid#999999;border-top:0;padding:8px;background-color:#fff8dc;}


Check out my blog on theming the tabs, it should help you out:http://blogs.visoftinc.com/archive/2007/09/26/ajax-control-toolkit-tab-control-themes.aspx

-Damien


hi i got the Answer from the following blog few days before.

http://mattberseth.com/blog/2007/09/more_sample_ajaxcontroltoolkit.html

thanks.