I have a code that shows some chart. and download some files that their address saved in DB.
I want to download that file if the user clicks on download btn and show my chart if user click on show chart,
this is my code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="id" HeaderText="id" SortExpression="id" />
<asp:BoundField DataField="primaryId" HeaderText="primaryId" SortExpression="primaryId" />
<asp:BoundField DataField="ExFIleName" HeaderText="ExFIleName" SortExpression="Excel filename" />
<asp:TemplateField HeaderText="ExFilePath" SortExpression="ExFilePath">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ExFilePath") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<a class="btn btn-danger" href="<%#DataBinder.Eval(Container.DataItem, "ExFilePath")%>" target="_parent">Download</a>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="SimeFileName" HeaderText="SimeFileName" SortExpression="SimeFileName" />
<asp:TemplateField HeaderText="SimeFilePath" SortExpression="SimeFilePath">
<EditItemTemplate>
</EditItemTemplate>
<ItemTemplate>
<a class="btn btn-success" href="<%#DataBinder.Eval(Container.DataItem, "SimeFilePath")%>" target="_parent">Download</a>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkShowChrt" Text="ShowCharts" CommandArgument='<%# Eval("ExFilePath") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CostThesisConnectionString %>" SelectCommand="SELECT * FROM [Files]"></asp:SqlDataSource>
MonthlyCost.js
var MonthlyCostConfig = {
type: 'bar',
data: {
datasets: [{
barPercentage: 0.5,
backgroundColor: 'rgb(196, 230, 255)',
borderColor: 'transparent',
borderWidth: 1
}]
},
plugins: [ChartDataSource],
options: {
//maintainAspectRatio :false,
legend: { display: true },
title: {
display: true,
text: 'Monthly Cost'
},
scales: {
xAxes: [{
scaleLabel: {
display: true,
labelString: 'Month'
}
}],
yAxes: [{
scaleLabel: {
display: true,
labelString: 'Value'
}
}]
},
plugins: {
datasource: {
type: 'sheet',
url: '',
rowMapping: 'index',
datasetLabels: 'Monthly Cost!B2',
indexLabels: 'Monthly Cost!A3:A',
data: 'Monthly Cost!B3:B'
}
}
}
};
<script>
$(function () {
$('[id*=lnkShowChrt]').on('click', function () {
var ctxMonthCost = document.getElementById('MonthlyCost').getContext('2d');
MonthlyCostConfig.options.plugins.datasource.url = "./Uploads/" + $(this).closest('tr').find('td').eq(0).html();
window.MonthlyCost = new Chart(ctxMonthCost, MonthlyCostConfig);
return false;
});
});
</script>
DB:
![](http://s5.picofile.com/file/8396540842/22.PNG)
But my code didn't do any of that.
How can I do them?!