This is a migrated thread and some comments may be shown as answers.

Calling server side function from javascript

0 Answers 266 Views
Grid
This is a migrated thread and some comments may be shown as answers.
D.SRINIVASA
Top achievements
Rank 2
D.SRINIVASA asked on 30 Apr 2011, 06:22 AM
Hi,
 i am D. Srinivas Rao.
in my aspx page i have a JavaScript function for calling a server side event when click on the Check box. The following is the code for Java Script Function.

<telerik:RadCodeBlock runat="server">

        <script language="javascript" type="text/javascript">

            function GetMessage(sender, args) {

                PageMethods.CompletedCheck();
alert("Hii");

               }

           </script>

         <telerik:RadScriptManager id="RadScriptManager" runat="server"

    EnablePageMethods="True">

</telerik:RadScriptManager>

        </telerik:RadCodeBlock>

and this function called in CheckBox checked event.. the Following is the Code for CheckBox Control

<telerik:GridTemplateColumn UniqueName="Complete" HeaderText="Completed" AllowFiltering="false">

                        <ItemTemplate>

                            <asp:Panel ID="Panel1" runat="server" Width="2px">

                             <asp:CheckBox ID="chkComplete" runat="server" AutoPostBack="true" onclick="GetMessage()" />

                            </asp:Panel>

                        </ItemTemplate>

</telerik:GridTemplateColumn>

and my Code Behind is

<System.Web.Services.WebMethod()> _

    Public Shared Sub CompletedCheck(ByVal sender As Object, ByVal e As System.EventArgs)

       //code here

         End Sub

in the above grid template check-box control will fire the JavaScript  function GetMessage() Well, but it doesn't execute the Code Behind Event.

Please Help me how to execute the Code Behind Method  using JavaScript Function..

Thank You
D.Srinivasa Rao


No answers yet. Maybe you can help?

Tags
Grid
Asked by
D.SRINIVASA
Top achievements
Rank 2
Share this question
or