[CLOSED] Problem with DirectMethod and ActiveX (MS Chart)

  1. #1

    [CLOSED] Problem with DirectMethod and ActiveX (MS Chart)

    Master Page:
    <%@ Register assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
    
    <script type="text/javascript">
    var ResizeChart = function(panel){
      var h = panel.getBody().getViewSize().height;
      var w = panel.getBody().getViewSize().width;
      Ext.net.DirectMethods.UC_TrendingChart.DM_ResizeChart(w,h);
    }
    </script>
    
    <ext:Panel ID="Panel1" runat="server" Border="false" ButtonAlign="Right">
        <Content>
            <asp:Chart ID="Chart1" runat="server" Height="300px" Width="600px" EnableViewState="true"></asp:Chart>
        </Content>
    </ext:Panel>

    Code Behind: This works but the size of the chart is hardcoded (represented by 1000 and 700)
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!X.IsAjaxRequest)
                {
                    ShowChart(1000, 700); //This creates the MS chart ActiveX
                }
            }
    Code Behind: My objective is for the first load to call a javascript to run and get the rendered panel size, then use DirectMethod to load the ActiveX with the panel size. But somehow, this fails to render.
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!X.IsAjaxRequest)
                {
                    X.Js.Call("ResizeChart", new JRawValue(this.Panel1.ClientID));
                }
            }
    
            [DirectMethod(ShowMask = true, Msg = "Resizing Chart...")]
            public void DM_ResizeChart(int width, int height)
            {
                ShowChart(width, height); //This creates the MS chart ActiveX
            }
    My goal is to load the activex chart everytime the button is clicked, wherein the chart will change depending on given parameters.

    Question:
    (1) Does this mean that DirectMethod cannot change the controls in the client?
    (2) This page is a UserControl and part of a bigger page, can you advice a way for me to reload, if needed, this whole UserControl into the existing Ext.Panel?
    Last edited by Daniil; Sep 26, 2011 at 7:56 AM. Reason: [CLOSED]
  2. #2
    Quote Originally Posted by ihis_dev_centre View Post
    (1) Does this mean that DirectMethod cannot change the controls in the client?
    Certainly, DirectMethod can change the controls on the client.

    Quote Originally Posted by ihis_dev_centre View Post
    (2) This page is a UserControl and part of a bigger page, can you advice a way for me to reload, if needed, this whole UserControl into the existing Ext.Panel?
    To update contents you need to call .UpdateContent().
    https://examples1.ext.net/#/XRender/...UpdateContent/

    As well, you can call the DirectMethod at first time in an AfterRender listener of the panel with a chart.
  3. #3
    Hi,

    An Ext.NET DirectEvent/DirectMethod will not automatically update non-Ext.NET Controls.

    For non-Ext.NET Controls, you'll need to manually call .Render() on the Control you wish to update during the DirectEvent/DirectMethod.

    As far as I know, <asp:Chart> are not ActiveX components. Just plain old image files are rendered to the browser.
    Geoffrey McGill
    Founder
  4. #4
    Thanks Daniil & Geoffrey,

    Managed to resolved this issue and thank you for the pointeds. I also encountered the same undefined error, which was resolved by adding IDMode="Explicit" as suggested from another ticket.

    Regards, J

Similar Threads

  1. Problem with Ext.Net Chart - Column
    By OCaglayan in forum 2.x Help
    Replies: 1
    Last Post: Jul 31, 2012, 12:43 PM
  2. This is a bug?Chart problem···
    By jiaxiang8756 in forum 2.x Help
    Replies: 4
    Last Post: Jul 17, 2012, 7:14 PM
  3. Replies: 7
    Last Post: May 17, 2012, 4:31 PM
  4. [CLOSED] Problem with chart controls and coolite
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 12, 2012, 4:12 PM
  5. ActiveX Problem
    By simonmicheal in forum 1.x Help
    Replies: 3
    Last Post: Sep 16, 2009, 2:17 PM

Posting Permissions