Basically I have an SQLExpress database called FRA and a bunch of tables one of which is called tblClients. I need a way of identifying which Geographic areas these clients operate in.
Currently I have a field called MainArea - an int - and I use a Combobox to select 1 area - but I'm tying to expand this as many of the clients operate in more than 1 geographic area.
I've setup a basic BLL that I use to populate the list box:
Imports Microsoft.VisualBasic
Imports FRATableAdapters
Public Class GeographicAreasBLL
Private _tblGeographicAreaAdapter As tblGeographicAreaTableAdapter = Nothing
Protected ReadOnly Property Adapter() As tblGeographicAreaTableAdapter
Get
If _tblGeographicAreaAdapter Is Nothing Then
_tblGeographicAreaAdapter = New tblGeographicAreaTableAdapter()
End If
Return _tblGeographicAreaAdapter
End Get
End Property
<System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, True)> _
Public Function GetAllGeographicAreas() As FRA.tblGeographicAreaDataTable
Return Adapter.GetAllGeographicAreas()
End Function
End Class
/------------------------
The <b>GetAllGeographicAreas</b> is just a TableAdaptor query in the DAL's .xsd file:
SELECT ID, GeoArea
FROM tblGeographicArea
ORDER BY GeoArea
My ClientDetails.aspx page is:
<%@ Page Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="ClientDetails.aspx.vb" Inherits="Clients_ClientDetails" title="Untitled Page" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:FormView ID="FormView1" runat="server"
DataSourceID="ClientsDataSource" DataKeyNames="ID" DefaultMode="Edit">
<EditItemTemplate>
<table class="DetailsTable">
<tr>
<td>ID:</td>
<td><asp:Label ID="Label1" runat="server" Text='<%# Eval("ID") %>' /></td>
</tr>
<tr>
<td>Name:</td>
<td><asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' /></td>
</tr>
<tr>
<tr>
<td>Geographic Area:</td>
<td>
<asp:ListBox ID="ListBox1" runat="server"
DataSourceID="GeographicAreasDataSource" DataTextField="GeoArea"
DataValueField="ID"
selectedIndex ='<%# Bind("Area") %>'
AppendDataBoundItems="True" SelectionMode="Multiple">
<asp:ListItem Value="">(None)</asp:ListItem>
</asp:ListBox>
<asp:ObjectDataSource ID="GeographicAreasDataSource" runat="server"
InsertMethod="Insert" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetAllGeographicAreas"
TypeName="FRATableAdapters.tblGeographicAreaTableAdapter">
<InsertParameters>
<asp

arameter Name="GeoArea" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
</td>
</tr>
/-----------------------------------
Now I'm stuck and my knowledge of ASP.NET is limited.
In access I could:
1) Change the MainArea field to a memo or string and use a couple of functions to parse the string to select/save the options in a multi-select combo.
2) Create a second table called "ClientGeoArea" and again use a couple of functions to populate a combo and save the results back into the table.
Basically I need help...
Sorry if I've got any terminology wrong - just starting ASP.NET - and trust me to get stuck on my 2nd page.
I've managed to get my User and role access up and running - what I thought was going to be that hard bit - and now I've got stuck on a "simple" ListBox.
Again thanks inadvance of any help & guidance given.