Hello,
I have done the following to bind data to a DropDown box:
1. Drag SQLServer table onto web form to create data connection and data
adapter.
2. Generate dataset by right-clicking on the data adapter ad selecting
generate dataset.
3. Setting the drop down box propertied to reflect so that:
Datasource = Dataset11
Datamember = table
Datatextfield = tablerow
Datavaluefield = tablerow
When I run the application I don't generate any errors, but no data is
present in the DropDown box...Well, actually I get a drop down that is
blank.
Any ideas an what Imay be doing wrong?
Also, if I code the information, can I put it in the CodeBehind file or does
it have to be in the actual ASPX?
Thanks in advance,
Kris 8 903
Did you call the .DataBind method of the DropDown box?
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in
message news:Od**************@TK2MSFTNGP09.phx.gbl... Hello,
I have done the following to bind data to a DropDown box:
1. Drag SQLServer table onto web form to create data connection and data adapter.
2. Generate dataset by right-clicking on the data adapter ad selecting generate dataset.
3. Setting the drop down box propertied to reflect so that:
Datasource = Dataset11 Datamember = table Datatextfield = tablerow Datavaluefield = tablerow
When I run the application I don't generate any errors, but no data is present in the DropDown box...Well, actually I get a drop down that is blank.
Any ideas an what Imay be doing wrong?
Also, if I code the information, can I put it in the CodeBehind file or
does it have to be in the actual ASPX?
Thanks in advance, Kris
I haven't explicitly called it in the code, but I have set it in the
Property page of the DropDown Box.
I did try it though and still got no results. It is strange, though...The
box seems populated in that I can drop it down, but there is no content as
there should be.
Kris
"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:#K**************@TK2MSFTNGP09.phx.gbl... Did you call the .DataBind method of the DropDown box?
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote
in message news:Od**************@TK2MSFTNGP09.phx.gbl... Hello,
I have done the following to bind data to a DropDown box:
1. Drag SQLServer table onto web form to create data connection and data adapter.
2. Generate dataset by right-clicking on the data adapter ad selecting generate dataset.
3. Setting the drop down box propertied to reflect so that:
Datasource = Dataset11 Datamember = table Datatextfield = tablerow Datavaluefield = tablerow
When I run the application I don't generate any errors, but no data is present in the DropDown box...Well, actually I get a drop down that is blank.
Any ideas an what Imay be doing wrong?
Also, if I code the information, can I put it in the CodeBehind file or does it have to be in the actual ASPX?
Thanks in advance, Kris
You can't call the DataBind method (or any method of any object for that
matter) via the design-time property box. It must be called from code. The
fact that the box drops down with noting in it is what all drop down boxes
that don't have data in them do.
Let's see your entire Page_Load event handler.
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in
message news:eD**************@TK2MSFTNGP12.phx.gbl... I haven't explicitly called it in the code, but I have set it in the Property page of the DropDown Box.
I did try it though and still got no results. It is strange, though...The box seems populated in that I can drop it down, but there is no content as there should be.
Kris
"Scott M." <s-***@BADSPAMsnet.net> wrote in message news:#K**************@TK2MSFTNGP09.phx.gbl... Did you call the .DataBind method of the DropDown box?
"Kris Rockwell" <kr***************************@hybrid-learning.com>
wrote in message news:Od**************@TK2MSFTNGP09.phx.gbl... Hello,
I have done the following to bind data to a DropDown box:
1. Drag SQLServer table onto web form to create data connection and
data adapter.
2. Generate dataset by right-clicking on the data adapter ad selecting generate dataset.
3. Setting the drop down box propertied to reflect so that:
Datasource = Dataset11 Datamember = table Datatextfield = tablerow Datavaluefield = tablerow
When I run the application I don't generate any errors, but no data is present in the DropDown box...Well, actually I get a drop down that is blank.
Any ideas an what Imay be doing wrong?
Also, if I code the information, can I put it in the CodeBehind file
or does it have to be in the actual ASPX?
Thanks in advance, Kris
Here is the code:
Sub Page_Load
cbACType.DataBind()
End Sub
The database connection information is in my CodeBehind vb file.
Regards,
Kris
"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:#Y**************@TK2MSFTNGP12.phx.gbl... You can't call the DataBind method (or any method of any object for that matter) via the design-time property box. It must be called from code.
The fact that the box drops down with noting in it is what all drop down boxes that don't have data in them do.
Let's see your entire Page_Load event handler.
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote
in message news:eD**************@TK2MSFTNGP12.phx.gbl... I haven't explicitly called it in the code, but I have set it in the Property page of the DropDown Box.
I did try it though and still got no results. It is strange,
though...The box seems populated in that I can drop it down, but there is no content
as there should be.
Kris
"Scott M." <s-***@BADSPAMsnet.net> wrote in message news:#K**************@TK2MSFTNGP09.phx.gbl... Did you call the .DataBind method of the DropDown box?
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in message news:Od**************@TK2MSFTNGP09.phx.gbl... > Hello, > > I have done the following to bind data to a DropDown box: > > 1. Drag SQLServer table onto web form to create data connection and data > adapter. > > 2. Generate dataset by right-clicking on the data adapter ad
selecting > generate dataset. > > 3. Setting the drop down box propertied to reflect so that: > > Datasource = Dataset11 > Datamember = table > Datatextfield = tablerow > Datavaluefield = tablerow > > When I run the application I don't generate any errors, but no data
is > present in the DropDown box...Well, actually I get a drop down that
is > blank. > > Any ideas an what Imay be doing wrong? > > Also, if I code the information, can I put it in the CodeBehind file or does > it have to be in the actual ASPX? > > Thanks in advance, > Kris > >
Can we have the db connection code as well?
By the way, only call the DataBind method on the first page call (ViewState
will take care of keeping the dropdown list populated after that. So, your
page_load code should be:
Sub Page_Load
If Not IsPostBack Then
cbACType.DataBind()
End If
End Sub
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in
message news:un**************@TK2MSFTNGP10.phx.gbl... Here is the code:
Sub Page_Load cbACType.DataBind() End Sub
The database connection information is in my CodeBehind vb file.
Regards, Kris "Scott M." <s-***@BADSPAMsnet.net> wrote in message news:#Y**************@TK2MSFTNGP12.phx.gbl... You can't call the DataBind method (or any method of any object for that matter) via the design-time property box. It must be called from code. The fact that the box drops down with noting in it is what all drop down
boxes that don't have data in them do.
Let's see your entire Page_Load event handler.
"Kris Rockwell" <kr***************************@hybrid-learning.com>
wrote in message news:eD**************@TK2MSFTNGP12.phx.gbl... I haven't explicitly called it in the code, but I have set it in the Property page of the DropDown Box.
I did try it though and still got no results. It is strange, though...The box seems populated in that I can drop it down, but there is no
content as there should be.
Kris
"Scott M." <s-***@BADSPAMsnet.net> wrote in message news:#K**************@TK2MSFTNGP09.phx.gbl... > Did you call the .DataBind method of the DropDown box? > > > "Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in > message news:Od**************@TK2MSFTNGP09.phx.gbl... > > Hello, > > > > I have done the following to bind data to a DropDown box: > > > > 1. Drag SQLServer table onto web form to create data connection
and data > > adapter. > > > > 2. Generate dataset by right-clicking on the data adapter ad selecting > > generate dataset. > > > > 3. Setting the drop down box propertied to reflect so that: > > > > Datasource = Dataset11 > > Datamember = table > > Datatextfield = tablerow > > Datavaluefield = tablerow > > > > When I run the application I don't generate any errors, but no
data is > > present in the DropDown box...Well, actually I get a drop down
that is > > blank. > > > > Any ideas an what Imay be doing wrong? > > > > Also, if I code the information, can I put it in the CodeBehind
file or > does > > it have to be in the actual ASPX? > > > > Thanks in advance, > > Kris > > > > > >
Well, I have kep the DB connection in the code behind page in an effort to
keep it seperate (and thus away from the eyes of curious users) from the
ASPX. In testing different methods I have deleted from the VB code at the
moment,so I will have to write it back in before I post the code. Couldn't I
use the Connection and DataAdapter objects within .NET for this?
Kris
"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:#t*************@TK2MSFTNGP12.phx.gbl... Can we have the db connection code as well?
By the way, only call the DataBind method on the first page call
(ViewState will take care of keeping the dropdown list populated after that. So,
your page_load code should be:
Sub Page_Load If Not IsPostBack Then cbACType.DataBind() End If End Sub
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote
in message news:un**************@TK2MSFTNGP10.phx.gbl... Here is the code:
Sub Page_Load cbACType.DataBind() End Sub
The database connection information is in my CodeBehind vb file.
Regards, Kris "Scott M." <s-***@BADSPAMsnet.net> wrote in message news:#Y**************@TK2MSFTNGP12.phx.gbl... You can't call the DataBind method (or any method of any object for
that matter) via the design-time property box. It must be called from
code. The fact that the box drops down with noting in it is what all drop down boxes that don't have data in them do.
Let's see your entire Page_Load event handler.
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in message news:eD**************@TK2MSFTNGP12.phx.gbl... > I haven't explicitly called it in the code, but I have set it in the > Property page of the DropDown Box. > > I did try it though and still got no results. It is strange, though...The > box seems populated in that I can drop it down, but there is no content as > there should be. > > Kris > > > "Scott M." <s-***@BADSPAMsnet.net> wrote in message > news:#K**************@TK2MSFTNGP09.phx.gbl... > > Did you call the .DataBind method of the DropDown box? > > > > > > "Kris Rockwell"
<kr***************************@hybrid-learning.com> wrote > in > > message news:Od**************@TK2MSFTNGP09.phx.gbl... > > > Hello, > > > > > > I have done the following to bind data to a DropDown box: > > > > > > 1. Drag SQLServer table onto web form to create data connection
and data > > > adapter. > > > > > > 2. Generate dataset by right-clicking on the data adapter ad selecting > > > generate dataset. > > > > > > 3. Setting the drop down box propertied to reflect so that: > > > > > > Datasource = Dataset11 > > > Datamember = table > > > Datatextfield = tablerow > > > Datavaluefield = tablerow > > > > > > When I run the application I don't generate any errors, but no data is > > > present in the DropDown box...Well, actually I get a drop down that is > > > blank. > > > > > > Any ideas an what Imay be doing wrong? > > > > > > Also, if I code the information, can I put it in the CodeBehind file or > > does > > > it have to be in the actual ASPX? > > > > > > Thanks in advance, > > > Kris > > > > > > > > > > > >
Kris,
All of your compiled code goes in the code-behind. That is what it is there
for. Even if you use the Visual DataAdapter and Connection controls, you
are still working with code in the code-behind. When you use those
controls, code is written for you in the code-behind, instead of you
declaring and configuring the classes yourself.
Regardless of whether or not you use the controls or write the code
yourself, we need to see your code in order to help you solve your problem.
Since all it really takes to get the DropDownList control working is to set
its DataSource and DataField properties and then to call its DataBind method
on the first page call (and you seem to have done that), we can assume that:
either your database connection is not setup correctly or
you are connecting to the db, but not retuning any data
We won't know until you provide us with everything you have.
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in
message news:uG*************@TK2MSFTNGP09.phx.gbl... Well, I have kep the DB connection in the code behind page in an effort to keep it seperate (and thus away from the eyes of curious users) from the ASPX. In testing different methods I have deleted from the VB code at the moment,so I will have to write it back in before I post the code. Couldn't
I use the Connection and DataAdapter objects within .NET for this?
Kris
"Scott M." <s-***@BADSPAMsnet.net> wrote in message news:#t*************@TK2MSFTNGP12.phx.gbl... Can we have the db connection code as well?
By the way, only call the DataBind method on the first page call (ViewState will take care of keeping the dropdown list populated after that. So, your page_load code should be:
Sub Page_Load If Not IsPostBack Then cbACType.DataBind() End If End Sub
"Kris Rockwell" <kr***************************@hybrid-learning.com>
wrote in message news:un**************@TK2MSFTNGP10.phx.gbl... Here is the code:
Sub Page_Load cbACType.DataBind() End Sub
The database connection information is in my CodeBehind vb file.
Regards, Kris "Scott M." <s-***@BADSPAMsnet.net> wrote in message news:#Y**************@TK2MSFTNGP12.phx.gbl... > You can't call the DataBind method (or any method of any object for that > matter) via the design-time property box. It must be called from code. The > fact that the box drops down with noting in it is what all drop down boxes > that don't have data in them do. > > Let's see your entire Page_Load event handler. > > > "Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in > message news:eD**************@TK2MSFTNGP12.phx.gbl... > > I haven't explicitly called it in the code, but I have set it in
the > > Property page of the DropDown Box. > > > > I did try it though and still got no results. It is strange, though...The > > box seems populated in that I can drop it down, but there is no content as > > there should be. > > > > Kris > > > > > > "Scott M." <s-***@BADSPAMsnet.net> wrote in message > > news:#K**************@TK2MSFTNGP09.phx.gbl... > > > Did you call the .DataBind method of the DropDown box? > > > > > > > > > "Kris Rockwell" <kr***************************@hybrid-learning.com> > wrote > > in > > > message news:Od**************@TK2MSFTNGP09.phx.gbl... > > > > Hello, > > > > > > > > I have done the following to bind data to a DropDown box: > > > > > > > > 1. Drag SQLServer table onto web form to create data
connection and > data > > > > adapter. > > > > > > > > 2. Generate dataset by right-clicking on the data adapter ad selecting > > > > generate dataset. > > > > > > > > 3. Setting the drop down box propertied to reflect so that: > > > > > > > > Datasource = Dataset11 > > > > Datamember = table > > > > Datatextfield = tablerow > > > > Datavaluefield = tablerow > > > > > > > > When I run the application I don't generate any errors, but no data is > > > > present in the DropDown box...Well, actually I get a drop down that is > > > > blank. > > > > > > > > Any ideas an what Imay be doing wrong? > > > > > > > > Also, if I code the information, can I put it in the
CodeBehind file > or > > > does > > > > it have to be in the actual ASPX? > > > > > > > > Thanks in advance, > > > > Kris > > > > > > > > > > > > > > > > > > > >
OK...I got it.
I created a SQLConnection, DataAdapter and Dataset. In the Page load I had
to call the DataBin() and fill the dataset. That was the problem, the
Dataset wasn't being filled.
Thanks for all of your help.
Regards,
Kris
"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:OR**************@TK2MSFTNGP12.phx.gbl... Kris,
All of your compiled code goes in the code-behind. That is what it is
there for. Even if you use the Visual DataAdapter and Connection controls, you are still working with code in the code-behind. When you use those controls, code is written for you in the code-behind, instead of you declaring and configuring the classes yourself.
Regardless of whether or not you use the controls or write the code yourself, we need to see your code in order to help you solve your
problem. Since all it really takes to get the DropDownList control working is to
set its DataSource and DataField properties and then to call its DataBind
method on the first page call (and you seem to have done that), we can assume
that: either your database connection is not setup correctly or you are connecting to the db, but not retuning any data
We won't know until you provide us with everything you have.
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote
in message news:uG*************@TK2MSFTNGP09.phx.gbl... Well, I have kep the DB connection in the code behind page in an effort
to keep it seperate (and thus away from the eyes of curious users) from the ASPX. In testing different methods I have deleted from the VB code at
the moment,so I will have to write it back in before I post the code.
Couldn't I use the Connection and DataAdapter objects within .NET for this?
Kris
"Scott M." <s-***@BADSPAMsnet.net> wrote in message news:#t*************@TK2MSFTNGP12.phx.gbl... Can we have the db connection code as well?
By the way, only call the DataBind method on the first page call (ViewState will take care of keeping the dropdown list populated after that. So, your page_load code should be:
Sub Page_Load If Not IsPostBack Then cbACType.DataBind() End If End Sub
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in message news:un**************@TK2MSFTNGP10.phx.gbl... > Here is the code: > > Sub Page_Load > cbACType.DataBind() > End Sub > > The database connection information is in my CodeBehind vb file. > > Regards, > Kris > "Scott M." <s-***@BADSPAMsnet.net> wrote in message > news:#Y**************@TK2MSFTNGP12.phx.gbl... > > You can't call the DataBind method (or any method of any object
for that > > matter) via the design-time property box. It must be called from code. > The > > fact that the box drops down with noting in it is what all drop
down boxes > > that don't have data in them do. > > > > Let's see your entire Page_Load event handler. > > > > > > "Kris Rockwell"
<kr***************************@hybrid-learning.com> wrote > in > > message news:eD**************@TK2MSFTNGP12.phx.gbl... > > > I haven't explicitly called it in the code, but I have set it in the > > > Property page of the DropDown Box. > > > > > > I did try it though and still got no results. It is strange, > though...The > > > box seems populated in that I can drop it down, but there is no content > as > > > there should be. > > > > > > Kris > > > > > > > > > "Scott M." <s-***@BADSPAMsnet.net> wrote in message > > > news:#K**************@TK2MSFTNGP09.phx.gbl... > > > > Did you call the .DataBind method of the DropDown box? > > > > > > > > > > > > "Kris Rockwell"
<kr***************************@hybrid-learning.com> > > wrote > > > in > > > > message news:Od**************@TK2MSFTNGP09.phx.gbl... > > > > > Hello, > > > > > > > > > > I have done the following to bind data to a DropDown box: > > > > > > > > > > 1. Drag SQLServer table onto web form to create data connection and > > data > > > > > adapter. > > > > > > > > > > 2. Generate dataset by right-clicking on the data adapter ad > selecting > > > > > generate dataset. > > > > > > > > > > 3. Setting the drop down box propertied to reflect so that: > > > > > > > > > > Datasource = Dataset11 > > > > > Datamember = table > > > > > Datatextfield = tablerow > > > > > Datavaluefield = tablerow > > > > > > > > > > When I run the application I don't generate any errors, but
no data > is > > > > > present in the DropDown box...Well, actually I get a drop
down that > is > > > > > blank. > > > > > > > > > > Any ideas an what Imay be doing wrong? > > > > > > > > > > Also, if I code the information, can I put it in the CodeBehind file > > or > > > > does > > > > > it have to be in the actual ASPX? > > > > > > > > > > Thanks in advance, > > > > > Kris > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Kris Rockwell |
last post by:
Hello,
I have done the following to bind data to a DropDown box:
1. Drag SQLServer table onto web form to create data connection and data
adapter.
2. Generate dataset by right-clicking on...
|
by: John Blair |
last post by:
Hi,
I want to select an id column and a name column from the database
and have the results databound to a SINGLE dropdown control with the value
property matched to the database id column and...
|
by: Michael Maes |
last post by:
Hi,
I have a UserControl containing some controls of which one is a ComboBox.
All the InternalControls are Private and some are allowed to be accessed through Public Methods.
One of the things I...
|
by: Kevin Hodgson |
last post by:
I have a ComboBox and a TextBox bound to a Dataset/datatable returned from a
SQL Database. The databinding is set in Design Mode.
Everything works fine on my initial fill, and I get the correct...
|
by: tfsmag |
last post by:
I have a Grid that I've set up to have two of the fields use
dropdownlists while in edit mode. Now I can bind the data to the
dropdownlists just fine. My problem is that the second dropdown depends...
|
by: hwiechers |
last post by:
I have two drop down lists on a page. Each one is hooked up to a
separate SqlDataSource. The second data source has a ControlParameter
set to the selected value of the first drop down. When I set...
|
by: Rex the Strange |
last post by:
I'm having a problem here and am looking for the answer. I have two
listboxes. One is a dropdown and the other is a simple list of items
which is databound . I want to be able to allow the user to...
|
by: Chris |
last post by:
I am using databinding on a pair of cascading dropdowns. You select a team
and get the office they can work in. When I try to rebind the second office
dropdown I get the following error.
...
|
by: phpmel |
last post by:
hi guys,
I am using Visual Studio 2005. I have a dropdown list that has an associated SQLdatasource. I also have a textbox below the dropdown list that allows you to add items to the table that...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |