2 Replies - 4270 Views - Last Post: 20 December 2010 - 11:57 PM Rate Topic: -----

#1 pwtc222  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 72
  • Joined: 02-July 10

remove duplicate values in listbox on client side events

Posted 16 December 2010 - 12:43 AM

Hello.
I have a code,where when user enter values in textbox,on enter-key press,it will move the value to listbox. And when user enter same values (duplicate),it will remove the duplicate value and tell the user on label that duplicate user is detected.
I have this code as in vb as code behind,and its working fine.
But i wan it to be on client side events,where no postback when everytime the enter key is pressed.

Anyone knows how this code to be applied as client side event code?
I m using devexpress components (for the textbox and listbox)

Protected Sub txtSerialNo_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSerialNo.TextChanged

        Dim i As Integer
        Dim ifoundrec As Integer

        i = 0
        ifoundrec = 0

        ifoundrec = LstBoxSerialNo.Items.IndexOfText(txtSerialNo.Text)

        If ifoundrec = -1 Then
            LstBoxSerialNo.Items.Add(txtSerialNo.Text)
            lblStatus.Text = ""
            txtSerialNo.Text = ""
            txtSerialNo.Focus()
            lblSNCount.Text = LstBoxSerialNo.Items.Count


        ElseIf ifoundrec > -1 Then
            lblStatus.Text = txtSerialNo.Text + " is duplicate "
            txtSerialNo.Text = ""
            txtSerialNo.Focus()
        End If
       
    End Sub


This post has been edited by pwtc222: 16 December 2010 - 02:10 AM


Is This A Good Question/Topic? 0
  • +

Replies To: remove duplicate values in listbox on client side events

#2 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 446
  • View blog
  • Posts: 1,501
  • Joined: 28-April 09

Re: remove duplicate values in listbox on client side events

Posted 16 December 2010 - 10:19 PM

you could put the control inside an updatepanel to make it into an ajax call rather than a full page postback.
Was This Post Helpful? 0
  • +
  • -

#3 pwtc222  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 72
  • Joined: 02-July 10

Re: remove duplicate values in listbox on client side events

Posted 20 December 2010 - 11:57 PM

Hi.
your method works as how i need.
but sometimes,i get this error and i need to refresh the page and all runs well after the page refresh.
Error message :
Could not load file or assembly 'Microsoft.Windows.Design.Extensibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

error above pointing to scriptmanager.

i get this error once in a while.and i want to avoid this error.
do you know what cause this error?

This post has been edited by pwtc222: 20 December 2010 - 11:57 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1