I have a page that takes a comma delimited string and needs to bind to a
Repeater control. The string is split into an Array, and each value is put
into a DataBase query via a For Each loop. The purpose is to retrieve
address information for the user. Sometimes, the address_fk field in the
people table is null, so there will be no linking address information. In
this case, the section to be displayed asks if the user would like to create
an address. (The section information is not shown.)
If the first array variable contains an id with an associated address, no
problem - the page acts correctly. The problem I have is that if the first
variable passed does not retrieve any rows from the address table, then the
second query (which does have values in the address table) is not displayed.
The If clause in the Page_Load event below is to retrieve the People ID
field, which must be shown in the Repeater section whether there is an
associated address or not.
I have verified that all works as I think it should up until the DataBind
method. Right before I bind to the Repeater, the row count is correct (0,2
respectively), and the table count is correct (2). But when I bind, only the
first row (no address data) is displayed. The Repeater only fires once, and
never fires for the second DataSet table, the one with values. What is
happening here?
(In the If clause, I clear the columns in the table because certain controls
in the Repeater are hidden based on the number of rows returned. If one row
is returned, it checks to see if there is one column (no address
information) or nine columns (there is address info.) If you need to see
further information, please let me know.)
Thank you very much,
Jim
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If Not Page.IsPostBack Then
Session("myVars ") = "46,44"
'Split the array
strArray = Session("myVars ").ToString.Spl it(",")
'Declare database variables
objConn = New OleDbConnection (Application("d bString"))
objComm = New OleDbCommand(st rSQL, objConn)
objDS = New DataSet()
objConn.Open()
'Loop through the addresses of each party
For Each strTemp In strArray
strSQL = "select
ad.id,name,Addr ess1,Address2,C ity,State_ID_Fk ,Zip_Code,pa.id as
PeopleID,pa.id_ number " _
& "from Address ad, People_Address pa where pa.id_number =
ad.ID_Number " _
& "and pa.id = " & strTemp
objAdp = New OleDbDataAdapte r(strSQL, objConn)
objAdp.Fill(obj DS, strTemp)
'If there are no rows, then repopulate with a new query
because the Repeater
'needs to have rows to work with
If objDS.Tables(st rTemp).Rows.Cou nt = 0 Then
strSQL = "select id_number from caseflow.people _address
where " _
& "address_fk is null and id = " & strTemp
objAdp.SelectCo mmand.CommandTe xt = strSQL
objDS.Tables(st rTemp).Columns. Clear()
objAdp.Fill(obj DS.Tables(strTe mp))
End If
Next
Response.Write( "<br>My count = " & objDS.Tables.Co unt)
Repeater1.DataS ource = objDS
Repeater1.DataB ind()
End If
End Sub 0 2828 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: .Net Newbie |
last post by:
I am relatively new to .Net and have been coding an intranet site for my
employer for a couple of months. I am currently stuck coding in a
text-editor called EditPlus without access to the VS.Net IDE, and coding
pages with the script directly in each page (not using the codebehind
method) as most of my learning material has demonstrated. I started with
the IBuySpy Portal (SDK version not VS Version) as my base portal and have
coded...
|
by: Donald Williamson |
last post by:
I have a DataReader that I am binding to a Repeater control. In the
DataReader, I have two fields: 'Name1' and 'Name2'
'Name1' will always have a person's name. Name2 periodically has a person's
name. So the question is if there is a value in 'Name2', I want to display
only that name. Otherwise, display 'Name1'
Any help on how to do this?
Using VS.NET - vb
|
by: Simon Harris |
last post by:
Hi All,
I have an app which requires a list of coutries to be displayed, so far I
have a datagrid which contains displays the countries Ok, along with flag
images, these are also links to my dtail page - So far so good (Thanks to
Pete Beech for the assistance in getting this far!)
What I would now like is to spread the countries across multiple columns -
e.g. grid/table with 20 countries, 5 rows X 5 columns. (Currently they are...
|
by: Antoine |
last post by:
I would like to construct my own list of items in a grid/ table/ item list
layout but I have a problem. I want to add a sort of index row based on
time, such as there might be blank values.
Sure the data list I have at the moment is in order, but I would like to
have each interval possible, and instead of repeating the row index (the
time value) I would like to list it once and then list the items within it
(the items associated with...
|
by: Maverick |
last post by:
Assume i have 2 tables stored in a single dataSet (ds) and the relationship
is well added
ds.Tables("product")
ds.Tables("descriptors")
what I want to do is show the data from 2 of the tables, linked by the
relationship, on the SAME DataGrid juz like the data is select by "Join" but
i cannot find the correct code to do this.
I am looking for something like:
| |
by: TJS |
last post by:
is there a way to have multiple footer rows before the paging control in a
datagrid ?
|
by: =?Utf-8?B?TG9zdEluTUQ=?= |
last post by:
Hi All :)
I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView.
True DBGrid has a MultipleLines property that controls whether individual
records span multiple lines. Is there an equivalent property for the
DataGridView? I have searched, but have not found one.
I would like the user to be able to see all the columns of the table on one
screen - thus eliminating the need to use the horizontal scroll bar to view...
|
by: nina297 |
last post by:
Hello,
I'm a newbie to .NET. Could someone please assist me. I am pulling
topics, questions and answers from a database. I've set all of this
code in the code behind page which works. I have the info going into
text boxes but would prefer it to all be displayed in a table. How do
I set that up, what's the code for that?
Dim cmd As New Data.SqlClient.SqlCommand
Dim con As New Data.SqlClient.SqlConnection
|
by: shriil |
last post by:
Hi
I have this database that calculates and stores the incentive amount
earned by employees of a particular department. Each record is
entered
by entering the Date, Shift (morn, eve, or night) and the 'employee
name'. There is another table which assigns an ID to the Shifts, i.e.
1,2 and 3 for morn, eve & night shifts respectively. From the mother
table, the incentive is calculated datewise for each employee as per
his shift duty. In...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |