473,595 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SqlDataSource and dropdown

Hello, I am new to asp.net and I am in need of help.

I have a dropdown that is attached to a SqlDataSource (DataSourceID).
The dropdown has one column shown as text and another hidden as the
value. However my SqlDataSouce returns 3 columns but I am only using
two for the dropdown (value,text) but the third column I would like to
place it in a textbox.

So,
SqlDataSource has (three columns "A, B, C") it populates a dropdown
with A and B. On SelectedIndexCh anged of the dropdown I want to
populate the a textbox with the third column "C".

something like textbox.text = sqldatasoure. ("something here")

How do I do that?

Can a sqldatasource populate a textbox? If it can, what is the syntax.

Thank you.
Your help is much appreciated.

-Simone

Jan 26 '07 #1
1 1849
Don't use SqlDataSource. Download the data to a dataset and databind the ddl
to the dataset. In the SelectedIndexCh anged event locate the selected row in
the datatable and get the third value.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"Simone" <oi****@hotmail .comwrote in message
news:11******** **************@ v45g2000cwv.goo glegroups.com.. .
Hello, I am new to asp.net and I am in need of help.

I have a dropdown that is attached to a SqlDataSource (DataSourceID).
The dropdown has one column shown as text and another hidden as the
value. However my SqlDataSouce returns 3 columns but I am only using
two for the dropdown (value,text) but the third column I would like to
place it in a textbox.

So,
SqlDataSource has (three columns "A, B, C") it populates a dropdown
with A and B. On SelectedIndexCh anged of the dropdown I want to
populate the a textbox with the third column "C".

something like textbox.text = sqldatasoure. ("something here")

How do I do that?

Can a sqldatasource populate a textbox? If it can, what is the syntax.

Thank you.
Your help is much appreciated.

-Simone

Jan 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4469
by: Martin Bischoff | last post by:
Hi, is it possible to modify the values of a SqlDataSource's select parameters in the code behind before the select command is executed? Example: I have an SqlDataSource with a ControlParameter <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:XYZ %>"
4
2035
by: Dabbler | last post by:
I need to convert a CompanyId in one table to Company Name from another table for an ItemTemplate. I thought I would just add another SqlDataSource but not sure how to eval with the CompanyId parameter for the where clause in the select. Any clues would be appreciated.
3
4520
by: simonZ | last post by:
In gridView I have dropdown list : <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="ProductID" HeaderText="ProductID" InsertVisible="False"ReadOnly="True" SortExpression="ProductID" /> <asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />
2
2813
by: WebMatrix | last post by:
Hello, Stored procedure returns results of 3 different queries. On ASP.NET 2.0 page I have a SqlDataSource control with SelectCommand equals this stored procedure name. I want to be able to bind 3 different controls on the page: 1 dropdown control, 2. formview and GridView to each datatable. Is there a way to do it? I can't find any way of doing it, other then having 3 different SqlDataSource controls for each query. But I dont want...
2
1987
by: djc | last post by:
1) I am wondering if I should be using an sqlDataSource object for my particular scenario. I need to loop through a listbox and perform an INSERT sql operation for each item. Could be a few or several items. The reason I'm wondering if I should use an SqlDataSource object is overhead. For example, prior to learning about the sqlDataSource I would just code the ado.net procedure myself. For example, create connection object, create and...
0
1505
by: Will | last post by:
I have searched and solutions that I have found are not working, I have a datagrid that will be updating a mysql db. Now I have a drop down that has a static collection but is dynamically selected to a selected value thats in the database. I click the edit button in the gridview and the drop down shows up fine, I pick a number in the drop down and hit update it says at that new number but the database never updates.....help anyone know...
0
1100
by: mharness | last post by:
Hello, Not sure if what I'm trying to do is possible or even a good idea. I have a datalist that can contain maybe 100 items shared among perhaps 20 accounts. Looks something like this: accountid itemid a 1 a 2 b 5
2
1114
by: Don Miller | last post by:
I have controls (dropdown list, radiobutton list) that are bound to an SQLDataSource. In the SELECT statement in the DataSource configuration I have tried to include other columns that would be useful to do something with (e.g. store in an object, textbox, etc.) besides just populating the databound control. Is there way to access these extra columns in a SQLDataSource or do I have to forget the DataSource control, query the database and...
2
3136
by: Cirene | last post by:
I have a gridview that is filtered by a databound dropdownlist. I've set AppendDataBound to True and added the item "ALL" in the dropdownlist. My gridview is supposed to be filtered by this dropdownlist. When it's "ALL" I want to include everything. When it's something else I want to filter the gv data by this dropdownlist. Do I need to dynamically change the WHERE clause via code? I'm sure there's an easier way to do this.
0
7957
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8020
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8252
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6675
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5839
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5421
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3915
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2391
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.