Click here to Skip to main content
16,008,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

How to call the javascript function from the handler.ashx file.

i have used the below code for call the javascript function. but i am getting an error.

ScriptManager.RegisterStartupScript(this, this.GetType(), "MyMethod", "MyMethod();", true);
Posted

What is the error you're getting ? Did you read it ?

An ASHX file is a file handler, it's used to return things like images and so on. As it does not typically return a web page ( that's what aspx pages do ), how do you expect to return javascript, and where do you expect it to go ?
 
Share this answer
 
XML
<form id="myForm" action="ReportHandler.ashx">

    <input type="hidden" value="" id="reportFormat"/>
</form>

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    function ActionVendor() {
        var combo = $find("<%= cmbActions.ClientID %>");


        switch (combo.get_value()) {
            case "1":
                ShowPopup('rwVendorCreditCheck', '../../ProcureCheckReports/TransUnionCostingInformation.aspx');
                break;
            case "2":
                $('#selectionType').val(combo);
                $('#myForm').submit();
                break;
            case "3":
                var url = '../../Resources/ExcelImportSamples/Vendor_Import.xls';
                location.href = url;
                break;
    }
 
Share this answer
 
Comments
CHill60 29-May-13 11:44am    
Why are you posting solutions to questions that were answered over a year ago?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900