1

Hii i have created a Google Chart and i want to add href tag on the hierarchy data.By Clicking on the particular person,i want to Redirect to a particular user.This is my Code Below,Plz tell me how should i achieve that.

<script type="text/javascript">
    google.load("visualization", "1", { packages: ["orgchart"] });
    google.setOnLoadCallback(drawChart);
    function drawChart() {
        $.ajax({
            type: "POST",
            url: '<%=ResolveUrl("~/User/WebForm2.aspx/GetHierachy") %>',
            //url: "WebForm2.aspx/GetHierachy",
            data: "{'empno':'<%= empno%>'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (r) {
                var data = new google.visualization.DataTable();
                debugger;
                data.addColumn('string', 'Entity');
                data.addColumn('string', 'ParentEntity');
                data.addColumn('string', 'ToolTip');
                for (var i = 0; i < r.d.length; i++) {
                    var empno = r.d[i].toString();
                    //var firstName = r.d[i];
                    //var lastName = r.d[i];
                    data.addRows([
          [{ v: '<%= empno %>'+'-'+'<%=Name%>', f: '<%= empno %>'+'-'+'<%=Name%>' },
           '',''],
          [{ v: empno, f: empno+'' },
           '<%= empno %>' +'-'+ '<%=Name%>','']
                    ]);
                    //var appraiser = r.d[i][3] != null ? r.d[i][3].toString() : '';
                    //data.addRows([[{
                    //    v: empno,
                    //    //f: employeeName + '<div>(<span>' + designation + '</span>)</div><img src = "Pictures/' + employeeId + '.jpg" />'
                    //    f: firstName + '<div>(<span>' + lastName + '</span>)</div>/>'
                    //}, firstName, lastName]]);
                }
                var chart = new google.visualization.OrgChart($("#chart")[0]);
                chart.draw(data, { allowHtml: true });
            },
            failure: function (r) {
                alert(r.d);
            },
            error: function (r) {
                alert(r.d);
            }
        });
    }
</script>
<div id="chart">
</div>
WhiteHat
  • 59,912
  • 7
  • 51
  • 133
Dilto.Wilson
  • 41
  • 1
  • 6
  • check [this answer](http://stackoverflow.com/a/38807797/5090771)... – WhiteHat Nov 02 '16 at 19:47
  • Perfect..!!!Thanx Alot – Dilto.Wilson Nov 03 '16 at 12:43
  • Hi,I have a page where in i am using Calendar control and i am showing the events created,& making them red color in background, and on click of calendar date i am redirecting to a new page. So..what i want to do is i want to check if there is calendar event created for that date and show the records created on that day in another page.. but m not getting how should i check if there is event created for the date? please help.. – Dilto.Wilson Nov 11 '16 at 09:40
  • not sure where to start, it would be helpful to see the code -- on the calendar chart, listen for the `'select'` event, use the `getSelection` method to get the data table row number(s) of the date selected -- [here is an example of the `'select'` event](http://stackoverflow.com/a/37990962/5090771) – WhiteHat Nov 11 '16 at 15:51

0 Answers0