I have a dataset which I am binding to a listbox. However, I want to combine two of the fields to make up the DataTextField. Is this possible, or am I going to have to loop through the Data Rows?
I have a GridView with a SQLDatasource. All of the columns in the gridview are bound to a field. Now they want a column that is not a field returned but would be two of the fields combined together. How can I do this exactly? Can someone show a line of code to display this in a column?
My users will enter a city/station where an incident occured, and the date. The trigger below does work, but it will occasionally put spaces between the citystation and the date. I think this happens when the citystaion name is not very long, but not sure.
(ex: city____08242010)
How can I make sure that if the incidentid is going to have spaces, that sql deletes those spaces? I need the id to be space free.
ALTER AS TRIGGER [dbo].[tr_AddID1] ON [dbo].[tblIncidents] INSTEAD OF INSERT..........
I have two tables (Person and Location) In the Dynamic Data Site, when adding Location info, I am need to choose a person from the dropdown box which is populated via a FK. That dropdown box defaults to the field in "Person" that is titled "fname" which is first name, so it looks like "Jim" or "Steve".
I'm trying to have that dropdown box display the full name of the person it references which would be combining the fields fname and lname.
Would I do this inside a Field Template? Metadata? I'm kind of stuck on this.
If I look at the FieldTemplate for ForeignKey_Edit I see this:
[code]...
and it seems like I should be able to make something similar to "PopulateListControl" and use that instead, but I have no idea where this method even resides.
I am trying to create a multi column listbox by combining fields in Linq select statement, as Let Name = Last + First. The problem is how to pad the Last column with spaces as you would in SQL using REPLICATE so when I bind the listbox to the data, it looks like two columns.
I am trying to find out if there is an easier way to insert datavaluefield and datatextfied in a DDL.... I have two dropdownlist...the second ddl prepouplates based on the first one. All works now cos i have all my datavaluefield inserted. Now i was woundering if there is a way to caputure the datatextfied too so users can see it instead of seeing the ID alone. here is my code
Is there a way to display several records in the datatextfield in a asp dropdownlist? I know the fix when populating the dropdownlist from a datagrid was to edit your SQL query but the values I am receiving are sent via an XML string. The idea would be to display a name, price, and date in the dropdown text. Currently I am getting the following error: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'MonetaryValueServiceType' While using UPSDropDown.DataTextField = "MonetaryValue" & "ServiceType" Is there a work around to do this? The only other option is to use radio buttons (which are also a nightmare).
<asp:SqlDataSource ID="sql_Region" runat="server" ConnectionString="<%$ ConnectionStrings:Test %>" SelectCommand="SELECT Number, Name FROM table_Region WHERE Number = @Number" SelectCommandType="Text">
<asp:DropDownList ID="dd_Region" runat="server" DataSourceID="sql_Region" DataTextField="Name" DataValueField="Number" /> Ok, I have this dropdownlist and I want to use the DataTextField for a label control.
Something like this. I want to show the region as a label but I only could get the DataValueField value not DataTextField value. Does anybody knows? <asp:Label ID="label_Region" runat="server" /> <C#>
label_Region.Text = dd_Region.SelectedValue.ToString(); <--I know by doing this, I can get the DataValueField but. label_Region.Text = (DataTextField) <<--How do I get this value? I want to show the region name not the region number
I'm currently working with a control that inherits from DropDownList (it has some extra functionality that isn't really relevant to this question, but it gives me a nice place to implement the extra stuff I'm gonig to discuss).
We're using data binding, with the DataTextField and DataValueField working absolutely fine. However, I find myself in need of a similar field that will control whether or not the item is enabled. (I've already overridden the RenderContents method of the control so it properly renders non-Enabled items, since DropDownList doesn't do this by default.)
Thus I'd like to know how to override the DropDownList's data binding so it acts exactly as normal, except a further field from each DataSource item is applied to each ListItem's Enabled property.
(NB: the field I'll be binding to isn't a straight boolean, and doesn't have an explicit/implicit cast to boolean, so I'll probably be "passing" it as a string.)
I have used a webservice to populate a Rad Combo Box, when the page is loaded, I need the ability to display the DataTextField, based on the returned DataValueField item
Public Class State Public Property StateId As Integer Public Property Name As Dictionary(Of Integer, String) End Class
Name(x) contains the state name in different languages. I get a collection of State from the method StateManager.GetAllStates() and I want to bind this collection to a DropDownList. The problem is that I can't find how to set the DataTextField property to let's say stateList.Name(1) which is the english name of my state.
Dim stateList As StateCollection = StateManager.GetAllStates() Me.DataSource = stateList Me.DataValueField = "StateId" Me.DataTextField = "Name(1).Value" <-- Problem here Me.DataBind()
I have a dropdownlist for which I am loading data from excel. Excel has 2 columns Product and Email. Data in Product column is binding to DataTextField and Email column to DataValueField. The dropdown works fine when email is different for different product but when email has same value for different product then whatever I select, on postback the selected value changes to the first item of the same email value.
Below are the sample data in Excel to show the behavior of dropdown
Example 1. (Drop down works fine for this example)
Example 3. (In the example below, when I select iPad the dropdown works fine but when I select iPhone 3G or iPhone4 on post back the dropdown selected value will be iPhone 3G. Basically, on selecting iPhone4 here, on post back it shows iPhone 3G)
DataTextField="Category" DataValueField="CategoryID" (coming from Dropdownlist)
I want to move a Item (a Category) from listbox1 to listbox2...but how do I move this Category Plus the CategoryID to lisbox2 (CategoryID should not be visible but still be associated with Category in Listbox2)
So I want the newly added Categories to be visible in Listbox2 ..but their CategoryID's must be invisible...but still be associated with their Category....
and when I save these Categories from Listbox2 to the Database.....its should be the CategoryID's that should go into the Database.....not the actual Category
So to explain again in a different way
I want to Move a selected DataTextField & its DataValueField from Listbox1 to listbox2
then only the array of DataValueField must be saved to Database
I have a list <Department> say Company.Departments with object Manager and ManagerId, ManagerName as property of Manager. I would like to fill the dropdownlist with managers as below
I am not sure if my subject is phrased properly but here is what I am getting problems with.I have a detailsview which had about 3 dropdownlist (ddl) on it. The DDL's works fine when I insert a new record or I try to edit an existing record.But when I just want to view the data in the detailsview it displays the primary keys (DataValueFields) instead of the associated DataTextField Value.
I would rather not magic string my DataTextField/Values on the dropdownlist after setting up the source as a List collection of objects.
I was thinking I could use the DataSource properties but it doesn't seem to like the couple of ways I tried.
WORKS BUT NOT IDEAL //set the datasource to the returned List<Cart> this.cartDdl.DataSource = CartManager.Load(WebProfile.Current.UserName); //set the DataValueField to the Cart.ID property this.cartDdl.DataValueField = "ID";//would rather use the obj property Cart.ID //set the DataTextField to the Cart.Description property this.cartDdl.DataTextField = "Description";//would rather use the obj property Cart.Description //Bind the ddl to the datasource this.cartDdl.DataBind(); HOW I WOULD THINK IT COULD WORK this.cartDdl.DataValueField = ((Cart)this.cartDdl.DataSourceObject).ID; this.cartDdl.DataTextField = ((Cart)this.cartDdl.DataSourceObject).Description;
I have a sql data souce that returns several columns of data, and they are displayed in a DetailsView on a pretty simple vb.net page. I'm stuggling with one field though for the details view.
It's a template field, and if ClientType=1 (this value is determined else where on the page), then the label in the template field should have Text='<%# Bind("ClientName") %>', but if the ClientType = 0, then the label in the template field should have Text='<%# Bind("ClientTemporaryName") %>'
How do I tell the details view to set the text for ClientName to one or the other?
I have a relatively complex dataset (numerous tables, some with multiple records) generated from reading in an XML file. I need to connect said dataset fields to an ASP form. At the moment I'm assigning them manually, like so in the pageload:
I did some looking into binding the textboxes (and dropdownlists, and checkboxes, and and and...) directly, but it seemed to be too many formats to use.
So this works fine, but as the number of fields increases, those load and unload lists are going to get unwieldy.