Hi...
I have a .js file...
Name - myfile.js in the App_Themes/JS folder
How do I call this file from code - behind in c# asp.net ??
I need this file once the GridView is loaded...
Scenariao -
I have a button - "Load" on aspx page.
ON btn_click event, I have loaded the gridview with datatable.
After the gridview is loaded, I need to call this file..
How do I do that ??
I do not want to call it is aspx page.
Loading
Riddhi ValechaPosted May 15, 2015, 5:08 AM
This code also didnt work...
I need column-heading in the side... But they are on the top...
This is when the "Restore" button of Internet Explorer is clicked...
Upendra Pratap ShahiPosted May 13, 2015, 3:34 AM
Riddhi ValechaPosted May 13, 2015, 3:28 AM
My .js file code is -
var headertext = [],
headers = document.querySelectorAll(".mytable th"),
tablerows = document.querySelectorAll(".mytable th"),
tablebody = document.querySelector(".mytable tbody");
for(var i = 0; i < headers.length; i++) {
var current = headers[i];
headertext.push(current.textContent.replace(/\r?\n|\r/, ""));
}
for (var i = 0, row; row = tablebody.rows[i]; i++) {
for (var j = 0, col; col = row.cells[j]; j++) {
col.setAttribute("data-th", headertext[j]);
}
}
------
This gives error on page_load if I call this on aspx page.
Riddhi ValechaPosted May 6, 2015, 5:50 AM
I did all these methods... None worked out !
Manoj BhoirPosted May 5, 2015, 6:12 AM
Add your Javascript file reference on your page.
You can use this code on your Button Click event :
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(@"");
System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "JavaScriptCall", sb.ToString(), false);
Riddhi ValechaPosted May 5, 2015, 3:45 AM
The purpose is not served dear....
In the file... the following lines are there -
var Headers[] = ,
for(var i = 0; i < headers.length; i++)
for (var i = 0, row; row = tablebody.rows[i]; i++)
------------
It is for responsive gird view....
When I click the button, and restore the Internet Explorer , then column names must appear..
I am only getting values of rows...and not column names....
Vincent Maverick DuranoPosted May 4, 2015, 10:09 AM