Delete OnClientItemDoubleClicked

3 posts, 1 answers
  1. Allan
    Allan avatar
    121 posts
    Member since:
    Jun 2008

    Posted 22 Feb 2011 Link to this post

    I need a little help executing a SQL Stored Procedure from the Code Behind using OnClientItemDoubleClicked.

    Here is my ASPX code for the list box:

    <telerik:RadListBox ID="rlb_JobRoles" runat="server"
    DataKeyField="RoleName" 
                DataSortField="RoleName"  DataTextField="RoleName" 
                DataValueField="RoleName" Width="245px" OnClientItemDoubleClicked="RemoveJobRole">
    </telerik:RadListBox>

    And my code behind:

    Protected Sub RemoveJobRole(sender As Object, e As System.EventArgs) Handles rlb_JobRoles.SelectedIndexChanged
        Dim DatabaseName As String = rcb_Database.SelectedValue
        Dim MemberName As String = Session("UserInRoleName")
        Dim connectionString = New SqlConnection("server=DO-IT-AB\MSSQLAB;database=AeriesAdmin;UID=itc.sysadmin;PWD=m1s.@dm1n6;")
        Dim command = New SqlCommand("aa_user_drop_role", connectionString)
        command.CommandType = CommandType.StoredProcedure
        command.Parameters.Add("@dbname", SqlDbType.VarChar).Value = DatabaseName + "."
        command.Parameters.Add("@name_in_db", SqlDbType.VarChar).Value = MemberName
        command.Connection.Open()
        command.ExecuteScalar()
        command.Connection.Close()
    End Sub

    I receive the following error when I open the page:

    Error: 'RemoveJobRole' is undefined

    Any help much appreciated.



  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Feb 2011 Link to this post

    Hello Allan,

    You can invoke an ajaxRequest from clientside, and from there you can your function.

    ClientSide
    function clientClose()
     {
         var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
         ajaxManager.ajaxRequest();
     }
    C#:
    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
      {
          RemoveJobRole();//calling the function
      }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Allan
    Allan avatar
    121 posts
    Member since:
    Jun 2008

    Posted 25 Feb 2011 Link to this post

    Thank you Shinu. Works a charm.

    Allan
Back to Top