What am I doing wrong

  • Thread starter Thread starter J
  • Start date Start date
J

J

Hi,

I've a problem with a page I've developed, and I can't see where I'm going
wrong.

I've created a dataset called "Recipients", and in this dataset, I've
created two tables, one called "DistList", the other "Members".

In my InitialisePage section, I'm running a routine that populates each
table.

On my page I have two buttons and a listbox, each button, when clicked, will
populate the listbox with the appropriate datatable.

So far, so good.

However there are two problems.

Firstly, I was under the impression that because I've already populated the
datatable at PageInitialise, the 'switch' from one table to the other should
be almost instant. It's not, it's still quite slow.

Secondly, I can switch from one to the other only once. If I go from A to
B, then try and go from B to A, I get the following error...

DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with
the name distListID.

My code is as follows...

SqlConnection1.Open()

sqlRetrieveFriendlyDistListNames.Parameters("@distID").Value = distID

daRecipients.SelectCommand = sqlRetrieveFriendlyDistListNames

daRecipients.Fill(dsRecipients, "distList")

SqlConnection1.Close()





SqlConnection1.Open()

sqlRetrieveUsersDownLineMembers.Parameters("@members").Value = membersString

daRecipients.SelectCommand = sqlRetrieveUsersDownLineMembers

daRecipients.Fill(dsRecipients, "membersList")

SqlConnection1.Close()





Private Sub btnDistributionList_Click(ByVal sender As System.Object, ByVal e
As System.Web.UI.ImageClickEventArgs) Handles btnDistributionList.Click

lstMembersAvailable.DataSource = dsRecipients

lstMembersAvailable.DataMember = "distList"

lstMembersAvailable.DataValueField = "distListID"

lstMembersAvailable.DataTextField = "friendlyName"

lstMembersAvailable.DataBind()

End Sub

Private Sub btnMembers_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles btnMembers.Click

lstMembersAvailable.DataSource = dsRecipients

lstMembersAvailable.DataMember = "membersList"

lstMembersAvailable.DataTextField = "distID"

lstMembersAvailable.DataTextField = "distName"

lstMembersAvailable.DataBind()

End Sub



Any ideas on why it's slow, and why the error.



TIA
 
Back
Top