Thursday 26 February 2015

MS Chart set dynamically Legends using asp.net C#


//Html

<asp:Chart ID="Chart2" runat="server" style=" min-width:99%; display:none;"  onmouseover="return hidedownloadchart('ch2d','ch1d','ch3d');" >
            <Series>  
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </ChartAreas>
             <Legends>
            <asp:Legend TextWrapThreshold="200" font ="11px"></asp:Legend>
            </Legends>
        </asp:Chart>

//Legends

System.Web.UI.DataVisualization.Charting.Legend legend = new System.Web.UI.DataVisualization.Charting.Legend();
        legend.BackColor = System.Drawing.Color.Transparent;
        legend.Enabled = false;
        legend.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
        legend.IsTextAutoFit = false;
        legend.Name = "Default";

MS Chart 3D Configuration in asp.net C#

//HTML

<asp:Chart ID="Chart2" runat="server" style="min-width:99%; display:none;"  onmouseover="return hidedownloadchart('ch2d','ch1d','ch3d');" >
            <Series>  
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </ChartAreas>
             <Legends>
            <asp:Legend TextWrapThreshold="200" font ="11px"></asp:Legend>
            </Legends>
        </asp:Chart>


//ChartArea

System.Web.UI.DataVisualization.Charting.ChartArea chartArea1 = new System.Web.UI.DataVisualization.Charting.ChartArea();
        chartArea1.Area3DStyle.IsClustered = true;
        chartArea1.Area3DStyle.IsRightAngleAxes = false;
        chartArea1.Area3DStyle.PointGapDepth = 900;
        chartArea1.Area3DStyle.Rotation = 162;
        chartArea1.Area3DStyle.WallWidth = 25;
        chartArea1.AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
        chartArea1.AxisX.LineColor = System.Drawing.Color.Teal;
        chartArea1.AxisX.MajorGrid.Enabled = false;
        chartArea1.AxisX.MajorGrid.LineColor = System.Drawing.Color.Teal;
        chartArea1.AxisX.MajorTickMark.Enabled = false;
        chartArea1.AxisX2.MajorGrid.Enabled = false;
        chartArea1.AxisX2.MajorTickMark.Enabled = false;
        chartArea1.AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
        chartArea1.AxisY.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
        chartArea1.AxisY.MajorGrid.Enabled = false;
        chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Teal;
        chartArea1.AxisY.MajorTickMark.Enabled = false;
        chartArea1.AxisY2.MajorGrid.Enabled = false;
        chartArea1.AxisY2.MajorTickMark.Enabled = false;
        chartArea1.BackColor = System.Drawing.Color.Transparent;
        chartArea1.BackGradientStyle = System.Web.UI.DataVisualization.Charting.GradientStyle.TopBottom;
        chartArea1.BackSecondaryColor = System.Drawing.Color.Transparent;
        chartArea1.BorderColor = System.Drawing.Color.Teal;
        chartArea1.Name = "Area1";
        chartArea1.ShadowColor = System.Drawing.Color.Gainsboro;

Thursday 19 February 2015

Select De-Select all nodes of the Treeview in asp.net using jquery




//html

<asp:TreeView ID="TreeView1" ShowCheckBoxes="All" runat="server" NodeIndent="15"   >
                            <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
                            <NodeStyle Font-Names="Arial" Font-Size="9pt" ForeColor="Black" HorizontalPadding="1px"
                                NodeSpacing="0px" VerticalPadding="1px" ></NodeStyle>
                            <ParentNodeStyle Font-Bold="False" />

                        </asp:TreeView>

<script>

Sys.Application.add_load(jScript);
                function jScript() {
                    $("[id*=TreeView1] input[type=checkbox]").bind("click", function () {
                        var table = $(this).closest("table");
                        if (table.next().length > 0 && table.next()[0].tagName == "DIV") {
                            //Is Parent CheckBox
                            var childDiv = table.next();
                            var isChecked = $(this).is(":checked");
                            $("input[type=checkbox]", childDiv).each(function () {
                                if (isChecked) {
                                    $(this).attr("checked", "checked");
                                } else {
                                    $(this).removeAttr("checked");
                                }
                            });
                        } else {
                            //Is Child CheckBox
                            var parentDIV = $(this).closest("DIV");
                            if ($("input[type=checkbox]", parentDIV).length == $("input[type=checkbox]:checked", parentDIV).length) {
                                $("input[type=checkbox]", parentDIV.prev()).attr("checked", "checked");
                            } else {
                                $("input[type=checkbox]", parentDIV.prev()).removeAttr("checked");
                            }
                        }
                    });

                }
</script>

//result


Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...