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

Loading control on the demend

1 Answer 60 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Inna
Top achievements
Rank 1
Inna asked on 06 Feb 2009, 08:10 PM

Below are the java scrip and code behind.

SInce we have a lot of data for the drop down box, we are not loading the drop down on the page load.
User will start typing the value and then we will return data to the control.

If i typed 56 in the drop down, no data is populating, if i backspace 6, then i do get data that starts with 56
If i type 5 nothing happend, if i typed 5 and backspaced then it is loading data

Can you please help?


function

OnVendorNameKeyPress(sender, eventArgs)

 

{

 

 

var a = eventArgs.get_domEvent().keyCode;  

 

// 8 - Backspace  

 

 

// 127 - Delete

 

if (a >= 32 && a <= 126 || a == 8 || a == 127)

 

 {

 

var b = sender.get_text() ? sender.get_text() : '';

 

 

 

if (a >= 32 && a <= 126)

 

 

 {

b += String.fromCharCode(a);

}

 

if (b && b != $$$._vendorNamePart)

 

 

 {

$$$._vendorNamePart = b;

$$$._departmentReq =

 

false;

 sender.requestItems(

 

'txt:' + b, false);  

 

}

}

 

 

Protected

Sub ctlRComboBoxVendorID_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles ctlRComboBoxVendorID.ItemsRequested  

 

If New DB_BLL.Cache().IsMaintain Then  

 

e.Message =

""   

 

Try

 

Dim comBox As RadComboBox = sender

 

 

 

If Not (comBox Is Nothing) Then

 

 

 

If Not (e.Text Is Nothing) And (e.Text.StartsWith("txt:") Or e.Text.StartsWith("id:")) Then

 

 

 

If e.Text.StartsWith("txt:") And e.Text.Length > 4 Then

 

 

 

 

 

Dim txt As String = e.Text.Substring(4)

 

Me.ctlRComboBoxVendorID.Items.Clear()

 

 

 

Dim vendorList As List(Of TMS402VH_VENDOR) = DB_VENDOR.GetAllVendorsByVendorNumber(txt)

 

 

 

If Not (vendorList Is Nothing) And vendorList.Count <> 0 Then

 

 

 

For Each info As TMS402VH_VENDOR In vendorList

 

 

 

Me.ctlRComboBoxVendorID.Items.Add(New RadComboBoxItem(info.VENDOR_ID.ToString() & " - " & info.VENDOR_NME.Trim(), info.VENDOR_ID))

 

 

 

Next

 

 

 

End If

 

 

 

ElseIf e.Text.StartsWith("id:") And e.Text.Length > 3 Then

 

 

 

Dim departmentId As Integer = 0

 

 

  

Try

 

 

 

departmentId = Convert.ToInt32(e.Text.Substring(3))

 

 

Catch ex As Exception

 

 

 departmentId = 0

 

End Try

 

 

 

Me.ctlRComboBoxVendorID.Items.Clear()

 

 

 

Dim vendorList As List(Of TMS402VH_VENDOR) = DB_VENDOR.GetAllVendorsByDepartment(departmentId, String.Empty, False)

 

 

 

If Not (vendorList Is Nothing) And vendorList.Count <> 0 Then

 

 

 

For Each info As TMS402VH_VENDOR In vendorList

 

 

 

Me.ctlRComboBoxVendorID.Items.Add(New RadComboBoxItem(info.VENDOR_ID.ToString() & " - " & info.VENDOR_NME.Trim(), info.VENDOR_ID))

 

 

 

 

 

Next

 

End If

 

 

 

End If

 

 

 

End If

 

 

 

End If

 

 

 

Catch ex As Exception

 

 

e.Message = ex.Message

 

End Try

 

 

 

End If

 

 

 

End Sub

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 09 Feb 2009, 03:10 PM
Hi Inna,

Could you please open a support ticket and send us a simple working example demonstrating the issue so that we to be able to test it locally? Thanks

Best regards,
Yana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Inna
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or