Showing posts with label source. Show all posts
Showing posts with label source. Show all posts

Wednesday, March 28, 2012

Did I miss something during installation of AJAX 1.0v?

Hi everyone;

I'm using VS2005 and I've just installed AJAX and it works but in the source view it underlines Script Manager, UpdatePanel, contenttemplate and controls under contenttemplate. I guess I missed something that I don't know:) My simple page code is belove:

Thanks... Kaan ?ZGEN

<%

@dotnet.itags.org.PageLanguage="VB"MasterPageFile="~/Copy of Turuncu.master"AutoEventWireup="false"CodeFile="DNM2.aspx.vb"Inherits="DNM2"title="Untitled Page" %>

<%

@dotnet.itags.org.RegisterSrc="Menu.ascx"TagName="Menu"TagPrefix="uc1" %>

<

asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server"><asp:ScriptManagerid="ScriptManager1"runat="server"/>

<asp:UpdatePanelid="UpdatePanel1"runat="server"UpdateMode="Conditional"><contenttemplate><asp:Labelid="Label1"runat="server"Text="Label"></asp:Label><asp:Buttonid="Button1"runat="server"Text="Button"></asp:Button></contenttemplate></asp:UpdatePanel> <asp:LabelID="Label2"runat="server"Text="Label"></asp:Label><asp:LoginID="Login1"runat="server"></asp:Login><uc1:MenuID="Menu1"runat="server"/>

</

asp:Content>Have you installed SP1 for VS 2005? That can happen if you haven't.

Is there such service pack?? Thanks I didn't know it... :) I'll try and let you know if solved..

Kaan ?ZGEN


Hi mdenn;

Yes that was the problem; now because of you (sayende) I got SP1 and my problem is solved

Thanks..

Kaan ?ZGEN

Monday, March 26, 2012

Determining the source of a partial rendering postback

Is there a way to determine (on the server) what trigger/control/event was the source of the postback? How about something that indicates what update panel(s) will be rendered?

I see that the script manager has an IsInAsyncPostBack property, but I'm curious if there is something more specific.

UpdatePanel.IsInPartialRendering does not seem to work.

You could check the _EventTarget for a hint on what triggered the PostBack.

What would you do differently if you knew what triggered the PostBack?


You could use the ScriptManager.AsyncPostBackSourceElementID to determine the source of the asynchronous postback. In terms of what UpdatePanels will get updated, in server code I don't think there is a summary list that lists them because the Update() method can be called by any code and tracking that is difficult if not impossible(?). However, on the client you can use the pageLoaded or pageLoading events of the PageRequestManager to get information about what panels will be created, updated or deleted.

Design time problem when put my control in UpdatePanel

I put my viewer control into an UpdatePanel control, then use smart tag to create a source control and bind to the source control by specifying the source control ID. I use IComponentChangeService to add and remove the event handlers for events that add, change, remove or rename components. I can see the source control is Added, and my viewer control is Updated. But then I find all controls in UpdatePanel are Removed, and Added again. At last the UpdatePanel control is Updated. I expect the UpdatePanel should not remove and add again all its controls. Do you know why? And what's wrong with my control? Thanks!

Here is the call stack when its controls are removed:

System.Design.dll!System.ComponentModel.Design.DesignerHost.RemoveFromContainerPreProcess(System.ComponentModel.IComponent component = {CrystalDecisions.Web.CrystalReportSource}, System.ComponentModel.IContainer container) + 0x88 bytes
System.Design.dll!System.ComponentModel.Design.DesignerHost.Remove(System.ComponentModel.IComponent component = {CrystalDecisions.Web.CrystalReportSource}) + 0x11 bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.IntrinsicElementDesigner.Destroy() + 0x57 bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.ElementDesigner.Destroy() + 0x25 bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.IntrinsicElementDesigner.Microsoft.Web.Design.Interop.IWebIntrinsicElementDesigner.Destroy() + 0x5 bytes
[Native to Managed Transition]
[Managed to Native Transition]
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.ElementDesigner.UpdateView(bool fSaveRegions) + 0x4be bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.ElementDesigner.System.Web.UI.Design.IControlDesignerView.Update() + 0xa bytes
System.Design.dll!System.Web.UI.Design.ControlDesigner.UpdateDesignTimeHtml() + 0x38 bytes
System.Design.dll!System.Web.UI.Design.ControlDesigner.OnComponentChanged(object sender, System.ComponentModel.Design.ComponentChangedEventArgs ce) + 0x559 bytes
> System.Web.Extensions.Design.dll!System.Web.UI.Design.UpdatePanelDesigner.OnComponentChanged(object sender, System.ComponentModel.Design.ComponentChangedEventArgs ce) + 0x13 bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.DocumentDesigner.OnComponentChanged(object sender, System.ComponentModel.Design.ComponentChangedEventArgs ce = {System.ComponentModel.Design.ComponentChangedEventArgs}) + 0x70 bytes
[Native to Managed Transition]
[Managed to Native Transition]
System.Design.dll!System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IComponentChangeService.OnComponentChanged(object component, System.ComponentModel.MemberDescriptor member, object oldValue, object newValue) + 0x76 bytes
System.dll!System.ComponentModel.ReflectPropertyDescriptor.SetValue(object component = {System.Web.UI.UpdatePanel}, object value = {System.Web.UI.FileLevelPageControlBuilder}) + 0x196 bytes
System.Web.Extensions.Design.dll!System.Web.UI.Design.UpdatePanelDesigner.SetEditableDesignerRegionContent(System.Web.UI.Design.EditableDesignerRegion region, string content) + 0x6e bytes
System.Design.dll!System.Web.UI.Design.EditableDesignerRegion.Content.set(string value) + 0x11 bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.ElementDesigner.Microsoft.Web.Design.Interop.IWebElementDesigner.SetEditableRegionContent(int indexRegion, string content) + 0x52 bytes
[Native to Managed Transition]

Does anyone know in what kind of conditions there will be a complete remove all and re-add all controls of an UpdatePanel?

And why Microsoft.Web.Design.Interop.IWebIntrinsicElementDesigner.Destroy() is called in the process of UpdatePanelDesigner.OnComponentChanged?

Thanks!

Saturday, March 24, 2012

Deploying Styles with your controls

I have found a way of deploying styles for an ajax control which I thought might be useful to others. I found this while examining the source code of the AjaxControlToolkit which is available as an open source project. you will need a reference to this assembly in order to use this method. These are the steps to be taken.

1.Include your css file in your controls project, set it as an embeded resource and and an assembly attribute for your control refrencing said css file. If you don't know how to do this google for it, a million people have posted on this subject.

[assembly:WebResource("MyControls.Web.Controls.DropDown.DropDown.css","text/css", PerformSubstitution =true)]

2. add the ClientCssResource to your class

[ClientCssResource("MyControls.Web.Controls.DropDown.DropDown.css")]

3. In your Prerender method for your control call the RegisterCssReference method of the static class ScriptObjectBuilder which is part of the AjaxControlToolkit

ScriptObjectBuilder.RegisterCssReferences(this);

This ScriptObjectBuilder class is an interesting class, it looks like it keeps a cached set of refrences to the css files included so as not to included them more than once. It adds the list of css refrences it has compiles as link tags to the <HEAD> of your page. Make sure your <HEAD> has runat="server" set. If you need a more complete example of how this is used , you might read the cs source code for the DropDownExtender in the toolkit.

Thanks fbaldoni!

I have been searching a half day to get this to work. This only part I had missing was step 3. Where in the AJAX documentation can I find that? No where. I just happen to stumble upon your post.


Glad to be of serviceSmile