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

Help with viewing data from table

3 Answers 71 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 12 Dec 2011, 11:59 PM

Hello,

As I moving through records in a table, I am able to see the records in my messagebox, but unable to see them in my combobox, how do I fix this problem?

 

If currentIndex < dtDonor.Rows.Count - 1 Then

currentIndex += 1

Session(

"CurrentIndex") = currentIndex

C1CountryOrigin.Text = dtDonor.Rows(currentIndex).Item(

 

"CountryOrigin")

MsgBox(dtDonor.Rows(currentIndex).Item(

 

"CountryOrigin"))

End If

3 Answers, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 14 Dec 2011, 04:20 PM
Hello Victor,

Could you clarify a little bit more what exactly is your scenario?
A piece of code could be of help, too.

Kind regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Victor
Top achievements
Rank 1
answered on 14 Dec 2011, 10:37 PM

Hello,

I am using the code below to search  for certain records, one I receive the results they will be stored in the dtDonor table, I would then like to use the code in my previous post to move to the next records.

 

' create a new XML Document object for each XML file

 

Dim xdDonor As New Xml.XmlDocument

 

Dim xdLink As New Xml.XmlDocument

 

Dim xdReceiver As New Xml.XmlDocument

 

' load all of the XML documents

xdDonor.Load(Server.MapPath(

 

"~/App_Data/CountryDonor.xml"))

xdLink.Load(Server.MapPath(

 

"~/App_Data/LinkSSADB.xml"))

xdReceiver.Load(Server.MapPath(

 

"~/App_Data/CountryReceiver.xml"))

 

' Extract the ReceiverID and DonorID values from the current node

 

Dim ReceiverID As String

 

Dim DonorID As String

 

Dim Link_ID As String

 

Dim DonorID2 As String

 

Dim Name As String

 

Dim ReceiverID2 As String

dtReceiver =

 

New DataTable

dtReceiver.Columns.Add(

 

"CountryUser_ID", GetType(String))

dtReceiver.Columns.Add(

 

"CountryUser", GetType(String))

dtDonor =

 

New DataTable

dtDonor.Columns.Add(

 

"CountryOrigin_ID", GetType(String))

dtDonor.Columns.Add(

 

"CountryOrigin", GetType(String))

Session(

 

"CurrentIndex") = 0

Session(

 

"dtDonor") = dtDonor

Session(

 

"dtReceiver") = dtReceiver

MsgBox(C1Fuze.SelectedItem.Value)

 

' This outer loop will iterate over the Link file where the ReceiverID node is equal to our search criteria

 

For Each xnLink As Xml.XmlNode In xdLink.SelectNodes("/Root/LinkSSADBTable/LinkA[Manufacturer_ID='" & C1Manufacturer.SelectedItem.Value & "']")

Link_ID = xnLink.SelectSingleNode(

 

"Link_ID").InnerText

ReceiverID = xnLink.SelectSingleNode(

 

"CountryUser_ID").InnerText

DonorID = xnLink.SelectSingleNode(

 

"CountryOrigin_ID").InnerText

 

' Perform another similar search based upon the Donor XML file

 

For Each xnDonor As Xml.XmlNode In xdDonor.SelectNodes("/Root/CountryOriginTable[CountryOrigin_ID='" & DonorID & "']")

DonorID2 = xnDonor.SelectSingleNode(

 

"DonorID").InnerText

Name = xnDonor.SelectSingleNode(

 

"Name").InnerText

dtDonor.Rows.Add({DonorID2, Name})

 

Next

dtLinkID =

 

New DataTable

dtLinkID.Columns.Add(

 

"Link_ID", GetType(String))

 

' Perform yet another practically identical search on the Receiver XML file

 

For Each xnReceiver As Xml.XmlNode In xdReceiver.SelectNodes("/Root/Receiver[ReceiverID='" & ReceiverID & "']")

 

' Extract the ReceiverID and Name values from the current node

ReceiverID2 = xnReceiver.SelectSingleNode(

 

"ReceiverID").InnerText

Name = xnReceiver.SelectSingleNode(

 

"Name").InnerText

dtReceiver.Rows.Add({ReceiverID2, Name})

 

Next

 

' Extract the Link_ID avalues from the current node

LinkID2 = xnLink.SelectSingleNode(

 

"Link_ID").InnerText

dtLinkID.Rows.Add({LinkID2})

 

Next

 C1CountryOrigin.DataSource = dtDonor

 C1CountryOrigin.DataTextField =

 

"Name"

 C1CountryOrigin.DataValueField =

 

"DonorID"

 C1CountryOrigin.DataBind()

As mentioned,

MsgBox(dtDonor.Rows(currentIndex).Item("CountryOrigin"))

 shows the correct records when I press the next bottom, but the control does not show anything, apparently the .Text property doesn't understand the code:

C1CountryOrigin.Text = dtDonor.Rows(currentIndex).Item("CountryOrigin")

 

0
Ivana
Telerik team
answered on 19 Dec 2011, 04:21 PM
Hello Victor,

I could not determine what is the cause of the issues you have been experiencing. Take a look at the attached files to see how the RadComboBox is populated with data withdrawn from a DataTable.

I hope this helps.

All the best,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
ComboBox
Asked by
Victor
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Victor
Top achievements
Rank 1
Share this question
or