473,666 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting DataTextField and DataValuedField on the fly?

Greetings all -

I'm trying to determine if .NET will allow me to do this and I'm at wits end on it. I have a listbox (Call it ListBoxB) that accepts values from another listbox (Call it ListboxA), which is bound to my database. I can set up the DataTextField and DataValueField fine in my ListBoxA which is bound but wondered how I can accomplish this in an unbound scenario because ListBoxB will ultimately needed to be submitted with the form to the database and I need the field mappings to refer to

Any ideas how I can accomplish this in code so if I come to a place where I want to add data to the listbox, do I need to address this property before I call my .add??

Cheers
Mike
Nov 18 '05 #1
0 930

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

Similar topics

3
1202
by: jez123456 | last post by:
Hi experts. I have an ASP.Net page with a DropDownList called cboYear. This gets filled with a c# method as follows. private void FillYearList() { SqlConnection cn = new SqlConnection(); cn = DatEngine.TimeOffConn; SqlCommand sc = new SqlCommand("SELECT intYear, Description FROM dbo.vwYearSelector ",cn);
1
2963
by: George | last post by:
I am trying to set the value of items in a dropdown list dynamically, and can't seem to figure out how to do it. I have two arrays set up like this: Dim a() as string ={"A", "B", "C"} Dim b() as string ={"1", "2", "3"} I can get the first array in the items list like this:
0
1725
by: Rik | last post by:
I am trying to find out if it is possible to set the Checked value of a checkboxlist when databinding. Code below works except for the setting of the checked value.... cbServer.DataTextField = "SrvName"; cbServer.DataValueField = "SrvNo"; // = "SrvChked"; cbServer.DataSource = ObjSQL.QueryDataSet("select SrvNo,SrvName,
5
7895
by: Eirik Eldorsen | last post by:
I'm trying to code a reapter that for each listelement show a checkboxlist. I'm almost there. The only thing I can't figure out is how to set the ID of the checkboxlists. This is my code: <asp:CheckBoxList id='<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "ID")) %>' runat="server" ..... This code will result in the following parse error:
4
4700
by: Patrick Olurotimi Ige | last post by:
I have a DropDown Lsit set to ddlGetDebtor.Items.Insert(0, "-Select Debtor Code-") which is setting the "-Select Debtor Code-" to be default And on PostBack i'm passng:- Cmd.Parameters.Add(New SqlParameter("@DebtorCodeID", ddlGetDebtor.SelectedItem.Value)) to to retrieve the Data
1
7227
by: Jason Wilson | last post by:
I have two dropdownlists that are bound to the same datasource and I have a couple of questions: 1) Because they are bound to the same datasource, I am assuming that they only make 1 round trip to the DB server -- is that correct? 2) On a user's click of a button, one of the actions in the button OnClick event is to set the selectedindex of the 2nd DDL to that of the 1st. I get a runtime error here that says that the given index is...
2
5567
by: John Haycock | last post by:
Hi All I have a user control that uses a repeater to build a list of menu links: <itemtemplate> <li> <a href='news.aspx?newsID=<%# DataBinder.Eval(Container.DataItem,"newsID") %>'> <%# DataBinder.Eval(Container.DataItem, "newsHeadline") %> </a> </li>
1
1194
by: Eric Layman | last post by:
Hi I am attempting to bind data to a dropdownlist. Currently the below code will bind a persons last name just find using the datatextfield. What I would like to do though, is also be able to bind there First Name as well into that datatextfield, so that when the drop down list is displayed, they see a Last Name, First Name, rather than just a persons last name. cmdname = New SqlClient.SqlCommand("SELECT id, lname, fname from...
8
11250
by: Jeff | last post by:
ASP.NET 2.0 I'm wondering how to set the color of a visited HyperLinkField (the link text) in a GridView?? Here is the markup of the HyperLinkField I have problems with: <asp:HyperLinkField HeaderText="Subject" Text="Subject" DataTextField="Subject" DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}" HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />
0
8449
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
8360
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8876
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8784
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...
0
7387
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...
0
4371
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2774
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
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1777
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.