如何从代码隐藏调用 jquery 函数(document.ready 函数)



我的aspx页面中有一个jquery文档就绪函数。我想调用它或从代码隐藏运行这个 jquery 文档就绪函数。

我该怎么做?或者我怎么能写一个类似 jquery 函数的东西

例:

 function abc()
 {
     a + b = c
 }

并从代码隐藏调用这个 jquery abc 函数

protected void btnSearch_Click(object sender, EventArgs e)
        {
            if (Validate1())
            {
                objELItemMaster.Item_CategoryCode = Convert.ToInt32(ddlItemType.SelectedValue);
                DataTable BranchStockDetails = objBLItemMaster.GetBranchItemDetails(objELItemMaster);
                int rows = BranchStockDetails.Rows.Count;
                int cols = BranchStockDetails.Columns.Count;
                html1 += "<div class="outerbox"><div class="innerbox"><table class="bluetable" id="myDemoTable" cellpadding="0" cellspacing="0"> <thead> <tr>";
                for (int i = 0; i < cols; i++)
                {
                    html1 += "<th>" + BranchStockDetails.Columns[i].ColumnName.ToString() + "</th>"; 
                }
                html1 += "</tr></thead><tbody>";
                for (int j = 0; j < rows; j++)
                {
                    html1 += " <tr>";
                    for (int k = 0; k < cols; k++)
                    {
                        html1 += "<td>" + BranchStockDetails.Rows[j][k].ToString() + "</td>";
                    }
                    html1 += "</tr>";
                }
                html1 += "</tbody></Table></div></div>";
                Datatable1.InnerHtml = html1;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "name", "myFun();", true);
            }
        }
        public bool IsNumeric(string input)
        {
            int number;
            return int.TryParse(input, out number);
        }
        private void Alert(string Message)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "alert('" + Message + "');", true);
        }
        private bool Validate1()
        {
            if (Convert.ToInt32(ddlItemType.SelectedItem.Value) == 0)
            {
                Alert("Please select a category of product.");
                ddlItemType.Focus();
                return false;
            }
            return true;
        }
 <script type="text/javascript">
         function myFun() {
             $('#myDemoTable').fixedHeaderTable({
                 altClass: 'odd',
                 footer: true,
                 fixedColumns: 1
             });
         }
        </script>

相关内容

最新更新