-2

I have got a jquery document ready function in my aspx page. I want to call that or run this jquery document ready function from code behind.

How can i do that? Or how can i write a jquery function something like

Example:

 function abc()
 {
     a + b = c
 }

And Call this jquery abc function from code behind

Community
  • 1
  • 1

1 Answers1

-1
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>
  • Check this link for jquery and html "http://bytesare.us/cms/index.php/demo-apps/html-table-with-fixed-header-and-first-column" – Abhilash Chalissery Nov 22 '17 at 12:09
  • In the button click i have created a function to call data from database as a datatable and i am using a loop to print table with datatable data. Then i am calling the jquery to fix the header and first coloum fix when we scrool horizondal and vertical. check this link "http://bytesare.us/cms/index.php/demo-apps/html-table-with-fixed-header-and-first-column" – Abhilash Chalissery Nov 22 '17 at 12:11