Hi,
I have a datagrid on an ASP.NET page, which has a custom columntemplate. In
this columntemplate I
would like to have a DropDownList, which is shown, when the user edits the
record. However,
I can't manage to bind the DropDownListField to the underlaying dataset, so
it shows
the contents of the underlying database field.
Here is the relevant ASP Code:
<EditItemTemplate>
<asp:DropDownList id=dlMediaType runat="server" DataSource='<%#
DataBinder.Eval(Container, "DataItem.type") %>' Width="168px" Text='<%#
DataBinder.Eval(Container, "DataItem.type") %>'>
</asp:DropDownList>
</EditItemTemplate>
The field from the underlaying table is called "Type".
What I get with this code is, that the DropDownList displays a single
character of the contents of
the "type" field in each line of the DropDownList; e.g. if the type field is
"DVD (TV)", the
DropDownList contains
D
V
D
(
T
V
)
what's wrong here ? Thanx,
Christian 2 1870
Why do you have the datasource and text binded to the same field?
Shouldn't the datasource be a list of some kind and the text would bind to
each entity in the list?
"Christian" <ch**************@illeone.at> wrote in message
news:OY**************@tk2msftngp13.phx.gbl... Hi,
I have a datagrid on an ASP.NET page, which has a custom columntemplate.
In this columntemplate I would like to have a DropDownList, which is shown, when the user edits the record. However, I can't manage to bind the DropDownListField to the underlaying dataset,
so it shows the contents of the underlying database field.
Here is the relevant ASP Code:
<EditItemTemplate> <asp:DropDownList id=dlMediaType runat="server" DataSource='<%# DataBinder.Eval(Container, "DataItem.type") %>' Width="168px" Text='<%# DataBinder.Eval(Container, "DataItem.type") %>'> </asp:DropDownList> </EditItemTemplate>
The field from the underlaying table is called "Type".
What I get with this code is, that the DropDownList displays a single character of the contents of the "type" field in each line of the DropDownList; e.g. if the type field
is "DVD (TV)", the DropDownList contains
D V D
( T V )
what's wrong here ? Thanx, Christian
> Shouldn't the datasource be a list of some kind and the text would bind to each entity in the list?
Oooops ... yes ... now it works. Partially. What I still don't get is the
difference
between actually binding the DropDownList to the database field and binding
it to a second datasource that actually provides the items within the list
.... :( "Christian" <ch**************@illeone.at> wrote in message news:OY**************@tk2msftngp13.phx.gbl... Hi,
I have a datagrid on an ASP.NET page, which has a custom columntemplate. In this columntemplate I would like to have a DropDownList, which is shown, when the user edits
the record. However, I can't manage to bind the DropDownListField to the underlaying dataset, so it shows the contents of the underlying database field.
Here is the relevant ASP Code:
<EditItemTemplate> <asp:DropDownList id=dlMediaType runat="server" DataSource='<%# DataBinder.Eval(Container, "DataItem.type") %>' Width="168px" Text='<%# DataBinder.Eval(Container, "DataItem.type") %>'> </asp:DropDownList> </EditItemTemplate>
The field from the underlaying table is called "Type".
What I get with this code is, that the DropDownList displays a single character of the contents of the "type" field in each line of the DropDownList; e.g. if the type
field is "DVD (TV)", the DropDownList contains
D V D
( T V )
what's wrong here ? Thanx, Christian
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dominic |
last post by:
Hi guys,
I'm not sure if this question belongs to FAQ, but I couldn't find a
concrete answer.
I created a Datagrid control using ItemTemplate, but it's NOT a
in-place editing datagrid. One of...
|
by: Shane O. Pinnell |
last post by:
I am sure this has come up before, but I haven't been able to find an answer as of yet. That said, any help is definitely appreciated!
I have a datagrid populated from a dataset. I have a...
|
by: DC Gringo |
last post by:
I've got a command button to submit a value from a dropdown list that should
then filter a SELECT query. I'm simply appending a WHERE colx =
<variableSelectedFromDropdownList>. How do I pass this...
|
by: Tim::.. |
last post by:
Can someone please tell me how I go about preselecting an item in a drop
drown list when I click the Edit Command in a datagrid?
I have tried the following but it doesn't work for me!
I would...
|
by: Daniel Doyle |
last post by:
Hello and apologies in advance for the amount of code in this post. I've
also sent this message to the Sharepoint group, but thought that ASP.NET
developers may also be able to help, even though...
| |
by: Mark Waser |
last post by:
I've discovered a very odd bug when attempting to put a dropdown list in a
datagrid.
In the page PreRender step, the selected index of the datagrid is
successfully set during databinding. Yet,...
|
by: Tand35006 |
last post by:
Hi, I hope some one can help with this. I have a basic webform with 2
DropDownLists and a single DataGrid. What I am trying to do is populate the
first DDList from a dataset on Form_Load. I then...
|
by: glenn |
last post by:
Hi folks,
I am trying to determine which item in a DropDownList Web control has been
selected.
I have posted an OnSelectedIndexChanged subroutine in my code with a
reference to the subroutine...
|
by: glenn |
last post by:
Hi folks,
I have a DropDownList in a DataGrid that is populated from records in a
database.
I want to add a value that might be a string such as "Select a Company" for
the first item since an...
|
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: 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...
| |
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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |