简体   繁体   English

ShieldUI将不接受更新的属性

[英]ShieldUI will not accept updated attributes

I have the following code: 我有以下代码:

protected void SetChartToItem(Item item)
    {
        ShieldChart1 = new ShieldChart();
        ShieldChart1.Width = Unit.Percentage(100);
        ShieldChart1.Height = Unit.Pixel(400);
        ShieldChart1.CssClass = "chart";
        ShieldChart1.PrimaryHeader.Text = item.name;
        ShieldChart1.TooltipSettings.AxisMarkers.Enabled = true;
        ShieldChart1.TooltipSettings.AxisMarkers.Mode = ChartXYMode.XY;
        ShieldChart1.TooltipSettings.AxisMarkers.Width = new Unit(1);
        ShieldChart1.TooltipSettings.AxisMarkers.ZIndex = 3;
        ChartAxisX axisX = new ChartAxisX();
        axisX.Title.Text = "Times";
        ShieldChart1.Axes.Add(axisX);
        ChartAxisY axisY = new ChartAxisY();
        axisY.Title.Text = "Prices";
        ShieldChart1.Axes.Add(axisY);
        ShieldChart1.Axes.SetDirty();
}

And the following code: 和以下代码:

<shield:ShieldChart ID="ShieldChart1" Width="700px" Height="380px" runat="server" OnTakeDataSource="ShieldChart1_TakeDataSource" CssClass="chart">
        <PrimaryHeader Text="TestHeader"></PrimaryHeader>
        <ExportOptions AllowExportToImage="true" AllowPrint="false" />
        <Axes>
            <shield:ChartAxisX>
                <Title Text="Time"></Title>
            </shield:ChartAxisX>
            <shield:ChartAxisY>
                <Title Text="Price"></Title>
            </shield:ChartAxisY>
        </Axes>
        <DataSeries>
            <shield:ChartLineSeries DataFieldY="Volume" DataFieldX="Timer" CollectionAlias="Volume">
                <Settings EnablePointSelection="true">
                    <PointMark>
                        <ActiveSettings>
                            <PointSelectedState DrawWidth="4" DrawRadius="4" />
                        </ActiveSettings>
                    </PointMark>
                </Settings>
            </shield:ChartLineSeries>
            <shield:ChartLineSeries DataFieldY="Price" DataFieldX="Timer" CollectionAlias="Price">
                <Settings EnablePointSelection="true">
                    <PointMark>
                        <ActiveSettings>
                            <PointSelectedState DrawWidth="4" DrawRadius="4" />
                        </ActiveSettings>
                    </PointMark>
                </Settings>
            </shield:ChartLineSeries>
        </DataSeries>
    </shield:ShieldChart>

When I call SetChartToItem, it looks like it works when I watch it go through step by step, but when the page renders there are no changes to the actual ShieldChart. 当我调用SetChartToItem时,当我逐步查看SetChartToItem时,它似乎可以工作,但是当页面呈现时,实际的ShieldChart并没有更改。 More information that might help is when I remove the line ShieldChart1 = new ShieldChart(); 当我删除ShieldChart1 = new ShieldChart();行时,可能会有更多帮助。 then the entire ShieldChart will disappear instead. 那么整个ShieldChart将会消失。

I believe there are two ways to try and address this. 我相信有两种方法可以解决这个问题。 One would be to recreate the chart, as demonstrated in this sample: https://demos.shieldui.com/aspnet/rangebar-chart/related-charts You can check out the asp.net tab. 如本示例所示,一种方法是重新创建图表: https : //demos.shieldui.com/aspnet/rangebar-chart/related-charts您可以签出asp.net选项卡。

Another alternative would be to recreate the controls collection (and clear it before this) in a nested panel, which hosts the chart. 另一种选择是在承载图表的嵌套面板中重新创建控件集合(并在此之前清除它)。 Then, on a specific event, you can recreate the chart, clear the controls collection of the container and add the new instance. 然后,在特定事件上,您可以重新创建图表,清除容器的控件集合并添加新实例。

It took me 3 months, but I figured out what the problem was. 我花了3个月的时间,但我发现了问题所在。 I was causing some of the chart to build itself in the 'Page_Load' function. 我导致某些图表在“ Page_Load”函数中自行构建。 The solution to this was to make sure everyone was done only if the page is a postback page, which is not included in my code above but fixed the issue for me. 解决方案是确保仅当该页面是回发页面时才完成所有工作,该页面未包含在上面的代码中,但为我解决了该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何知道xml文件中的更新属性 - How to know the updated attributes in an xml file Asp.Net数据属性通过JS / jQuery动态更新,但通过后面的代码检索时更新的属性不会更新 - Asp.Net data attributes dynamically updated through JS/jQuery but the updated attributes aren't updated when retrieved through code behind ShieldUI缓存应用程序数据以供浏览器访问 - ShieldUI Caching application data for browser access 更新的 listitem 属性未提交对 sharepoint 的更改 - updated listitem attributes aren't commiting changes to sharepoint 没有使用相应的XSD默认属性更新C#XmlDocument - C# XmlDocument is not being updated with respective XSD default attributes ASP.NET Core C# 中 ShieldUI 组件的代码示例 - Code examples for ShieldUI components in ASP.NET Core C# 使用Entity Framework 6属性,存储行创建日期和上次更新日期 - Using Entity Framework 6 attributes, store row creation date and last updated date 如何使WebAPI在不使用C#属性的情况下接受复杂对象作为DELETE HTTP动词的参数? - How do I get WebAPI to accept a complex object as its argument for a DELETE HTTP verb without using C# attributes? 实现其他属性的属性 - Attributes that implement other attributes ObservableCollection未更新 - ObservableCollection is not updated
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM