admin管理员组

文章数量:1291174

I am trying to use jquery or jscript to click a hidden button and I always get "Microsoft JScript runtime error: Object expected" error.

I have tried all of the following (all with the same results):

$('#btnCompleteHidden').click();or:
$('#btnCompleteHidden').trigger('click');With plain JavaScript:
document.getElementById('btnCompleteHidden').onclick();
$('#<%=btnCompleteHidden.ClientID %>').click();Or:
document.getElementById('<%=btnCompleteHidden.ClientID %>').click();

I have tried making the button visible and still the same results.

I will post the aspx page here:

    <script type="text/javascript">
        function FileDownloader_DownloadStep(Step){
        //The file list is going to be downloaded - "2 = About to Start" 
        if (Step == 2){
            //Dynamically build the filelist for the downloader
            getFileDownloader("FileDownloader").setFileList("GetFileList.aspx");
        }
        //The user has confirmed the download - "6 = File Download About to Start"
        if (Step == 6){
            //Perform the initialization updates to the first file only
            var xmlhttp; 
            if (typeof XMLHttpRequest != 'undefined') { 
                xmlhttp = new XMLHttpRequest(); 
            } 
            if (!xmlhttp) { 
                throw "Browser doesn't support XMLHttpRequest."; 
            } 
            var data = ""; 
            xmlhttp.open("POST", "UpdateVideoInitiated.aspx", true); 
            //Send the proper header information along with the request 
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
             //xmlhttp.setRequestHeader("Content-length", data.length); 
            xmlhttp.setRequestHeader("Connection", "close"); 
            xmlhttp.send(data); 
        }
    }
        function onDownloadItemComplete(Result, ErrorPage, Url, FileName, ContentType, FileSize){
            var xmlhttp;
            var data;

            //The handler will display the error description or updates as noted
            switch (Result){
                        //Update the pleted file as plete and then perform initialization updates to the next file only
                case 1: if (typeof XMLHttpRequest != 'undefined') { 
                            xmlhttp = new XMLHttpRequest(); 
                        } 
                        if (!xmlhttp) { 
                            throw "Browser doesn't support XMLHttpRequest."; 
                        } 
                        data = FileName; 
                        xmlhttp.open("POST", "UpdateVideoDownloaded.aspx?FileName=" + FileName + "&FileSize=" + FileSize, true); 
                        //Send the proper header information along with the request 
                        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
                         //xmlhttp.setRequestHeader("Content-length", data.length); 
                        xmlhttp.setRequestHeader("Connection", "close"); 
                        xmlhttp.send(data); 
                        break;
                case 2: alert("An error has occurred while downloading the file " + FileName);
                        break;
                        //Update any skipped files to back off the initialization updates to the passed file only
                case 3: if (typeof XMLHttpRequest != 'undefined') { 
                            xmlhttp = new XMLHttpRequest(); 
                        } 
                        if (!xmlhttp) { 
                            throw "Browser doesn't support XMLHttpRequest."; 
                        } 
                        data = FileName; 
                        xmlhttp.open("POST", "UpdateVideoSkipped.aspx?FileName=" + FileName, true); 
                        //Send the proper header information along with the request 
                        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
                         //xmlhttp.setRequestHeader("Content-length", data.length); 
                        xmlhttp.setRequestHeader("Connection", "close"); 
                        xmlhttp.send(data); 
                        break;        
                case 4: alert("The server returned a wrong MIME type (should be " + ContentType + ") for the file " + FileName);
                        break;
                case 5: alert("The server returned a wrong size (should be " + FileSize + ") for the file " + FileName);
                        break;
                case 6: alert("An error has occurred while writing the file " + FileName + " to disk");
                        break;
                case 7: alert("The file " + FileName + " could not be found on the " + "server");
                        break;
                case 8: alert("Access to the file " + FileName + " denied");
                        break;
                case 9: alert("Time out while downloading the file " + FileName);
                        break;
            }
        }
        function onDownloadComplete(Result){
            //The handler will display the error description
            switch (Result){
                        //Update the member download statistics and rebind the grid 
                case 0: $('#btnCompleteHidden').click();
                        break;
                case 1: alert("An error has occurred while creating the file list");
                        break;        
                case 2: alert("An error has occurred while downloading the file list");
                        break;
                case 3: alert("The file list is empty");
                        break;
                case 7: alert("The file list could not be found on the server");
                        break;
                case 8: alert("Access to the file list denied");
                        break;
                case 9: alert("Time out while downloading the file list");
                        break;
            }
        }
</script>

<div class="borderDiv">
     <table cellspacing="0" class="borderTable0" width="100%">
         <tr>
            <td class="Subhdr" >
                <asp:label id="lblScreenHeader" Cssclass="ScreenHdr" runat="server" Height="24px">Member Video Download Detail</asp:label>
            </td>
        </tr>
    </table>
    <div class="NinetyNine5PercentWide SolidThreePixelBorder" style="background-color:White">
        <div class="OneHundredPercentWide EightPixelTopMargin TenPixelBottomMargin">
            <div class="FileListHdr">
                &nbsp;&nbsp;&nbsp;&nbsp;
                <span>Current Escrow Balance (Available for Future Use):</span>
                &nbsp;&nbsp;
                <asp:label ID="lblAvailableBalance" Cssclass="FileListHdr" runat="server" >$280.00</asp:label>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <asp:label ID="lblAvailableBalanceMessage" Cssclass="FileListHdr" runat="server" ></asp:label>
            </div>
        </div>
        <div class="NinetyNinePercentWide">
            <div class="FileListHdr EightPixelBottomMargin">
                &nbsp;&nbsp;&nbsp;&nbsp;
                <span class="FileListHdr" >Number of Files Selected for Download:</span>
                &nbsp;
                <asp:label ID="lblTotalFiles" Cssclass="FileListHdr" runat="server" ></asp:label>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <span class="FileListHdr" >Total MBytes:</span>
                &nbsp;
                <asp:label ID="lblTotalMBytes" Cssclass="FileListHdr" runat="server" ></asp:label>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <span class="FileListHdr" >Estmated Download Time:</span>
                &nbsp;
                <asp:label ID="lblEstimatedTime" Cssclass="FileListHdr" runat="server" ></asp:label>
                <asp:Button id="btnCompleteHidden" runat="server" Text="CH" Style="visibility: hidden"
                    Enabled="true" OnClick="btnCompleteHidden_OnClick"></asp:Button>
            </div> 
        </div>
        <div class="NinetyNinePercentWide">
            <div class="OneHundredPercentWide">
                <div class="DivDownload" >
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <script type="text/javascript">
                        //Create JavaScript object that will embed File Downloader to the page
                        var fd = new FileDownloaderWriter("FileDownloader", 170, 28);

                        //For ActiveX control full path to CAB file (including file name) should be specified
                        fd.activeXControlCodeBase = "aurigma/FileDownloader2.cab";
                        fd.activeXControlVersion = "2,0,16,0";

                        //Set the Download button text
                        fd.addParam("ButtonDownloadText", "DOWNLOAD NOW");

                        //Set the Download button background color
                        //fd.addParam("BackgroundColor", "#E0EBFF");
                        fd.addParam("BackgroundColor", "White");

                        //Set the Download button regular image
                        fd.addParam("ButtonDownloadImageFormat", "width=170;height=28;BackgroundColor=White;" + 
                            "urlNormal=App_Themes/Default/images/BtnDownload.jpg;" +
                            "urlHover=App_Themes/Default/images/BtnHover.jpg;" +
                            "urlPressed=App_Themes/Default/images/BtnPressed.jpg;" +
                            "urlDisabled=App_Themes/Default/images/BtnPressed.jpg");

                        //Set license key 
                        fd.addParam("LicenseKey", "73020-10000-D8066-8CFDB-84249");

                        //Set reconnect attampts count
                        fd.addParam("ReconnectAttemptsCount", "360");

                        //Set reconnect timeout value (30000 = 10 seconds)
                        fd.addParam("ReconnectTimeOut", "10000");

                        //The following listener will perform some actions when the file list is about to be downloaded
                        fd.addEventListener("DownloadStep", "FileDownloader_DownloadStep");

                        //The following listener will perform some actions when download of a single file is finished
                        fd.addEventListener("DownloadItemComplete", "onDownloadItemComplete");

                        //The following listener will perform some actions when download process is plete
                        fd.addEventListener("DownloadComplete", "onDownloadComplete");

                        //The following listener will perform some actions when a general error is detected
                        //fd.addEventListener("Error", "onError");

                        //Add page load listener
                        //fd.fullPageLoadListenerName = "fullPageLoad";

                        //Set instructions property
                        fd.instructionsEnabled = true;

                        //Tell File Downloader writer object to generate all necessary HTML code to embed File Downloader into the page
                        fd.writeHtml();
                    </script>
                 </div> 
                 <div class="FileListHdr">
                    <asp:RadioButtonList id="rblMemberMachine" runat="server" Font-Bold="True" BackColor="White" ToolTip="Please select machine for downloading" 
                            CssClass="Radio FileListHdr" RepeatDirection="Horizontal" textAlign="right" BorderStyle="None"
                            AutoPostBack="True" OnSelectedIndexChanged="rblMemberMachine_SelectedIndexChanged" >
                            <asp:ListItem Text="Machine 1" Value="1" Selected="True"></asp:ListItem>
                            <asp:ListItem Text="Machine 2" Value="2"></asp:ListItem>
                            <asp:ListItem Text="Machine 3" Value="3"></asp:ListItem>
                    </asp:RadioButtonList>
                 </div>
             </div>
          </div>
       </div>
    <div class="OneHundredPercentWide" >
        <asp:Panel ID="Panel1" runat="server" Width="100%" >
            <asp:GridView id="grvSessionOrderDownloads" runat="server" BorderWidth="2px" BorderStyle="Solid" BorderColor="#C0C0FF"
                Font-Names="Arial" Font-Bold="True" Font-Size="8pt" GridLines="Horizontal" AutoGenerateColumns="False" 
                HorizontalAlign="Left" ForeColor="Blue" CellPadding="2" AllowSorting="True" Width="100%"
                OnRowDataBound="grvSessionOrderDownloads_OnRowDataBound" >

                <HeaderStyle Font-Names="Arial" HorizontalAlign="Center" ForeColor="White" BackColor="#152EE5" 
                    CssClass="sessionOrderDownloadHeaders" Font-Size="Medium" />
                <RowStyle BackColor="White" ForeColor="#333333" />
                <AlternatingRowStyle BackColor="#A5B0FF" />

                <Columns>
                    <asp:BoundField Visible="False" DataField="SORD_ID" HeaderStyle-Width="0px" >
                        <HeaderStyle Width="0px" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderStyle-Width="0px" >
                        <ItemTemplate>
                            <asp:CheckBox Visible="False" Enabled="false" ID="HiddenCheckBox" runat="server"
                                 Checked='<%# Eval("SORD_SelectedForDownloadFlag") %>' />
                        </ItemTemplate>
                        <HeaderStyle Width="0px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Select Files" HeaderStyle-ForeColor="White" > 
                        <ItemTemplate >
                            &nbsp;&nbsp;&nbsp;
                            <asp:ImageButton id="btnSelectVideo" runat="server" CommandArgument='<%# Eval("SORD_ID") %>' 
                                 CommandName="CheckUncheckVideo" ImageUrl='<%# GetCheckboxImage(Container.DataItem) %>' 
                                 Enabled='<%# Eval("SORD_EnableSelectionCheckBox") %>'
                                 Visible='<%# Eval("SORD_EnableSelectionCheckBox") %>'/>
                        </ItemTemplate>
                        <HeaderStyle Width="4%" />
                        <ItemStyle VerticalAlign="Bottom" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="SORD_OSTA_ID" ReadOnly="True" HeaderStyle-ForeColor="White"
                        HeaderText="Status">
                        <HeaderStyle Width="6%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>
                    <asp:BoundField DataField="SORD_Topic" ReadOnly="True" HeaderStyle-ForeColor="White"
                        HeaderText="General <br /> Topic" HtmlEncode="false" >
                        <HeaderStyle Width="15%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>
                    <asp:BoundField DataField="SORD_Session" ReadOnly="True" HeaderStyle-ForeColor="White"
                        HeaderText="Session <br /> YYMMDD" HtmlEncode="false" DataFormatString="{0:00-00-00}" >
                        <HeaderStyle Width="6%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>
                    <asp:BoundField DataField="SORD_FileExtension" ReadOnly="True" HeaderStyle-ForeColor="White"
                        HeaderText="File <br /> Type" HtmlEncode="false" >
                        <HeaderStyle Width="5%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>
                    <asp:BoundField DataField="SORD_SessionTitle" ReadOnly="True" HeaderStyle-ForeColor="White"
                        HeaderText="Presentation's Video-Title <br /> &nbsp;&nbsp; (or) Support-File Name" HtmlEncode="false" >
                        <HeaderStyle Width="29%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>   
                    <asp:BoundField DataField="SORD_VideoUnlockKey" ReadOnly="True" HeaderStyle-ForeColor="White" 
                        HeaderText="File Unlock <br /> Password" HtmlEncode="false" >
                        <HeaderStyle Width="15%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>  
                    <asp:BoundField DataField="SORD_LastDownloadDate"  
                        ReadOnly="True" HeaderStyle-ForeColor="White" HeaderText="Last <br /> Download" htmlEncode="False"
                        DataFormatString="{0:d}" >
                        <HeaderStyle Width="10%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>   
                    <asp:BoundField DataField="SORD_RemainingDownloads"  
                        ReadOnly="True" HeaderStyle-ForeColor="White" HeaderText="Remaining <br /> Downloads" htmlEncode="False" DataFormatString="{0:##0}" >
                        <HeaderStyle Width="10%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>
                </Columns>

            </asp:GridView>
        </asp:Panel>
    </div>
</div> 
<br />
&nbsp;&nbsp;&nbsp;
<asp:Label ID="Errormsg" runat="server" ForeColor="#CC0000"></asp:Label>

I am trying to use jquery or jscript to click a hidden button and I always get "Microsoft JScript runtime error: Object expected" error.

I have tried all of the following (all with the same results):

$('#btnCompleteHidden').click();or:
$('#btnCompleteHidden').trigger('click');With plain JavaScript:
document.getElementById('btnCompleteHidden').onclick();
$('#<%=btnCompleteHidden.ClientID %>').click();Or:
document.getElementById('<%=btnCompleteHidden.ClientID %>').click();

I have tried making the button visible and still the same results.

I will post the aspx page here:

    <script type="text/javascript">
        function FileDownloader_DownloadStep(Step){
        //The file list is going to be downloaded - "2 = About to Start" 
        if (Step == 2){
            //Dynamically build the filelist for the downloader
            getFileDownloader("FileDownloader").setFileList("GetFileList.aspx");
        }
        //The user has confirmed the download - "6 = File Download About to Start"
        if (Step == 6){
            //Perform the initialization updates to the first file only
            var xmlhttp; 
            if (typeof XMLHttpRequest != 'undefined') { 
                xmlhttp = new XMLHttpRequest(); 
            } 
            if (!xmlhttp) { 
                throw "Browser doesn't support XMLHttpRequest."; 
            } 
            var data = ""; 
            xmlhttp.open("POST", "UpdateVideoInitiated.aspx", true); 
            //Send the proper header information along with the request 
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
             //xmlhttp.setRequestHeader("Content-length", data.length); 
            xmlhttp.setRequestHeader("Connection", "close"); 
            xmlhttp.send(data); 
        }
    }
        function onDownloadItemComplete(Result, ErrorPage, Url, FileName, ContentType, FileSize){
            var xmlhttp;
            var data;

            //The handler will display the error description or updates as noted
            switch (Result){
                        //Update the pleted file as plete and then perform initialization updates to the next file only
                case 1: if (typeof XMLHttpRequest != 'undefined') { 
                            xmlhttp = new XMLHttpRequest(); 
                        } 
                        if (!xmlhttp) { 
                            throw "Browser doesn't support XMLHttpRequest."; 
                        } 
                        data = FileName; 
                        xmlhttp.open("POST", "UpdateVideoDownloaded.aspx?FileName=" + FileName + "&FileSize=" + FileSize, true); 
                        //Send the proper header information along with the request 
                        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
                         //xmlhttp.setRequestHeader("Content-length", data.length); 
                        xmlhttp.setRequestHeader("Connection", "close"); 
                        xmlhttp.send(data); 
                        break;
                case 2: alert("An error has occurred while downloading the file " + FileName);
                        break;
                        //Update any skipped files to back off the initialization updates to the passed file only
                case 3: if (typeof XMLHttpRequest != 'undefined') { 
                            xmlhttp = new XMLHttpRequest(); 
                        } 
                        if (!xmlhttp) { 
                            throw "Browser doesn't support XMLHttpRequest."; 
                        } 
                        data = FileName; 
                        xmlhttp.open("POST", "UpdateVideoSkipped.aspx?FileName=" + FileName, true); 
                        //Send the proper header information along with the request 
                        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
                         //xmlhttp.setRequestHeader("Content-length", data.length); 
                        xmlhttp.setRequestHeader("Connection", "close"); 
                        xmlhttp.send(data); 
                        break;        
                case 4: alert("The server returned a wrong MIME type (should be " + ContentType + ") for the file " + FileName);
                        break;
                case 5: alert("The server returned a wrong size (should be " + FileSize + ") for the file " + FileName);
                        break;
                case 6: alert("An error has occurred while writing the file " + FileName + " to disk");
                        break;
                case 7: alert("The file " + FileName + " could not be found on the " + "server");
                        break;
                case 8: alert("Access to the file " + FileName + " denied");
                        break;
                case 9: alert("Time out while downloading the file " + FileName);
                        break;
            }
        }
        function onDownloadComplete(Result){
            //The handler will display the error description
            switch (Result){
                        //Update the member download statistics and rebind the grid 
                case 0: $('#btnCompleteHidden').click();
                        break;
                case 1: alert("An error has occurred while creating the file list");
                        break;        
                case 2: alert("An error has occurred while downloading the file list");
                        break;
                case 3: alert("The file list is empty");
                        break;
                case 7: alert("The file list could not be found on the server");
                        break;
                case 8: alert("Access to the file list denied");
                        break;
                case 9: alert("Time out while downloading the file list");
                        break;
            }
        }
</script>

<div class="borderDiv">
     <table cellspacing="0" class="borderTable0" width="100%">
         <tr>
            <td class="Subhdr" >
                <asp:label id="lblScreenHeader" Cssclass="ScreenHdr" runat="server" Height="24px">Member Video Download Detail</asp:label>
            </td>
        </tr>
    </table>
    <div class="NinetyNine5PercentWide SolidThreePixelBorder" style="background-color:White">
        <div class="OneHundredPercentWide EightPixelTopMargin TenPixelBottomMargin">
            <div class="FileListHdr">
                &nbsp;&nbsp;&nbsp;&nbsp;
                <span>Current Escrow Balance (Available for Future Use):</span>
                &nbsp;&nbsp;
                <asp:label ID="lblAvailableBalance" Cssclass="FileListHdr" runat="server" >$280.00</asp:label>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <asp:label ID="lblAvailableBalanceMessage" Cssclass="FileListHdr" runat="server" ></asp:label>
            </div>
        </div>
        <div class="NinetyNinePercentWide">
            <div class="FileListHdr EightPixelBottomMargin">
                &nbsp;&nbsp;&nbsp;&nbsp;
                <span class="FileListHdr" >Number of Files Selected for Download:</span>
                &nbsp;
                <asp:label ID="lblTotalFiles" Cssclass="FileListHdr" runat="server" ></asp:label>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <span class="FileListHdr" >Total MBytes:</span>
                &nbsp;
                <asp:label ID="lblTotalMBytes" Cssclass="FileListHdr" runat="server" ></asp:label>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <span class="FileListHdr" >Estmated Download Time:</span>
                &nbsp;
                <asp:label ID="lblEstimatedTime" Cssclass="FileListHdr" runat="server" ></asp:label>
                <asp:Button id="btnCompleteHidden" runat="server" Text="CH" Style="visibility: hidden"
                    Enabled="true" OnClick="btnCompleteHidden_OnClick"></asp:Button>
            </div> 
        </div>
        <div class="NinetyNinePercentWide">
            <div class="OneHundredPercentWide">
                <div class="DivDownload" >
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <script type="text/javascript">
                        //Create JavaScript object that will embed File Downloader to the page
                        var fd = new FileDownloaderWriter("FileDownloader", 170, 28);

                        //For ActiveX control full path to CAB file (including file name) should be specified
                        fd.activeXControlCodeBase = "aurigma/FileDownloader2.cab";
                        fd.activeXControlVersion = "2,0,16,0";

                        //Set the Download button text
                        fd.addParam("ButtonDownloadText", "DOWNLOAD NOW");

                        //Set the Download button background color
                        //fd.addParam("BackgroundColor", "#E0EBFF");
                        fd.addParam("BackgroundColor", "White");

                        //Set the Download button regular image
                        fd.addParam("ButtonDownloadImageFormat", "width=170;height=28;BackgroundColor=White;" + 
                            "urlNormal=App_Themes/Default/images/BtnDownload.jpg;" +
                            "urlHover=App_Themes/Default/images/BtnHover.jpg;" +
                            "urlPressed=App_Themes/Default/images/BtnPressed.jpg;" +
                            "urlDisabled=App_Themes/Default/images/BtnPressed.jpg");

                        //Set license key 
                        fd.addParam("LicenseKey", "73020-10000-D8066-8CFDB-84249");

                        //Set reconnect attampts count
                        fd.addParam("ReconnectAttemptsCount", "360");

                        //Set reconnect timeout value (30000 = 10 seconds)
                        fd.addParam("ReconnectTimeOut", "10000");

                        //The following listener will perform some actions when the file list is about to be downloaded
                        fd.addEventListener("DownloadStep", "FileDownloader_DownloadStep");

                        //The following listener will perform some actions when download of a single file is finished
                        fd.addEventListener("DownloadItemComplete", "onDownloadItemComplete");

                        //The following listener will perform some actions when download process is plete
                        fd.addEventListener("DownloadComplete", "onDownloadComplete");

                        //The following listener will perform some actions when a general error is detected
                        //fd.addEventListener("Error", "onError");

                        //Add page load listener
                        //fd.fullPageLoadListenerName = "fullPageLoad";

                        //Set instructions property
                        fd.instructionsEnabled = true;

                        //Tell File Downloader writer object to generate all necessary HTML code to embed File Downloader into the page
                        fd.writeHtml();
                    </script>
                 </div> 
                 <div class="FileListHdr">
                    <asp:RadioButtonList id="rblMemberMachine" runat="server" Font-Bold="True" BackColor="White" ToolTip="Please select machine for downloading" 
                            CssClass="Radio FileListHdr" RepeatDirection="Horizontal" textAlign="right" BorderStyle="None"
                            AutoPostBack="True" OnSelectedIndexChanged="rblMemberMachine_SelectedIndexChanged" >
                            <asp:ListItem Text="Machine 1" Value="1" Selected="True"></asp:ListItem>
                            <asp:ListItem Text="Machine 2" Value="2"></asp:ListItem>
                            <asp:ListItem Text="Machine 3" Value="3"></asp:ListItem>
                    </asp:RadioButtonList>
                 </div>
             </div>
          </div>
       </div>
    <div class="OneHundredPercentWide" >
        <asp:Panel ID="Panel1" runat="server" Width="100%" >
            <asp:GridView id="grvSessionOrderDownloads" runat="server" BorderWidth="2px" BorderStyle="Solid" BorderColor="#C0C0FF"
                Font-Names="Arial" Font-Bold="True" Font-Size="8pt" GridLines="Horizontal" AutoGenerateColumns="False" 
                HorizontalAlign="Left" ForeColor="Blue" CellPadding="2" AllowSorting="True" Width="100%"
                OnRowDataBound="grvSessionOrderDownloads_OnRowDataBound" >

                <HeaderStyle Font-Names="Arial" HorizontalAlign="Center" ForeColor="White" BackColor="#152EE5" 
                    CssClass="sessionOrderDownloadHeaders" Font-Size="Medium" />
                <RowStyle BackColor="White" ForeColor="#333333" />
                <AlternatingRowStyle BackColor="#A5B0FF" />

                <Columns>
                    <asp:BoundField Visible="False" DataField="SORD_ID" HeaderStyle-Width="0px" >
                        <HeaderStyle Width="0px" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderStyle-Width="0px" >
                        <ItemTemplate>
                            <asp:CheckBox Visible="False" Enabled="false" ID="HiddenCheckBox" runat="server"
                                 Checked='<%# Eval("SORD_SelectedForDownloadFlag") %>' />
                        </ItemTemplate>
                        <HeaderStyle Width="0px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Select Files" HeaderStyle-ForeColor="White" > 
                        <ItemTemplate >
                            &nbsp;&nbsp;&nbsp;
                            <asp:ImageButton id="btnSelectVideo" runat="server" CommandArgument='<%# Eval("SORD_ID") %>' 
                                 CommandName="CheckUncheckVideo" ImageUrl='<%# GetCheckboxImage(Container.DataItem) %>' 
                                 Enabled='<%# Eval("SORD_EnableSelectionCheckBox") %>'
                                 Visible='<%# Eval("SORD_EnableSelectionCheckBox") %>'/>
                        </ItemTemplate>
                        <HeaderStyle Width="4%" />
                        <ItemStyle VerticalAlign="Bottom" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="SORD_OSTA_ID" ReadOnly="True" HeaderStyle-ForeColor="White"
                        HeaderText="Status">
                        <HeaderStyle Width="6%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>
                    <asp:BoundField DataField="SORD_Topic" ReadOnly="True" HeaderStyle-ForeColor="White"
                        HeaderText="General <br /> Topic" HtmlEncode="false" >
                        <HeaderStyle Width="15%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>
                    <asp:BoundField DataField="SORD_Session" ReadOnly="True" HeaderStyle-ForeColor="White"
                        HeaderText="Session <br /> YYMMDD" HtmlEncode="false" DataFormatString="{0:00-00-00}" >
                        <HeaderStyle Width="6%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>
                    <asp:BoundField DataField="SORD_FileExtension" ReadOnly="True" HeaderStyle-ForeColor="White"
                        HeaderText="File <br /> Type" HtmlEncode="false" >
                        <HeaderStyle Width="5%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>
                    <asp:BoundField DataField="SORD_SessionTitle" ReadOnly="True" HeaderStyle-ForeColor="White"
                        HeaderText="Presentation's Video-Title <br /> &nbsp;&nbsp; (or) Support-File Name" HtmlEncode="false" >
                        <HeaderStyle Width="29%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>   
                    <asp:BoundField DataField="SORD_VideoUnlockKey" ReadOnly="True" HeaderStyle-ForeColor="White" 
                        HeaderText="File Unlock <br /> Password" HtmlEncode="false" >
                        <HeaderStyle Width="15%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>  
                    <asp:BoundField DataField="SORD_LastDownloadDate"  
                        ReadOnly="True" HeaderStyle-ForeColor="White" HeaderText="Last <br /> Download" htmlEncode="False"
                        DataFormatString="{0:d}" >
                        <HeaderStyle Width="10%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>   
                    <asp:BoundField DataField="SORD_RemainingDownloads"  
                        ReadOnly="True" HeaderStyle-ForeColor="White" HeaderText="Remaining <br /> Downloads" htmlEncode="False" DataFormatString="{0:##0}" >
                        <HeaderStyle Width="10%" />
                        <ItemStyle CssClass="sessionOrderDownloadItems" />
                    </asp:BoundField>
                </Columns>

            </asp:GridView>
        </asp:Panel>
    </div>
</div> 
<br />
&nbsp;&nbsp;&nbsp;
<asp:Label ID="Errormsg" runat="server" ForeColor="#CC0000"></asp:Label>

Share Improve this question edited May 15, 2012 at 4:19 MPelletier 16.7k18 gold badges89 silver badges140 bronze badges asked Sep 12, 2009 at 2:20 JamesJames 3054 gold badges10 silver badges23 bronze badges 1
  • See "case 0" of the jscript for the btnCompleteHidden trigger – James Commented Sep 12, 2009 at 2:26
Add a ment  | 

4 Answers 4

Reset to default 4

Few thoughts:

  1. Are you including the jQuery script file into this page? That might explain issues with error messages about the "$" variable.

  2. Use click() instead of onclick() to fire click events. onclick is a handler that is fired when the element is clicked, but is not used to initiate the event itself.

  3. The element's id might not be what you have defined in the page due to ASP.NET namespacing and its goals of ensuring unique element ids on the client. An easy way to figure this all out is to View Source on a rendered page and find your button and its "real" id.

  4. As mentioned in the ments to this post, the jQuery script must referenced by the page via a <script> tag for the jQuery functions to work.

EDIT: Added point #4.

I don't see any ASP elements with the id "Button". Shouldn't it be something like:

$('#<%=btnCompleteHidden.ClientID %>').click();

I saw your javascript code at this line:

        switch (Result){
                    //Update the member download statistics and rebind the grid 
            case 0: $('#btnCompleteHidden').click();

That won't work because you should be using the ClientID instead of the server side ID.

        switch (Result){
                    //Update the member download statistics and rebind the grid 
            case 0: $('#<%=btnCompleteHidden.ClientID %>').click();

This should work

For me, the problem was in external javascript file included into the page. In that file , I had call to function which was not existing (mented out). After I removed call to undefined function, problem was resolved


If you were testing on an older IE browser and your cache was not cleared, there is the possibility that your page is not rendering with any changes you make.

Try this:

  1. clear your browser's cache with Ctrl + Shift + Delete

  2. refresh the browser window with Ctrl + F5


Hopefully your changes will now render, provided it is syntactically correct. Otherwise, I hear that it is a good idea in general to turn off caching when developing for this reason.

本文标签: javascriptWhy JScript runtime error Object expectedStack Overflow