I want to use a combo box in a form that gets its data from another sql table
in the same database that the form is bound to. I want to view "States" and
insert the value "ST_ID".

Re: How to bind dropdown by Thomas

Thomas
Fri Nov 10 13:56:26 CST 2006

Is the form a HTML form with a .asp extensions or is the form a Access form? If the form is Access,
then you need to post to the Access newsgroup.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage
==============================================
Agents Real Estate Listing Network
http://www.NReal.com
==============================================


"David Smith" <David Smith@discussions.microsoft.com> wrote in message
news:C2C1DFC7-084C-4D80-BF71-3DC6B6EB8617@microsoft.com...
>I want to use a combo box in a form that gets its data from another sql table
> in the same database that the form is bound to. I want to view "States" and
> insert the value "ST_ID".



Re: How to bind dropdown by DavidSmith

DavidSmith
Sat Nov 11 06:37:01 CST 2006

It is in an .aspx page that was put togather in FrontPage 2003. I found
validation code to add and got an e-mail function to work for me letting me
know when an order has been placed but I need a combo box to keep the state
that is entered to be correct. The database has a 1 to many relationship
beteen the state's abbreviation and the states names that I will be shipping
to. I want the combo box in the form "Orders" to receive info from a table
"States". I want the viewer to see the state's names but I want the
abbreviation to be inserted. I don't want a state that is not on the list.

If it was Access it would be easy(my openion only)

Thanks for your help!!

David Smith

"Thomas A. Rowe" wrote:

> Is the form a HTML form with a .asp extensions or is the form a Access form? If the form is Access,
> then you need to post to the Access newsgroup.
>
> --
> ==============================================
> Thomas A. Rowe
> Microsoft MVP - FrontPage
> ==============================================
> Agents Real Estate Listing Network
> http://www.NReal.com
> ==============================================
>
>
> "David Smith" <David Smith@discussions.microsoft.com> wrote in message
> news:C2C1DFC7-084C-4D80-BF71-3DC6B6EB8617@microsoft.com...
> >I want to use a combo box in a form that gets its data from another sql table
> > in the same database that the form is bound to. I want to view "States" and
> > insert the value "ST_ID".
>
>
>

Re: How to bind dropdown by David

David
Sat Nov 11 07:05:59 CST 2006

If this is an aspx page (ASP.NET) then you should try one of the .NET news
groups (microsoft.public.dotnet.*) since they would have more experts there
to help you code this in ASP.NET.


"David Smith" <DavidSmith@discussions.microsoft.com> wrote in message
news:5D749C29-4647-4989-9261-8697A286442A@microsoft.com...
> It is in an .aspx page that was put togather in FrontPage 2003. I found
> validation code to add and got an e-mail function to work for me letting
> me
> know when an order has been placed but I need a combo box to keep the
> state
> that is entered to be correct. The database has a 1 to many relationship
> beteen the state's abbreviation and the states names that I will be
> shipping
> to. I want the combo box in the form "Orders" to receive info from a table
> "States". I want the viewer to see the state's names but I want the
> abbreviation to be inserted. I don't want a state that is not on the list.
>
> If it was Access it would be easy(my openion only)
>
> Thanks for your help!!
>
> David Smith
>
> "Thomas A. Rowe" wrote:
>
>> Is the form a HTML form with a .asp extensions or is the form a Access
>> form? If the form is Access,
>> then you need to post to the Access newsgroup.
>>
>> --
>> ==============================================
>> Thomas A. Rowe
>> Microsoft MVP - FrontPage
>> ==============================================
>> Agents Real Estate Listing Network
>> http://www.NReal.com
>> ==============================================
>>
>>
>> "David Smith" <David Smith@discussions.microsoft.com> wrote in message
>> news:C2C1DFC7-084C-4D80-BF71-3DC6B6EB8617@microsoft.com...
>> >I want to use a combo box in a form that gets its data from another sql
>> >table
>> > in the same database that the form is bound to. I want to view "States"
>> > and
>> > insert the value "ST_ID".
>>
>>
>>



Re: How to bind dropdown by Thomas

Thomas
Sat Nov 11 10:05:55 CST 2006

Why not just create a drop down with just the supported states, i.e.:

<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage
==============================================
Agents Real Estate Listing Network
http://www.NReal.com
==============================================


"David Smith" <DavidSmith@discussions.microsoft.com> wrote in message
news:5D749C29-4647-4989-9261-8697A286442A@microsoft.com...
> It is in an .aspx page that was put togather in FrontPage 2003. I found
> validation code to add and got an e-mail function to work for me letting me
> know when an order has been placed but I need a combo box to keep the state
> that is entered to be correct. The database has a 1 to many relationship
> beteen the state's abbreviation and the states names that I will be shipping
> to. I want the combo box in the form "Orders" to receive info from a table
> "States". I want the viewer to see the state's names but I want the
> abbreviation to be inserted. I don't want a state that is not on the list.
>
> If it was Access it would be easy(my openion only)
>
> Thanks for your help!!
>
> David Smith
>
> "Thomas A. Rowe" wrote:
>
>> Is the form a HTML form with a .asp extensions or is the form a Access form? If the form is
>> Access,
>> then you need to post to the Access newsgroup.
>>
>> --
>> ==============================================
>> Thomas A. Rowe
>> Microsoft MVP - FrontPage
>> ==============================================
>> Agents Real Estate Listing Network
>> http://www.NReal.com
>> ==============================================
>>
>>
>> "David Smith" <David Smith@discussions.microsoft.com> wrote in message
>> news:C2C1DFC7-084C-4D80-BF71-3DC6B6EB8617@microsoft.com...
>> >I want to use a combo box in a form that gets its data from another sql table
>> > in the same database that the form is bound to. I want to view "States" and
>> > insert the value "ST_ID".
>>
>>
>>



Re: How to bind dropdown by David

David
Sat Nov 11 10:29:30 CST 2006

Tom,

That would be a good way for a normal HTML page but he said this was an aspx
(ASP.NET) page so that wouldn't be the most efficient way of doing it in
.NET. For example, you could do it this way:

<asp:DropDownList id="listState" runat="server"></asp:DropDownList>

Then you'd create a function to load the list. Ex:


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

' Check if page is loaded for the first time
If Not Page.IsPostBack Then
' Load the drop down list on the Page
LoadList()
End If
End Sub

Private Sub LoadList()

' Load the States Listbox
listState.Items.Add("Select your State")
listState.Items.Add(New ListItem("CA", "California"))
listState.Items.Add(New ListItem("CO", "Colorado"))
listState.Items.Add(New ListItem("CT", "Connecticut"))
listState.Items.Add(New ListItem("DE", "Delaware"))

... etc

listState.DataBind()
listState.SelectedIndex = 0
End Sub



"Thomas A. Rowe" <tarowe@mvps.org> wrote in message
news:%237NcGtaBHHA.996@TK2MSFTNGP02.phx.gbl...
> Why not just create a drop down with just the supported states, i.e.:
>
> <option value="CA">California</option>
> <option value="CO">Colorado</option>
> <option value="CT">Connecticut</option>
> <option value="DE">Delaware</option>
>
> --
> ==============================================
> Thomas A. Rowe
> Microsoft MVP - FrontPage
> ==============================================
> Agents Real Estate Listing Network
> http://www.NReal.com
> ==============================================
>
>
> "David Smith" <DavidSmith@discussions.microsoft.com> wrote in message
> news:5D749C29-4647-4989-9261-8697A286442A@microsoft.com...
>> It is in an .aspx page that was put togather in FrontPage 2003. I found
>> validation code to add and got an e-mail function to work for me letting
>> me
>> know when an order has been placed but I need a combo box to keep the
>> state
>> that is entered to be correct. The database has a 1 to many relationship
>> beteen the state's abbreviation and the states names that I will be
>> shipping
>> to. I want the combo box in the form "Orders" to receive info from a
>> table
>> "States". I want the viewer to see the state's names but I want the
>> abbreviation to be inserted. I don't want a state that is not on the
>> list.
>>
>> If it was Access it would be easy(my openion only)
>>
>> Thanks for your help!!
>>
>> David Smith
>>
>> "Thomas A. Rowe" wrote:
>>
>>> Is the form a HTML form with a .asp extensions or is the form a Access
>>> form? If the form is Access,
>>> then you need to post to the Access newsgroup.
>>>
>>> --
>>> ==============================================
>>> Thomas A. Rowe
>>> Microsoft MVP - FrontPage
>>> ==============================================
>>> Agents Real Estate Listing Network
>>> http://www.NReal.com
>>> ==============================================
>>>
>>>
>>> "David Smith" <David Smith@discussions.microsoft.com> wrote in message
>>> news:C2C1DFC7-084C-4D80-BF71-3DC6B6EB8617@microsoft.com...
>>> >I want to use a combo box in a form that gets its data from another sql
>>> >table
>>> > in the same database that the form is bound to. I want to view
>>> > "States" and
>>> > insert the value "ST_ID".
>>>
>>>
>>>
>
>



Re: How to bind dropdown by Thomas

Thomas
Sat Nov 11 10:33:46 CST 2006

But if it is just a small list where would the saving be in running it from the server?

Even the 50 states is not a big list.
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage
==============================================
Agents Real Estate Listing Network
http://www.NReal.com
==============================================


"David Berry" <dberry@mvps.org> wrote in message news:OPkcP6aBHHA.5068@TK2MSFTNGP02.phx.gbl...
> Tom,
>
> That would be a good way for a normal HTML page but he said this was an aspx (ASP.NET) page so
> that wouldn't be the most efficient way of doing it in .NET. For example, you could do it this
> way:
>
> <asp:DropDownList id="listState" runat="server"></asp:DropDownList>
>
> Then you'd create a function to load the list. Ex:
>
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
> MyBase.Load
>
> ' Check if page is loaded for the first time
> If Not Page.IsPostBack Then
> ' Load the drop down list on the Page
> LoadList()
> End If
> End Sub
>
> Private Sub LoadList()
>
> ' Load the States Listbox
> listState.Items.Add("Select your State")
> listState.Items.Add(New ListItem("CA", "California"))
> listState.Items.Add(New ListItem("CO", "Colorado"))
> listState.Items.Add(New ListItem("CT", "Connecticut"))
> listState.Items.Add(New ListItem("DE", "Delaware"))
>
> ... etc
>
> listState.DataBind()
> listState.SelectedIndex = 0
> End Sub
>
>
>
> "Thomas A. Rowe" <tarowe@mvps.org> wrote in message news:%237NcGtaBHHA.996@TK2MSFTNGP02.phx.gbl...
>> Why not just create a drop down with just the supported states, i.e.:
>>
>> <option value="CA">California</option>
>> <option value="CO">Colorado</option>
>> <option value="CT">Connecticut</option>
>> <option value="DE">Delaware</option>
>>
>> --
>> ==============================================
>> Thomas A. Rowe
>> Microsoft MVP - FrontPage
>> ==============================================
>> Agents Real Estate Listing Network
>> http://www.NReal.com
>> ==============================================
>>
>>
>> "David Smith" <DavidSmith@discussions.microsoft.com> wrote in message
>> news:5D749C29-4647-4989-9261-8697A286442A@microsoft.com...
>>> It is in an .aspx page that was put togather in FrontPage 2003. I found
>>> validation code to add and got an e-mail function to work for me letting me
>>> know when an order has been placed but I need a combo box to keep the state
>>> that is entered to be correct. The database has a 1 to many relationship
>>> beteen the state's abbreviation and the states names that I will be shipping
>>> to. I want the combo box in the form "Orders" to receive info from a table
>>> "States". I want the viewer to see the state's names but I want the
>>> abbreviation to be inserted. I don't want a state that is not on the list.
>>>
>>> If it was Access it would be easy(my openion only)
>>>
>>> Thanks for your help!!
>>>
>>> David Smith
>>>
>>> "Thomas A. Rowe" wrote:
>>>
>>>> Is the form a HTML form with a .asp extensions or is the form a Access form? If the form is
>>>> Access,
>>>> then you need to post to the Access newsgroup.
>>>>
>>>> --
>>>> ==============================================
>>>> Thomas A. Rowe
>>>> Microsoft MVP - FrontPage
>>>> ==============================================
>>>> Agents Real Estate Listing Network
>>>> http://www.NReal.com
>>>> ==============================================
>>>>
>>>>
>>>> "David Smith" <David Smith@discussions.microsoft.com> wrote in message
>>>> news:C2C1DFC7-084C-4D80-BF71-3DC6B6EB8617@microsoft.com...
>>>> >I want to use a combo box in a form that gets its data from another sql table
>>>> > in the same database that the form is bound to. I want to view "States" and
>>>> > insert the value "ST_ID".
>>>>
>>>>
>>>>
>>
>>
>
>



Re: How to bind dropdown by David

David
Sat Nov 11 11:02:52 CST 2006

I'm not saying you couldn't do it that way, just that It's just more
efficient to use the ASP.NET controls in a form. Otherwise why even bother
making it a .NET page. It's also easier to reference them later if you want
to do anything with inserting the values into a database.


"Thomas A. Rowe" <tarowe@mvps.org> wrote in message
news:%23wcPq8aBHHA.3540@TK2MSFTNGP03.phx.gbl...
> But if it is just a small list where would the saving be in running it
> from the server?
>
> Even the 50 states is not a big list.
> --
> ==============================================
> Thomas A. Rowe
> Microsoft MVP - FrontPage
> ==============================================
> Agents Real Estate Listing Network
> http://www.NReal.com
> ==============================================
>
>
> "David Berry" <dberry@mvps.org> wrote in message
> news:OPkcP6aBHHA.5068@TK2MSFTNGP02.phx.gbl...
>> Tom,
>>
>> That would be a good way for a normal HTML page but he said this was an
>> aspx (ASP.NET) page so that wouldn't be the most efficient way of doing
>> it in .NET. For example, you could do it this way:
>>
>> <asp:DropDownList id="listState" runat="server"></asp:DropDownList>
>>
>> Then you'd create a function to load the list. Ex:
>>
>>
>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
>> System.EventArgs) Handles MyBase.Load
>>
>> ' Check if page is loaded for the first time
>> If Not Page.IsPostBack Then
>> ' Load the drop down list on the Page
>> LoadList()
>> End If
>> End Sub
>>
>> Private Sub LoadList()
>>
>> ' Load the States Listbox
>> listState.Items.Add("Select your State")
>> listState.Items.Add(New ListItem("CA", "California"))
>> listState.Items.Add(New ListItem("CO", "Colorado"))
>> listState.Items.Add(New ListItem("CT", "Connecticut"))
>> listState.Items.Add(New ListItem("DE", "Delaware"))
>>
>> ... etc
>>
>> listState.DataBind()
>> listState.SelectedIndex = 0
>> End Sub
>>
>>
>>
>> "Thomas A. Rowe" <tarowe@mvps.org> wrote in message
>> news:%237NcGtaBHHA.996@TK2MSFTNGP02.phx.gbl...
>>> Why not just create a drop down with just the supported states, i.e.:
>>>
>>> <option value="CA">California</option>
>>> <option value="CO">Colorado</option>
>>> <option value="CT">Connecticut</option>
>>> <option value="DE">Delaware</option>
>>>
>>> --
>>> ==============================================
>>> Thomas A. Rowe
>>> Microsoft MVP - FrontPage
>>> ==============================================
>>> Agents Real Estate Listing Network
>>> http://www.NReal.com
>>> ==============================================
>>>
>>>
>>> "David Smith" <DavidSmith@discussions.microsoft.com> wrote in message
>>> news:5D749C29-4647-4989-9261-8697A286442A@microsoft.com...
>>>> It is in an .aspx page that was put togather in FrontPage 2003. I found
>>>> validation code to add and got an e-mail function to work for me
>>>> letting me
>>>> know when an order has been placed but I need a combo box to keep the
>>>> state
>>>> that is entered to be correct. The database has a 1 to many
>>>> relationship
>>>> beteen the state's abbreviation and the states names that I will be
>>>> shipping
>>>> to. I want the combo box in the form "Orders" to receive info from a
>>>> table
>>>> "States". I want the viewer to see the state's names but I want the
>>>> abbreviation to be inserted. I don't want a state that is not on the
>>>> list.
>>>>
>>>> If it was Access it would be easy(my openion only)
>>>>
>>>> Thanks for your help!!
>>>>
>>>> David Smith
>>>>
>>>> "Thomas A. Rowe" wrote:
>>>>
>>>>> Is the form a HTML form with a .asp extensions or is the form a Access
>>>>> form? If the form is Access,
>>>>> then you need to post to the Access newsgroup.
>>>>>
>>>>> --
>>>>> ==============================================
>>>>> Thomas A. Rowe
>>>>> Microsoft MVP - FrontPage
>>>>> ==============================================
>>>>> Agents Real Estate Listing Network
>>>>> http://www.NReal.com
>>>>> ==============================================
>>>>>
>>>>>
>>>>> "David Smith" <David Smith@discussions.microsoft.com> wrote in message
>>>>> news:C2C1DFC7-084C-4D80-BF71-3DC6B6EB8617@microsoft.com...
>>>>> >I want to use a combo box in a form that gets its data from another
>>>>> >sql table
>>>>> > in the same database that the form is bound to. I want to view
>>>>> > "States" and
>>>>> > insert the value "ST_ID".
>>>>>
>>>>>
>>>>>
>>>
>>>
>>
>>
>
>



Re: How to bind dropdown by Thomas

Thomas
Sat Nov 11 12:21:53 CST 2006

Ok.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage
==============================================
Agents Real Estate Listing Network
http://www.NReal.com
==============================================


"David Berry" <dberry@mvps.org> wrote in message news:ODOH5MbBHHA.4864@TK2MSFTNGP04.phx.gbl...
> I'm not saying you couldn't do it that way, just that It's just more efficient to use the ASP.NET
> controls in a form. Otherwise why even bother making it a .NET page. It's also easier to reference
> them later if you want to do anything with inserting the values into a database.
>
>
> "Thomas A. Rowe" <tarowe@mvps.org> wrote in message
> news:%23wcPq8aBHHA.3540@TK2MSFTNGP03.phx.gbl...
>> But if it is just a small list where would the saving be in running it from the server?
>>
>> Even the 50 states is not a big list.
>> --
>> ==============================================
>> Thomas A. Rowe
>> Microsoft MVP - FrontPage
>> ==============================================
>> Agents Real Estate Listing Network
>> http://www.NReal.com
>> ==============================================
>>
>>
>> "David Berry" <dberry@mvps.org> wrote in message news:OPkcP6aBHHA.5068@TK2MSFTNGP02.phx.gbl...
>>> Tom,
>>>
>>> That would be a good way for a normal HTML page but he said this was an aspx (ASP.NET) page so
>>> that wouldn't be the most efficient way of doing it in .NET. For example, you could do it this
>>> way:
>>>
>>> <asp:DropDownList id="listState" runat="server"></asp:DropDownList>
>>>
>>> Then you'd create a function to load the list. Ex:
>>>
>>>
>>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
>>> MyBase.Load
>>>
>>> ' Check if page is loaded for the first time
>>> If Not Page.IsPostBack Then
>>> ' Load the drop down list on the Page
>>> LoadList()
>>> End If
>>> End Sub
>>>
>>> Private Sub LoadList()
>>>
>>> ' Load the States Listbox
>>> listState.Items.Add("Select your State")
>>> listState.Items.Add(New ListItem("CA", "California"))
>>> listState.Items.Add(New ListItem("CO", "Colorado"))
>>> listState.Items.Add(New ListItem("CT", "Connecticut"))
>>> listState.Items.Add(New ListItem("DE", "Delaware"))
>>>
>>> ... etc
>>>
>>> listState.DataBind()
>>> listState.SelectedIndex = 0
>>> End Sub
>>>
>>>
>>>
>>> "Thomas A. Rowe" <tarowe@mvps.org> wrote in message
>>> news:%237NcGtaBHHA.996@TK2MSFTNGP02.phx.gbl...
>>>> Why not just create a drop down with just the supported states, i.e.:
>>>>
>>>> <option value="CA">California</option>
>>>> <option value="CO">Colorado</option>
>>>> <option value="CT">Connecticut</option>
>>>> <option value="DE">Delaware</option>
>>>>
>>>> --
>>>> ==============================================
>>>> Thomas A. Rowe
>>>> Microsoft MVP - FrontPage
>>>> ==============================================
>>>> Agents Real Estate Listing Network
>>>> http://www.NReal.com
>>>> ==============================================
>>>>
>>>>
>>>> "David Smith" <DavidSmith@discussions.microsoft.com> wrote in message
>>>> news:5D749C29-4647-4989-9261-8697A286442A@microsoft.com...
>>>>> It is in an .aspx page that was put togather in FrontPage 2003. I found
>>>>> validation code to add and got an e-mail function to work for me letting me
>>>>> know when an order has been placed but I need a combo box to keep the state
>>>>> that is entered to be correct. The database has a 1 to many relationship
>>>>> beteen the state's abbreviation and the states names that I will be shipping
>>>>> to. I want the combo box in the form "Orders" to receive info from a table
>>>>> "States". I want the viewer to see the state's names but I want the
>>>>> abbreviation to be inserted. I don't want a state that is not on the list.
>>>>>
>>>>> If it was Access it would be easy(my openion only)
>>>>>
>>>>> Thanks for your help!!
>>>>>
>>>>> David Smith
>>>>>
>>>>> "Thomas A. Rowe" wrote:
>>>>>
>>>>>> Is the form a HTML form with a .asp extensions or is the form a Access form? If the form is
>>>>>> Access,
>>>>>> then you need to post to the Access newsgroup.
>>>>>>
>>>>>> --
>>>>>> ==============================================
>>>>>> Thomas A. Rowe
>>>>>> Microsoft MVP - FrontPage
>>>>>> ==============================================
>>>>>> Agents Real Estate Listing Network
>>>>>> http://www.NReal.com
>>>>>> ==============================================
>>>>>>
>>>>>>
>>>>>> "David Smith" <David Smith@discussions.microsoft.com> wrote in message
>>>>>> news:C2C1DFC7-084C-4D80-BF71-3DC6B6EB8617@microsoft.com...
>>>>>> >I want to use a combo box in a form that gets its data from another sql table
>>>>>> > in the same database that the form is bound to. I want to view "States" and
>>>>>> > insert the value "ST_ID".
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>