Can somebody please tell me how to bind a drop-down (states) to a table
programmatically? I have the connection information in the procedure and I
am not using the connection objects in the GUI interface.
Thanks,
Antonio 4 1566
What have you tried that doesn't work ? Defining the DataSource and calling
DataBind if ASP.NET should be enough.
You may want also to post in a windows forms or an ASP.NET group so that we
know which kind of UI you are using...
--
Patrice
"Antonio" <An*****@discussions.microsoft.com> a écrit dans le message de
news: 45**********************************@microsoft.com... Can somebody please tell me how to bind a drop-down (states) to a table programmatically? I have the connection information in the procedure and I am not using the connection objects in the GUI interface.
Thanks,
Antonio
This is what I tried:
//binding for the State drop-down
string strTable = "GEM.states";
string strWhere = "";
if (IsPostBack)
{
strWhere = " WHERE stateid=" + lstState.SelectedItem.Value;
}
string strState = "SELECT *, (statename, stateprefix) as State FROM " +
strTable + strWhere + " ORDER BY stateprefix";
adapter.Fill(ds,strTable);
lstState.DataSource = ds.Tables[strTable].DefaultView;
lstState.DataBind();
"Patrice" wrote: What have you tried that doesn't work ? Defining the DataSource and calling DataBind if ASP.NET should be enough.
You may want also to post in a windows forms or an ASP.NET group so that we know which kind of UI you are using...
-- Patrice
"Antonio" <An*****@discussions.microsoft.com> a écrit dans le message de news: 45**********************************@microsoft.com... Can somebody please tell me how to bind a drop-down (states) to a table programmatically? I have the connection information in the procedure and I am not using the connection objects in the GUI interface.
Thanks,
Antonio
1) Which DB are you using the "(a,b) as c" syntax looks a bit weird to me
2) I would define DataTextField and DataValueField.
3) Have you checked that you have actually returned rows ?
4 ) My approach would be to bind with a table created from scratch to find
out first if the problem is UI side or data side. If you still see nothign
but have data, it could be that you rebind in some other event (in which
event do you have this ?).
Good luck.
--
Patrice
"Antonio" <An*****@discussions.microsoft.com> a écrit dans le message de
news: 6D**********************************@microsoft.com... This is what I tried:
//binding for the State drop-down string strTable = "GEM.states"; string strWhere = "";
if (IsPostBack) { strWhere = " WHERE stateid=" + lstState.SelectedItem.Value; } string strState = "SELECT *, (statename, stateprefix) as State FROM " + strTable + strWhere + " ORDER BY stateprefix";
adapter.Fill(ds,strTable); lstState.DataSource = ds.Tables[strTable].DefaultView; lstState.DataBind();
"Patrice" wrote:
What have you tried that doesn't work ? Defining the DataSource and calling DataBind if ASP.NET should be enough.
You may want also to post in a windows forms or an ASP.NET group so that we know which kind of UI you are using...
-- Patrice
"Antonio" <An*****@discussions.microsoft.com> a écrit dans le message de news: 45**********************************@microsoft.com... > Can somebody please tell me how to bind a drop-down (states) to a table > programmatically? I have the connection information in the procedure > and > I > am not using the connection objects in the GUI interface. > > Thanks, > > > Antonio
Patrice, I have it in the Page_Load procedure.
1) I changed it to SELECT *, (statename, stateprefix) as State FROM " +
strTable + strWhere + " ORDER BY stateprefix";
2) are you talking about the drop-down properties?
3) Yes.
"Patrice" wrote: 1) Which DB are you using the "(a,b) as c" syntax looks a bit weird to me 2) I would define DataTextField and DataValueField. 3) Have you checked that you have actually returned rows ? 4 ) My approach would be to bind with a table created from scratch to find out first if the problem is UI side or data side. If you still see nothign but have data, it could be that you rebind in some other event (in which event do you have this ?).
Good luck.
-- Patrice
"Antonio" <An*****@discussions.microsoft.com> a écrit dans le message de news: 6D**********************************@microsoft.com... This is what I tried:
//binding for the State drop-down string strTable = "GEM.states"; string strWhere = "";
if (IsPostBack) { strWhere = " WHERE stateid=" + lstState.SelectedItem.Value; } string strState = "SELECT *, (statename, stateprefix) as State FROM " + strTable + strWhere + " ORDER BY stateprefix";
adapter.Fill(ds,strTable); lstState.DataSource = ds.Tables[strTable].DefaultView; lstState.DataBind();
"Patrice" wrote:
What have you tried that doesn't work ? Defining the DataSource and calling DataBind if ASP.NET should be enough.
You may want also to post in a windows forms or an ASP.NET group so that we know which kind of UI you are using...
-- Patrice
"Antonio" <An*****@discussions.microsoft.com> a écrit dans le message de news: 45**********************************@microsoft.com... > Can somebody please tell me how to bind a drop-down (states) to a table > programmatically? I have the connection information in the procedure > and > I > am not using the connection objects in the GUI interface. > > Thanks, > > > Antonio This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Clarence Gardner |
last post by:
I've got a problem that I don't see how to program around. A socket server
that was running fine, today started getting an exception from the bind()
call (errno 22, Invalid argument) and yet the...
|
by: P G |
last post by:
I hope this is on topic here. I have a problem compiling a simple
example of the use of boost::bind. Please take a look at the program
below.
...
|
by: Arturo Cuebas |
last post by:
The program below contains a compile error. Following the program you
will find the typical fix then my idea for a library that facilitates
a more elegant fix.
#include <boost\bind.hpp>
using...
|
by: ABSMunkee |
last post by:
I have a vb.net dll that has two functions: one allows a user to change
their password in AD, the second allows the user to view their
distinguishedname (based on their samaccountname). Both bind...
|
by: teclioness |
last post by:
Hi,
I am using gridview for the user to update rows. In a row, there sre
two columns, which need to be updated. When the gridview is to be
shown, the row should show the values from database....
|
by: Dick Sutton |
last post by:
Hi all,
I just made the mistake of posting this question in the
Microsoft.Public.VB.General.Discussion group. I was told that VB 2005
Express is NOT VB. Oh, well, must have touched a nerve. ...
|
by: Jayesh Thakrar |
last post by:
My aim is to develop a SQL procedure to create a tablespace which a
qualified end-user can invoke/run.
Since tablespace creation requires SYSADM or SYSCTL authorization and I
want this to...
|
by: si_owen |
last post by:
Hi all,
firstly this is a web apps project.
Right i had a dropdown list which was populated by a db table which was
databound using a sql datasource.
however when adding validation controls...
|
by: Tigera |
last post by:
Greetings,
I am trying to learn to use the Boost library, and I've run into a
frustrating problem with the line marked here:
#include <boost/function.hpp>
#include <boost/functional.hpp>...
|
by: crack.the.hack |
last post by:
Hi All,
If I am changing the database machine, what should I do not to prep
bind the sqc files everytime.
Because I need to build my application everytime the database is
changed?
Is there...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |