Thanks fopr the code, the data shows in the repeater control as a dropdownlist, but it doesn't link the data to the txtCountry Textbox. Any ideas how to link the repeater to the textbox control?
From the button serach event is the code below sufficient?
I am not getting an error, problem is C1Manufacturer (Textbox) does not display the data from the Repeater control, for example the code below, dtDonor returns a collection of BEL,CAN,USA, I would like to see the first row (BEL) in my C1manufacturer control
and see the others when the user presses the Next button.
' create a new XML Document object for
each XML file
I ma getting "based is not dclared error message", will this syntax work when I want to move to the next record? As mentioned dtDonor will contain multiple rows.
I ma getting "based is not dclared error message", will this syntax work when I want to move to the next record? As mentioned dtDonor will contain multiple rows.
Thanks,
Victor
If you want to show one record per page,you should use DetailsView instead of Repeater。
vcharles
Member
76 Points
76 Posts
Help with using Repeater control to link table data to a textbox control
Dec 13, 2011 08:27 PM|LINK
Hello,
How do I modify my approach below to link a datasource to a textbox?
I tried the code below, but the C1manufacturer Textbox control still doesn't display the data from the dtDonor table.
ASPX File:
<asp:Repeater ID="RepeatControl" runat="server">
<ItemTemplate>
DataBinder.Eval(Container.
C1manufacturer.Text="<%#Da
</ItemTemplate>
</asp:Repeater>
Vb File Search Button:
RepeatControl.DataSource = dtDonor
RepeatControl.DataBind()
<script type="text/javascript" src="http://images.experts-exchange.com/00234/scripts/attachments_91215bb71fe6ac3f8039d78caee71371.js"></script>
kedarrkulkar...
All-Star
35573 Points
5700 Posts
Re: Help with using Repeater control to link table data to a textbox control
Dec 13, 2011 08:38 PM|LINK
try this
<asp:Repeater ID="RepeatControl" runat="server">taBinder.Eval(Container.DataItem, "CountryOrigin")%> />
<ItemTemplate>
<asp:TextBox id="txtCountry" runat="server" Text=<%#Da
</ItemTemplate>
</asp:Repeater>
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
vcharles
Member
76 Points
76 Posts
Re: Help with using Repeater control to link table data to a textbox control
Dec 13, 2011 09:38 PM|LINK
Hi,
Thanks fopr the code, the data shows in the repeater control as a dropdownlist, but it doesn't link the data to the txtCountry Textbox. Any ideas how to link the repeater to the textbox control?
From the button serach event is the code below sufficient?
RepeatControl.DataSource = dtDonor
' RepeatControl.DataMember = "CountryOrigin
RepeatControl.DataBind()
kedarrkulkar...
All-Star
35573 Points
5700 Posts
Re: Help with using Repeater control to link table data to a textbox control
Dec 14, 2011 04:30 AM|LINK
I suppose, this should display the data fine...
are you sure the CountryOrigin field in database table has non null value?
KK
Please mark as Answer if post helps in resolving your issue
My Site
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Help with using Repeater control to link table data to a textbox control
Dec 15, 2011 02:11 AM|LINK
Hello vcharles:)
This codes I referred above seem right,But I didn't see yours……;So You can also have a try like this:
<asp:TextBox id="txtCountry" runat="server" Text=<%#Eval("CountryOrigin")%> />
PS:What's the error?
What's the result?
What's "dtDonor"?
Best reguards!
vcharles
Member
76 Points
76 Posts
Re: Help with using Repeater control to link table data to a textbox control
Dec 15, 2011 06:18 AM|LINK
Hello,
I am not getting an error, problem is C1Manufacturer (Textbox) does not display the data from the Repeater control, for example the code below, dtDonor returns a collection of BEL,CAN,USA, I would like to see the first row (BEL) in my C1manufacturer control and see the others when the user presses the Next button.
' 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/CountryOrigin.xml"))
xdLink.Load(Server.MapPath("~/App_Data/LinkSSADB.xml"))
xdReceiver.Load(Server.MapPath("~/App_Data/CountryUser.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 LinkID2 As
String
Dim DonorID2 As String
Dim Name As String
Dim ReceiverID2 As String
dtReceiver = New DataTable
dtReceiver.Columns.Add("ReceiverID",
GetType(String))
dtReceiver.Columns.Add("Name",
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)
On Error Resume Next
' 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/LinkA[Item_ID='"
& C1Item.SelectedItem.Value & "']")
Link_ID = xnLink.SelectSingleNode("LinkAID").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("CountryOrigin_ID").InnerText
Name = xnDonor.SelectSingleNode("CountryOrigin").InnerText
dtDonor.Rows.Add({DonorID2, Name})
Next
' Perform yet another practically identical search on the
Receiver XML file
For Each xnReceiver As Xml.XmlNode In xdReceiver.SelectNodes("/Root/CountryUserTable[CountryUser_ID='"
& ReceiverID & "']")
'' Extract the ReceiverID and Name values from
the current node
ReceiverID2 = xnReceiver.SelectSingleNode("CountryUser_ID").InnerText
Name = xnReceiver.SelectSingleNode("CountryUser").InnerText
dtReceiver.Rows.Add({ReceiverID2, Name})
Next
' Extract the Link_ID avalues from the current node
dtLinkID = New
DataTable
dtLinkID.Columns.Add("Link_ID",
GetType(String))
inkID2 =
xnLink.SelectSingleNode("LinkAID").InnerText
dtLinkID.Rows.Add({LinkID2})
Next
C1CountryOrigin.DataSource = dtDonor
C1CountryOrigin.DataTextField = "CountryOrigin"
C1CountryOrigin.DataValueField = "CountryOrigin_ID"
C1CountryOrigin.DataBind()
C1CountryUser.DataSource = dtReceiver
C1CountryUser.DataTextField = "Name"
C1CountryUser.DataValueField = "ReceiverID"
C1CountryUser.DataBind()
RepeatControl.DataSource = dtDonor
RepeatControl.DataBind()
'C1Manufacturer.Text = ??????
dtDonor = Session("dtDonor")
currentIndex = Session("CurrentIndex")
If currentIndex < dtDonor.Rows.Count - 1 Then
currentIndex = 0
Session("CurrentIndex") =
currentIndex
C1CountryOrigin.Text = dtDonor.Rows(currentIndex).Item("CountryOrigin")
End If
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Help with using Repeater control to link table data to a textbox control
Dec 15, 2011 06:50 AM|LINK
Hello again:)
If your dtDonor is type of DataTable,you can just specify the rowIndex and Cell to assign the value,sample codes look like this following:
C1Manufacturer.Text = dtDonor.Rows(0-based Index)(0-based Cell).ToString()
vcharles
Member
76 Points
76 Posts
Re: Help with using Repeater control to link table data to a textbox control
Dec 15, 2011 09:07 AM|LINK
HI,
I ma getting "based is not dclared error message", will this syntax work when I want to move to the next record? As mentioned dtDonor will contain multiple rows.
Thanks,
Victor
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Help with using Repeater control to link table data to a textbox control
Dec 16, 2011 12:19 AM|LINK
If you want to show one record per page,you should use DetailsView instead of Repeater。
vcharles
Member
76 Points
76 Posts
Re: Help with using Repeater control to link table data to a textbox control
Dec 16, 2011 01:50 AM|LINK
Hi.
How do I link a detailsview to a datasource and then to a textbox? It needs to be bound to a Textbox to allow me to edit the data,
Victor