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"
                DataSortField="RoleName"  DataTextField="RoleName" 
                DataValueField="RoleName" Width="245px" OnClientItemDoubleClicked="RemoveJobRole">

    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
    End Sub

    I receive the following error when I open the page:

    Error: 'RemoveJobRole' is undefined

    Any help much appreciated.

  2. Answer
    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.

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

  3. Allan
    Allan avatar
    121 posts
    Member since:
    Jun 2008

    Posted 25 Feb 2011 Link to this post

    Thank you Shinu. Works a charm.

Back to Top