Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts

Wednesday, March 28, 2012

Transforming plain ID to adorned ID

I must be missing something obvious here. Suppose I create an ASP.NET Web User Control, and I use a ModalPopupExtender inside it. In the ascx, I set various properties of the extender to refer to controls within the Web User Control, such as PopupDragHandleControlID="TitleText". At runtime, the control with ID "TitleText" gets a more complicated ID on the rendered page (call it an 'adorned' ID, not sure what the offical term is), such as "ctl00_ContentPlaceHolder1_MyCtrl1_TitleText". The behaviour javascript for the extender does things like -

this._dragHandleElement = $get(this._PopupDragHandleControlID);

That wouldn't work with the 'plain' ID, in fact by adding various alert() boxes I can see that _PopupDragHandleControlID has been transformed - somewhere - to the 'adorned' version. I've written an extender that declares and uses ID properties in just the same way, but they don't get transformed from the 'plain' version at runtime. So, I either have to use ugly workarounds like setting that ID programmatically from server-side code (e.g. MyExtender1.BlahID = MyBlahCtrl.ClientID), or ... figure out how to get that transformation to happen automatically like it seems to for ModalPopupExtender. Can anyone point me in the right direction?

(Note, I'm not talking about the TargetControlID property, so ResolveTargetControlID wouldn't come into it, and I'm talking about an extender that's right next to the controls in question.)

Thanks in advance for any leads.

Kevin.

All extender properties that reference ID's are decorated with theIDReferencePropertyAttribute. It helps converts server side ids into client versions so that the behavior can resolve them easily. If you look at the ModalPopupExtender.cs file, the PopupDragHandleControlID has that attribute and so so any other properties that are used to get control IDs.


Do you have any references that confirm that's so and detail where it occurs? The reasons I ask are 1. My extender's properties that ref IDs already have that attribute, and no such conversion occurs, and 2. The documentation for that attribute doesn't mention anything like that, merely that it can be used by designers to help out by giving a list of control IDs at design time - no mention of anything happening at runtime. But if that attribute is the answer and if you have more information on it, please do say so I can figure out why it isn't working for me.

Or does anyone else have details on how the conversion occurs for PopupDragHandleControlID et al?

Thanks in advance for any help

Kevin.


It happens in ExtenderBaseDesignerHelpers.cs file. It is part of the Toolkit framework. If you are building on top of ExtenderControlBase this is taken care of automatically.

Should have included these links earlier

http://ajax.asp.net/ajaxtoolkit/Walkthrough/CreatingNewExtender.aspx

http://ajax.asp.net/ajaxtoolkit/Walkthrough/ExtenderClasses.aspx


Aha. In fact, I had a hand-rolled extender built with ref to various online docs rather than one done as per that walkthrough, which when followed showed up I'd not got the ECB derivation stuff right. In the interim, I'd done some tracing through the ACT code and you're quite right, that attribute is used as a signal for the base classes to apply some transformation before serialising. Funny the docs don't mention that. Anyway, thanks for the pointers - it's running ok now.

Kevin.

TreeView and UpdatePanel

Hi:

I am experimenting with TreeView in ASP.NET 2.0 and ATLAS.

I have placed a simple TreeView inside an UpdatePanel, and populated it from an XML file as follows:

   <asp:TreeView ID="tvSysMgtNavigation" ExpandDepth="0" runat="server"> <DataBindings> <asp:TreeNodeBinding DataMember="Item" TextField="Name" SelectAction="None" /> <asp:TreeNodeBinding DataMember="ItemLine" TextField="Name" /> </DataBindings> </asp:TreeView> <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Include/Management.xml" />

So, when the TreeView Loads inside the UpdatePanel, only the root is show to be expanded. When I click on the "plus" near the root, I get this javascript exception:

Microsoft JScript runtime error: Object expected

and Visual Studio 2005 show the exception at:

TreeView_PopulateNode(ctl00_tvSysMgtNavigation_Data,0,ctl00_tvSysMgtNavigationn0,ctl00_tvSysMgtNavigationt0,ctl00_tvSysMgtNavigationt0i,' ','Management','Management','t','/*[position()=1]','t')

Is there any known confusion between the ClientCallBack done by the TreeView and ATLAS?

regards

Update:

The problem seems to exist only when ExpandDepth= "0", if I place a number greater then 0, like 1 or 2, etc ... it works fine without any problem.

So the TreeView_PopulateNode is missing an object when it strats expanding form the top root.

This problem is not encountered when the TreeView is outside the UpdatePanel.

Thanks,


Did you test with Mode=Always?

<

atlas:UpdatePanelID="UpdatePanel1"runat="server"Mode="Always">

Same problem, now I am getting an exception at the end of the method, last line:

function TreeView_PopulateNode(data, index, node, selectNode, selectImageNode, lineType, text, path, databound, datapath, parentIsLast) {
var context = new Object();
context.data = data;
context.node = node;
context.selectNode = selectNode;
context.selectImageNode = selectImageNode;
context.lineType = lineType;
context.index = index;
context.isChecked = "f";
var tr = WebForm_GetParentByTagName(node, "TR");
if (tr) {
var checkbox = tr.getElementsByTagName("INPUT");
if (checkbox && (checkbox.length > 0)) {
for (var i = 0; i < checkbox.length; i++) {
if (checkbox[i].type.toLowerCase() == "checkbox") {
if (checkbox[i].checked) {
context.isChecked = "t";
}
break;
}
}
}
}
var param = index + "|" + data.lastIndex + "|" + databound + context.isChecked + parentIsLast + "|" +
text.length + "|" + text + datapath.length + "|" + datapath + path;
TreeView_PopulateNodeDoCallBack(context, param);
}

The problem is with CallBack that TreeView does to populate ondemand. But the question, why only when the ExpandDepth is 0, I get such an exception!!!

Regards


Hi:

As you all know, TreeView has a property called ExpandNodesFromClient, that is when set TRUE together with PopulateOnDemand, then once a node is clicked, a client-callback is generated to expand the children of a specific node.

Believe or not, I got an idea while I was sleeping last night. The idea is that, since I have the TreeView in an UpdatePanel, so an asynchronous request will be sent, why do I have to enable PopulateNodesFromClient? There is no use in fact to do so, since in all cases, an asynchronous request will be generated.

So once I set the PopulateNodesFromClient to FALSE, it seems to work fine.

I guess there is no better solution for this case.

Hope you will benefit from this experienceSmile [:)].

Regards


Hi Haidar,

Do u have solution for a setting the scrolling bar to its initial position. Actually the scroll bar reset to zero all the time.

Here is my code : --

<

bodyonload="document.getElementById('TreePanel').scrollTop = document.getElementById('divscroll').value">
<atlas:ScriptManagerrunat="server"ID="ScpMgr"EnablePartialRendering="true"/>

<formid="thisFrm"runat="server">

..........

<inputtype="hidden"id="divscroll"runat="server"/>

<atlas:UpdatePanelID="TreeUpdtPanel"runat="server"RenderMode="Inline"Mode="Conditional">

<ContentTemplate>

<divid="TreePanel"onscroll="document.getElementById('divscroll').value = this.scrollTop;"runat="server"onclick="document.getElementById('divscroll').value = this.scrollTop;"Class="PageTable PanelTree"onprerender="document.getElementById('TreePanel').scrollTop = document.getElementById('divscroll').value">

<asp:TreeViewID="TreeHCR"runat="server"DataSourceID="HCRXML"OnSelectedNodeChanged="TreeHCR_SelectedNodeChanged"ShowLines="True"ExpandDepth="1"ShowExpandCollapse="true">

<DataBindings>

.....

</DataBindings>
......

</asp:TreeView>

</div>

</ContentTemplate>

<Triggers>

<atlas:ControlEventTriggerControlID="RepeaterSearchResults"EventName="ItemCommand"/>

</Triggers>

</atlas:UpdatePanel>

.............

</form>
</body>
</html>

I m trying to implement to set the pos to the values saved in the hidden box ...but its not working in Atlas.
Any idea how to put the values when the tree refreshed ...


Hello:

I guess couldn't understand you well, can you illustrate more on the problem please?

Thanks,


Hi,

just to avoid a thread duplication, I've answered the same questionhere.

Hello,

Just thought I should share this..

I also had a problem with TreeView control and it took me a while to find this thread..

I have a TreeView with several TreeNodes and each one has several ChildNodes with PopulateNodesFromClient set to True.

The error I was getting is the same "Objected Expected" JavaScript error and I ran out of luck until I found this thread and tried setting ExpandDepth to 0 or 1... Now the TreeView works just fine. FYI, without setting ExpandDepth, the property is set to -1.


Thanks.
-Moe

TreeView checkboxes AutoPostBack with AJAX

Hello,

There is a known problem with TreeView checkboxes in ASP.NET: they can't do AutoPostBack. So I've solved this problem like this:

<script language="javascript" type="text/javascript">function postbackOnCheck(){ var o = window.event.srcElement; if (o.tagName == 'INPUT' && o.type == 'checkbox' && o.name != null && o.name.indexOf('CheckBox') > -1) { __doPostBack("",""); }}</script><asp:TreeView onclick="postbackOnCheck()" ID="treeContent" runat="server"> ... And so on ... </TreeView>

This way I get full postback each time the user checks\unchecks the checkbox.

But now I want to modify this code in order to make use of AJAX: I don't want the FULL postback, but I only want the tree itself to be updated. Of course, I've started by placing it inside the UpdatePanel. But what now? Can somebody help me with this issue?

Thanks Dmitry!

Clean solution. Very useful!

Nikolay


I haven't tried this out myself but would suggest creating an event trigger for your updatepanel for the treeview's onclick event. Suppose that should do the job.


Use treeview's Load event in the updatepanel's event trigger. This works for sure

Monday, March 26, 2012

TreeView populated programatically in Atlas UpdatePanel

Hi there,

I'm fairly new to Atlas and ASP.NET, so perhaps this question is obvious (I apologise).

I have created a page which essentially contains this information:

<asp:Content ID="Content1" ContentPlaceHolderID="MainPagePlaceholder" Runat="Server">
<atlas:UpdatePanel ID="AjaxMultiMediaPanel" mode="Conditional" runat="server">
<ContentTemplate>
<asp:Table ID="MultiMediaTable" CssClass="MultiMediaTable" runat="server" Height="193px" Width="274px">
<asp:TableRow runat="server">
<asp:TableCell runat="server" CssClass="TableTopAlign">
<cc1:MediaPlayer ID="MediaPlayer1" runat="server"></cc1:MediaPlayer>
<atlas:UpdateProgress runat="server" ID="progress">
<ProgressTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/SpinningBall.gif" /> Reading UPnP Directory
</ProgressTemplate>
</atlas:UpdateProgress>
</asp:TableCell>
<asp:TableCell runat="server" CssClass="TableTopAlign">
<asp:TreeView ID="TreeView1" runat="server" >
<ParentNodeStyle CssClass="TreeParentNodeStyle" />
<HoverNodeStyle CssClass="TreeHooverStyle" />
<RootNodeStyle CssClass="TreeRootNodeStyle" />
<LeafNodeStyle CssClass="TreeLeafStyle" />
<NodeStyle CssClass="TreeNodeStyle" />
</asp:TreeView>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Play" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Load UPnP Info" />
</asp:TableCell>
<asp:TableCell>
<asp:Label ID="Label1" runat="server" Text="" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ContentTemplate>
</atlas:UpdatePanel
</asp:Content>

When Button2 is pressed, I programatically populate the TreeView (using c# to recursively build the tree). This works without problems when I do NOT use Atlas, except of course in that case the page refreshes after about 10 seconds. Now, using the code above, The Progress Update image and text is shown for about 10 seconds, but after that the page 'freezes' for over a minute. I have tried triggers to force a refresh, programatically forcing a refresh, but nothing helps. If I at the end of my tree-population code turn set TreeView1.Visible = false; then the page does not freeze.


It appears that the population of the treeview somehow causes Atlas to do 'something' for an awful long time.

If possible, I would appreciate any help any of you experts can offer.

- Anders

P.S. The tree has a depth of about 4-5 levels max, with about 100 items. Nothing crazy. The 10 second delay is due to some other UPnP lookups I'm doing, not because it takes a long time to build the tree.

See also:similar discussion

A count of my items reveals 2685 of them, a bit more than stated above.


Hi Anders

Did you ever find out a solution to this problem? I have been having the same problem where a TreeView inside an UpdatePanel takes a very long time to refresh.

Using Fiddler, I found out that the problem is the various images used by the TreeView control. Outside an UpdatePanel, the browser makes only one request for an image, regardless of the number of times its used. Inside the UpdatePanel, the browser makes a request for each and every instance of an image.

I don't know if this is a problem with the IE cache or the way Atlas is processing the resulting page.

The solution to this has so far eluded me. The only thing I can do is to reduce the number of images used by the TreeView control, but that quickly makes it useless.

Cheers,

- Dan


Hi Dan,

No solution so far. I had to drop it and just create the site using other widgets. Not quite as cool, but at least it works.


http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx#UpdatePanelCompatibleControls

I had same problem. Finally, I setup a full postback trigger to the control that will force the repaint.
In my case, I had a button so my trigger code look like this:
<Triggers>
<asp:PostBackTriggerControlID="btnBack"/>
<asp:PostBackTriggerControlID="btnNext"/>
</Triggers>


I had the same problem, but I am still using Atlas, I don't wanna update until official version. And atlas UpdatePanel does not have PostBackTrigger, do you know how to solve it this problem witt Atlas?
If you haven't upgraded to the latest version by now, then you're going to be in a world of hurt when the RTM is released. There have been MANY breaking changes from ATLAS and it would be wise to forget ATLAS and move forward.

Trigger full postback from the server during a partial postback.

Well, I have a dialog user control (ajax popup) which can again contain other user asp user controls as content. The content of the dialog is created inside an UpdatePanel, so that the dialog content can postback. All of that works OK.

On the web page I have now some information visible inside a GridView which is not in an UpdatePanel and should not be, because I need the browser forward/backward button to work. A link on that web page lets one of these dialog controls pop up. The dialog contains a user control which can manipulate the data which is visible inside the GridView. If the user presses a button inside the dialog, the dialog does an asynchronous postback as the user control/dialog content is inside an update panel and the dialog closes. That gives the user the impression that nothing happened as the data visible in the GridView did not change. I do already have the code to refresh the gridview, but how can I change the behavior during the postback from being an asynchronous postback to a full postback?

So just to clarify some pseudo code:

In the user control contained inside the dialog I would have some code like:

void OnOK(...)
{
// check if any data changed
if (textBox.Text != record.Text)
{
// do a database update
// and
// update cached data which the datagrid is bound to
// call a method on the page to rebind the datagrid only

// ? Force a full page refresh
}
else
{
// do nothing
// asynchronous postback is OK, no full page refresh needed
}
}

The force of a full page refresh is what I would need. In a fat environment like Windows Forms, I would just call Invalidate on the Form. Or IF the DataGrid would be inside an UpdatePanel I would search for it and call Update() on it, but then I would loose the browser caching during back and forward movements. So I was searching through all of the classes if there is something like ScriptManager.UpdatePage or something similar, but have found nothing so far.

So what is the solution here? How can inform the ajax client side script, that it should just go ahead and rerender the whole page instead of just extracting the update panel portions?

Thanks

In the <Triggers> collection of your updatepanel, just add whatever control you want to cause a full refresh as a PostBackTrigger instead of as a AsynchPostBackTrigger.

<asp:UpdatePanel ...>
<Triggers>
<asp:PostBackTrigger ControlID="whateverID" />
</Triggers>
<ContentTemplate>
...
</ContentTemplate>
</asp:UpdatePanel>


Well, that does not work:

a) the UserControl is designed separatly and does not have an update panel and vice versa the dialog is a generic control which just adds a UserControl as a content, so it cannot hardcode if there is any control ID inside which should trigger a full postback

b) I do not want a full postback to occur all the time when the button is pressed, the logic of the button on the server side should determine if a full postback is necessary or not, if not then a partial postback is OK.


I tried to work around now, kind of using your approach by doing this in the OnPreRender or OnChildControlsCreated of the UserControl:

System.Web.UI.WebControls.WebControl btnOK =this.Parent.Parent.FindControl("btnOK")as System.Web.UI.WebControls.WebControl;
if (btnOK !=null)
{
System.Web.UI.Control control = btnOK;
UpdatePanel updatePanel = control.ParentasUpdatePanel;
while ((updatePanel ==null) && (control !=null))
{
control = control.Parent;
updatePanel = controlasUpdatePanel;
}
if (updatePanel !=null)
{
PostBackTrigger pbTrigger =newPostBackTrigger();
pbTrigger.ControlID ="btnOK";
updatePanel.Triggers.Add(pbTrigger);
}
}

So I do find the OK button and I do find the UpdatePanel that contains the button, but it has no effect whatsoever.
The control ID must be right, otherwise I would not be able to find the button with it, but still no PostBack and the Dialog itself is not inside an UpdatePanel.

Saturday, March 24, 2012

Trigger partial page update from child window... or from DIVed IFrame

Hello there.

I need ideas on how to trigger an update panel from a child window (window.open) with ASP.NET AJAX. How can I access the "parents" page Scriptmanager or even the UpdatePanel itself?

The other possible option would be to do a callback from an IFrame but I am also unsure if it is possible to tweak it in such a way that only certain parts of the page are reloaded.

If you have already accomplished this in some way or the other than I would greatly appreciate if you share your solution or give some hints.


thanks,

Elmar

Gosh, isn′t it always like this - after posting the above I found a very decent solution for this issue. It does not involve hidden controls or similar.

In case you want to know more - here is thelink

Elmar

Triggering custom client-side javascript after an asp.net ajax postback

I'm working on a form that I wrote a ton of javascript for. The page is also processed server-side through asp.net.

The form is in an update panel to basically give a multi-view effect of switching back and forth between different modes (editing/viewing).

I want my javascript to trigger every time I go into edit mode. To accomplish this, I came up with the following 'hack' to do it.


<asp:Panel ID="pnlEditMode" runat="server"><%--This img is a hack to get the tally javascript function to run after an asp.net ajax postback--%><img onerror="tally(this);" src="http://pics.10026.com/?src=" style="display: none;" /></asp:Panel>

It basically just shows/hides the panel depending on what mode it is.

It works great, just wondering if there's a better way.

Thanks


It looks like you should be using the ScriptManager.RegisterStartupScript() method.

ScriptManager.RegisterStartupScript(this.updatePanel,

this.updatePanel.GetType(),

"tally",

"tally()",

true);

Call it sometime during the asynchronous PostBack request.

Mark

Wednesday, March 21, 2012

Trouble getting AJAX Extension 1.0 to work in VWD

I have installed the ASP.NET 2.0 AJAX Extension 1.0 on my computer. I tried creating an AJAX enabled web application in Visual Web Developer and the UpdatePanel controls along with all the other new AJAX keywords were not recognised even though the toolbox had been updated with the controls. I thought it might be my errors in the code, so I downloaded the sample code for the ToDo list application tutorial onwww.asp.net/ajax and I had the same problem.

That way I can be sure that it is my computer! I have Microsoft .NET Framework 1.0, 1.1, 2.0 and 3.0 installed. I have tried a reinstall of AJAX Extension 1.0 and have made sure that I have selected 'AJAX Enabled project' at the start up screen.

What is the problem?

Check out this link

http://asp.net/AJAX/Control-Toolkit/Live/Walkthrough/Setup.aspx



Sorry but that really wasn't that helpful! I just have the AJAX Extensions 1.0 NOT The Control Toolkit. I can't get the first bit to work so I can't use the toolkit anyway! When I tried installing the vsi file for the toolkit it didn't install the components properly.

What is the problem?


I think because you r using VWD, you will not be able to install vsi template.

and to use Microsoft AJAX Control you will have to download the toolkit

After downloading the toolkit just follow steps from above link

in "Configure Visual Studio 2005 and Visual Web Developer" section

I hope it helps.


I realised the problem.

I needed to install Service Pack 1 for VWD before it would fully recognise the AJAX Extensions. That solved it and I could then install the control toolkit

Trouble getting started, please help

Ok my problem is that I can't get a basic update panel to function correctly.

Here is what I did:

1) Downloaded and installed ASP.NET AJAX

2) Added a reference to System.Web.Extensions from myexisting ASP.NET application.

3) Copied all the web.config stuff I could find into my own web.config. I can post every web.config change if needed.

4) Created a new form.

5) Added a script manager, an update panel, a button and 2 labels.

6) I put 1 label into the update panel

7) I added an update panel trigger for an asyncpostbacktrigger for Button1 / Click.

8) I put some code in the page load and button click events to write out the current time to the labels.

Now when I run this, the button click doesn't just update the update panel, it does a full postback and page reload.

I tried creating an application from the start using the ajax template, and this exact same code works fine, but I seem unable to ADD the ajax functionality into my existing application.

Any ideas? Any way to narrow down the problem?

Here is the page output from my test page (the one the doesn't work):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head><title>Untitled Page</title></head><body> <form name="form1" method="post" action="zajax.aspx" id="form1"><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTE4MDcxODkwD2QWAgIDD2QWBAIBDw8WAh4EVGV4dAUKNjozMzozNSBQTWRkAgcPZBYCZg9kFgICAQ8PFgIfAAUKNjozMzozNSBQTWRkZCbSNxjGnv0oo3s0JvUpWd1OHCwj" /><script src="/ScriptResource.axd?d=WWzAfBI_rdQxam3uQdNeBo6UjgPObu2SaxGwCsecklai8gu7WtIhUsofOWAHTAlPUibAvbb2N8dnhGH5Tlo9L6EdZbxe5NvYcX9AZQ-T0Do1&t=633058483670203504" type="text/javascript"></script> <div>  <span id="Label2">6:33:35 PM</span> <input type="submit" name="Button1" value="Button" id="Button1" />   <div id="UpdatePanel1"> <span id="Label1">6:33:35 PM</span> </div> </div> <script type="text/javascript"><!--Sys.Application.initialize();// --></script></form></body></html>

Now when I put the same server side code into an AJAX Template Application, it DOES work, and the page output contains a lot more stuff:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head><title>Untitled Page</title></head><body> <form name="form1" method="post" action="default2.aspx" id="form1"><div><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTE4MDcxODkwD2QWAgIDD2QWAgIBDw8WAh4EVGV4dAUKNjozNToyNCBQTWRkZNZhuPWbMGlct/IbEepy3VFq4PPN" /></div><script type="text/javascript"><!--var theForm = document.forms['form1'];if (!theForm) { theForm = document.form1;}function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); }}// --></script><script src="/WebResource.axd?d=IGbOu8tbXSYcXb22j2-mVA2&t=632993516188917664" type="text/javascript"></script><script src="/ScriptResource.axd?d=qjtDxogNeiSUKOtmty-j9LOFc00mMzNwj-wep6XL5baMU0VZUYW2HyaCCOXHOI2_3oSO_YCxqyX9CyTLuDTKeyhteOcDGwPlwaJ4N4EDBr41&t=633058483670203504" type="text/javascript"></script><script src="/ScriptResource.axd?d=qjtDxogNeiSUKOtmty-j9LOFc00mMzNwj-wep6XL5baMU0VZUYW2HyaCCOXHOI2_3oSO_YCxqyX9CyTLuDTKe9Vuooudj_iJ62Khwrpdqfc1&t=633058483670203504" type="text/javascript"></script>  <span id="Label2">6:35:24 PM</span> <input type="submit" name="Button1" value="Button" id="Button1" /> <script type="text/javascript">//<![CDATA[Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], ['Button1'], [], 90);//]]></script>   <div id="UpdatePanel1"> <span id="Label1">Label</span> </div> <div><input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLAh/rhCAKM54rGBo/RxSYDefM+QwfmqDXaIMTc/6Ya" /></div><script type="text/javascript"><!--Sys.Application.initialize();// --></script></form></body></html>

My ASPX page has this:

<%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false" CodeBehind="zAjax.aspx.vb" Inherits=".zAjax" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server">  <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>   <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /> </Triggers> </asp:UpdatePanel> </form></body></html>

Seems like you are messed up with the web.config file. Take a new AJAX Project and copy the web.config file to replace your existing web.config. If you have made any custom changes to your original web.config file, make them in the new.

Are you adding any AJAX related dll's to the \bin folder? You dont need to add them coz with ASP.NET AJAX 1.0 all the assemblies are installed into GAC.

Thanks


You might also find this handy...I know I did when I found the whole thing was reloading/rebuilding (dynamic controls etc)...it should allow you to establish the type of postback you are getting...

' asynchronous postback?
If MyScriptManager.IsInAsyncPostBack =FalseThen' do some stuffEndIf

Trouble installing ASP.NET Ajax

I have tried several times to install ASP.NET Ajax (latest version as of November 9, 2006). I get no indications of installation failure. However, the Ajax project template available when I create a project. There is no evidence of a project template in the appropriate templates folder.

I would like to use ASP.NET Ajax in my current project but will not be able if I can't get it installed. Is this a bug or am I doing something wrong?

One thing I did notice is the extensions file is AJAXExtensionsToolbox.dll (notice the plural Exensions, but the documentation refers to Extension singular.

Thanks,

Rod

Hi Rod,

I was wondering whether you managed to solve the above problem.

I'm having a similar problem trying to install asp.net AJAX extensions and have the relevant templates appear in microsoft visual web developer express.

Would love to know in case you found a solution to this issue.

Thanks!!

Einat Schlagmann


For what it's worth, my first attempt to install moments ago, failed after about 5 minutes of disk churning.

I noticed I was running Visual Studio was running, so I shut that down and reinstalled. Then it worked, installed ok and controls are available.

I also noticed though that the "UpdatePanel" control (which allows for "partial page" updates does not allow drag and drop - which it should). Apparently it works in the Beta, which MS uses in the Video, but not in the "final release". You can actually make controls "children" of the updatepanel control using the HTML (source) view but that is tedious and it is not reflected in the "Design mode". I hope I am wrong about this but that's my experience thus far (trying it today).

Just my experience. Good Luck.


hello.

well, it's working on my machine, but i'm using vs 2008...

Trouble using AJAX UpdatePanel with Small Business Starter Kit

Has anyone else had trouble using AJAX 1.0 for ASP.NET 2.0 with the Small Business Starter Kit? I have put a grid control inside an UpdatePanel and when I click the column headers to sort the grid I get a full page refresh and a JavaScript error.

The Fish.

Check out thislist of common problems and solutions

-Damien


Hi,

Thanks for your post.

But how should we solve it if you don't privide any useful information scuh as code or error message?

Regards,

Trouble with Control Toolkit

Hello,

I am using the ASP.NET Ajax Control Toolkit with Visual Web Developer. I am not able to see the controls from the toolkit when I drag and drop. The only way to see the object is to find them in the properties box and adjust properties but not be able actually see them.

It would be appreciated if someone could explain how to install the control toolkit in Visual Web Developer. B/c i feel i have installed in the wrong manner.

Hi,

Everything sounds like it was setup correctly. Most of the components in the Toolkit areExtenderControls which just add new properties to the controls they extend in the designer.

Thanks,
Ted

Thank You that is what I was looking for!


Thanks that was what I was looking for!

True Asynch streams using IE

I created a page in ASP.Net that does the following:
Output line #1
{wait 1 second}
Output line #2
{wait 1 second}
Output line #3
....etc
If I browse to the page, you can see that the response comes back as a STREAM, as it happens. (Note you can only see this the SECOND time the page is loaded in IE)
When I use XmlHttp in IE, the response only comes back when the WHOLE page is done. However, in other browsers, it works as expected. The onreadystatechange raises the event in my JS callback function when the document is complete, but FireFox raises it for each FLUSH, which is the effect I need. I would like to know if anyone else can make IE XmlHttp object do the stream.
Example code: (C#)

privatevoid Page_Load(object sender, System.EventArgs e)
{
Response.ClearContent();
Response.BufferOutput =false;
Response.Write("Output line #1<br/>" + CRLF);
Response.Flush();
System.Threading.Thread.Sleep(1000);

Response.Write("Output line #2<br/>" + CRLF);
Response.Flush();
System.Threading.Thread.Sleep(1000);
//etc..
Techniques I have tried:
1) Asynch Http Module - the module worked, but the client side still did not
2) JavaScript work arounds:
a) Polling
b) Remote Scripting (this works, but must use a GET, and so is not as secure)
c) Timeouts (too many requests)
3) HTA - also works, but only on IE
Any help would be appreciated!

It looks like this problem is with Internet Explorer and not just XmlHttp object
I put an example up onhttp://www.ECMASCRIPT.net/
If you click on the link in Firefox you get the document as it streams.
If you click on the link in IE, it waits until the whole document is done the first time. If you hit refresh on /TimedOutput.aspx you get the same as firefox.

The button simply uses the Xmlhttp object to request the same page and display the result as it get it. It works well in fireFox, but not IE

Is this a header problem? Or did I set up IIS wrong? Can I write my Asp.Net Page any way to fix this?

Any help would be appreciated!

trying to get hover tooltip to work in updatepanel

I use the wz_tooltip.js library for all my tooltips... Works great in regular asp.net pages but I can't get them to work properly in an updatepanel... The tooltips appear on the first pageload but then they are gone once I make an asyncronous post.

The tooltip I use can found below
http://www.walterzorn.com/tooltip/tooltip_e.htm

It looks like I may have to do something with scriptmanager but I'm not sure what

Thanks ahead of time,
Paul

-- bump bump --
anyone??

have you tried using the scriptmanager or toolkit script manager to load the script ?

Two-way data binding problem with Atlas UpdatePanel

I have an existing ASP 2.0 page which utilizes a SQLDataSouce and a FormView with bound controls. The page has a "save" button which saves the contents of the bound controls to the database. It works fine when not using Atlas.

One of the textboxes on the form is a date field. I want to use Atlas and the .Net Calendar control to provide a popup calendar. I implemented the calander based upon some simple example code I found in the Atlas tutorial. The popup works great and the value from the calendar is correctly placed into the target textbox.

The problem I am having is that wrapping the UpdatePanel around the textbox causes it to lose two-way databinding.It correctly displays the initial value from the current database record but, when attempting to do and update the value is always NULL. Does anyone know what I may be missing. Below is the Atlas markup wrapped around the textbox:

Thanks,

Tony

<atlas:updatepanel id="upCallReportDateTime" runat="server" mode="Conditional" rendermode="Inline"
<triggers>
<atlas:controleventtrigger controlid="calDatePicker" eventname="SelectionChanged" />
</triggers>

<contenttemplate>
<asp:textbox id="txtCallReportDateTime" runat="server"
Width="150px"
Text='<%# Bind("CallReportDateTime") %>'
CssClass="EditTextBox"
ontextchanged="txtCallReportDateTime_TextChanged"
autopostback="true"/>
<asp:imagebutton id="cmdPickDate_CallReportDateTime" runat="server"
onclick="cmdPickDate_CallReportDateTime_Click"
imageurl="graphics/calendar.gif"
height="20px"
width="20px"
CausesValidation="false" />
</contenttemplate>
</atlas:updatepanel>

Were you ever able to solve this problem? I am having the exact same problem.

The only way I've solved it so far is to add the missing parameter in the FormView_ItemInserting event.

This works well but it seems like I shouldn't have to do that.

two-way property synching not working...

I have an ajax extender that was created using the AjaxControlToolkit "ASP.Net AJAX Extender Control" wizard. My extender derives from AjaxControlToolkit.ExtenderControlBase.

My class has a bunch of properties that have the ExtenderControlProperty and ClientPropertyName attributes. These properties sync just fine from server to client, but I can't seem to get them to sync from client to server. Using this.set_ClientState("xyz") on the client gives me a value that is readable in the ClientState property on the server, but that is cheating since it uses a hidden input element.

Yes, I call this.raisePropertyChanged("MyValue") in the client JS when the property changes, and I have ensured that raisePropertyChanged is actually be called (via debugger).

Any ideas?

Nobody has any suggestions?