Trying to improve my coding styles I've tried different solutions but I can't figure out what is the best.
I've started putting JavaScript inside my views but I don't particularly like this solution.
It's hard to debug with Visual Studio, and it kinds of pollutes the page.
My new trend is to put the scripts for the page in a separate file.
The only problem I am facing is with the code.
To solve the problem I've defined JavaScript variables like this:
<script type=text/javascript>
var PriceListFetchAction = '<%=Url.Action(Fetch, PriceList)%>';
var UploaderAction = '<%=Url.Action(UploadExcelPriceList, PriceList)%>';
var ModelId = '<%=Model.id%>';
var ImportType = '<%=Model.Type%>';
var customerCodeFetchAction = '<%=Url.Action(FetchByCustomerCode, Customers)%>';
var customerNameFetchAction = '<%=Url.Action(FetchByCustomerName, Customers)%>';
var ImportErpAction = '<%=Url.Action(ImportPriceListErp, PriceList)%>';
var imageCalendar = '<%=Url.Content(~/Content/Images/calendar.png)%>';
</script>
and then I use the variables in my JavaScript file.
What is the best in terms of performance, debugging, style for you?