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

Delete OnClientItemDoubleClicked

2 Answers 68 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 2
Allan asked on 22 Feb 2011, 05:53 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 23 Feb 2011, 06:54 AM
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.
0
Allan
Top achievements
Rank 2
answered on 25 Feb 2011, 05:27 PM
Thank you Shinu. Works a charm.

Allan
Tags
ListBox
Asked by
Allan
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Allan
Top achievements
Rank 2
Share this question
or