You cannot do this using simple JavaScript.
You are going to have to use Ajax to call this function.
In this case I would recommend placing your GridView inside an UpdatePanel.
The update panel will do the Ajax call for you to update your GridView.
Check out the MSDN Article on UpdatePanels for more information.
-Frinny
ASP.NET call code-behind function using javascript
Collapse
X
-
ASP.NET call code-behind function using javascript
how can i call a none static function using javascript?
javascript:GetD ata()
Code:Public Sub GetData() Dim objNL As New NLEngine Dim dtNewsList As New Data.DataTable dtNewsList.Columns.Add("title") dtNewsList.Columns.Add("old") dtNewsList.Columns.Add("flaged") dtNewsList.Columns.Add("attributes") dtNewsList.Columns.Add("view") Dim sList As ArrayList = objNL.GetData(1, 10) For i As Integer = 0 To sList.Count - 1 Dim x As String() = sList.Item(i) x(3) = Replace(x(3), "[img]", "<img") x(3) = Replace(x(3), "[/img]", ">") dtNewsList.Rows.Add(x) Next GridView1.DataSource = dtNewsList GridView1.DataBind() End SubTags: None
Leave a comment: