I created a user control which has a rad ComboBox and RadCallBack.
ComboBox displays customer name and when i select a customer, with the help of RadCallBack, execution transfers to code behind and customer details are extracted from DB.
then those details are filled in combo boxes.
when I have 1 instance of this user control on a page, it works fine, but when I add another instance, I can see customer names in the dropdown, but those textboxes are not filled. I can debug and see that those code behind lines are executed but i do not see any results in my text boxes.
Any help would be appreciated.
here is the code:
// this is java script code called when a customer is selected in rad combobox
function CustomerSelectedChanged() {
var comboBox = <%= cmbLookUp.ClientID %>;
var CustomerCode = comboBox.GetValue();
//document.getElementById("<%=txtFrom.ClientID %>").value = 'manik';
<%=rdCallBackCustDetails.ClientID%>.MakeCallback('GetCustomerDetails',CustomerCode);
}
' this is code behind
Private Sub RadCallback1_Callback(ByVal sender As System.Object, ByVal args As Telerik.WebControls.CallbackEventArgs) Handles rdCallBackCustDetails.Callback
If args.CallbackEvent = "GetCustomerDetails" And args.Args <> "" Then
Try
MakeControlsUpdatable()
Dim CustomerData As New FreightComDN.cls_Customer(ConfigurationManager.AppSettings("FreightConStr"))
Dim resultcol As Collection
Dim CustomerCode As String
CustomerCode = args.Args
resultcol = CustomerData.getASpecificCustomer(args.Args)
SetText(Me.txtFrom, resultcol.Item(1).customerName)
CustomerData = Nothing
Catch ex As Exception
End Try
End If
End If
End Sub
Private Function MakeControlsUpdatable()
Try
' set all the controls to be updated
rdCallBackCustDetails.ControlsToUpdate.Add(Me.txtFrom)
Catch ex As Exception
End Try
End Function
Private Sub SetText(ByVal txtBox As TextBox, ByVal txtValue As Object)
Try
txtBox.Text = txtValue
Catch ex As Exception
End Try
End Sub