473,657 Members | 2,555 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reorderlist - error when using with databound dropdownlist - unable to bind selectedvalue

Hi, I'm having a problem using a databound dropdownlist inside a
reorderlist ajax control. Here's a snippet of the code I'm using:

<InsertItemTemp late>
<div class="insertAr ea">
<asp:DropDownLi st ID="lstUser" runat="server"
DataSourceID="U serDataSource" DataTextField=" UserName"
DataValueField= "UserId" SelectedValue=' <%# Bind("UserId") %>'
AppendDataBound Items="true"></asp:DropDownLis t>
<asp:TextBox ID="txtPhone" runat="server" MaxLength="20" Width="150"
Text='<%# Bind("ContactPh one") %>'></asp:TextBox>
<asp:TextBox ID="txtEmail" runat="server" MaxLength="255" Width="400"
Text='<%# Bind("ContactEm ail") %>'></asp:TextBox>
<asp:Button ID="cmdAdd" runat="server" Text="Add"
CommandName="in sert" />
</div>
</InsertItemTempl ate>

When clicking the Add button, I get a "Databindin g methods such as
Eval(), XPath(), and Bind() can only be used in the context of a
databound control."

The bizarre thing about this is that the exact same code works fine in
the EditItemTemplat e. As far as I know, I need to bind the UserId so
that it gets fed into the UserId parameter in the objectdatasourc e. If
I remove the SelectedValue=' <%# Bind("UserId") %>' part then I no
longer get the error, but the objectdatasourc e tries to pass null for
the userid to the database, which is of no use.

Here is the insert section of the objectdatasourc e for reference:

<InsertParamete rs>
<asp:ControlPar ameter Name="Company" ControlID="lstC ompany"
PropertyName="S electedValue" Type="Int32" />
<asp:Paramete r Name="UserId" Type="Object" />
<asp:Paramete r Name="Sequence" Type="Int32" />
<asp:Paramete r Name="ContactPh one" Type="String" />
<asp:Paramete r Name="ContactEm ail" Type="String" />
</InsertParameter s>

Hope to get some help on this as it's really bugging me.

Regards,
Mark

Apr 5 '07 #1
0 1666

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

Similar topics

2
2147
by: COHENMARVIN | last post by:
I'm leafing through a big book on asp.net, and I don't see any way to the following: 1. bind values and text to a dropdown 2. Also make the first line of the dropdown say something different. For instance, if I'm working with a table of hotels, I might want a 'select' control as follows <select id="mylistbox" runat="server"> <option value="*">Add New Hotel</option> <option value="1">The Hilton</option> <option value="2">The...
1
1838
by: mr2_93 | last post by:
Hi All, I am new to ASP.NET and I am looking for help with the dropdownlist data control. I wonder if someone could show me how to past the SelectedValue of a data-bind dropdownlist to poplulate a second data-bind dropdownlist. For example, the first dropdownlist contains a list of companies and the second dropdownlist displays a product list based on the selected value of
15
26920
by: Swetha | last post by:
Hello I have a DropDownList that I am populating using the following SqlDataSource: <asp:DropDownList ID="parentIDDropDownList" runat="server" DataSourceID="SqlDataSource3" DataTextField="name" DataValueField="ID"></asp:DropDownList><asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
7
4536
by: AG | last post by:
Hi, ASP.NET 2.0 web app I have a GridView utilizing template columns and bound to an objectdatasource. In the edit template of one column there is a dropdownlist bound to another objectdatasource. The dropdownlist displays the appropriate values when entering edit mode. However when I try to update, I receive the following error.
0
5947
by: sgtmarcjones | last post by:
How do I access a dropdownlist that is nested within a Formview ItemTemplate Gridview Template? I want to see a label (lgbTimeKeep ! TextValue of ddlName dropdownlist) instead of a dropdownlist in the FormView ItemTemplate Nested Gridview ddlName ItemTemplate. My label is named lgvTimeKeep and the dropdownlist name is ddlName. Thanks!
1
2611
by: Mark Micallef | last post by:
Hi, this question relates to a control in the Ajax toolkit for asp.net 2. I'm having a problem using a databound dropdownlist inside a reorderlist ajax control. Here's a snippet of the code I'm using: <InsertItemTemplate> <div class="insertArea"> <asp:DropDownList ID="lstUser" runat="server" DataSourceID="UserDataSource" DataTextField="UserName" DataValueField="UserId" SelectedValue='<%# Bind("UserId") %>'...
4
2978
by: jehugaleahsa | last post by:
Hello: I am going through an effort to standardize web applications for my company. We are trying to figure out the best practices for security, error handling, etc. I've just done a large amount of work to figure out the built-in ASP .NET security features (which was fairly easy to do). So now I am tackling error handling. What we would like to do is show a JavaScript Alert box with the error information in it. Here is the code I...
6
1855
by: Jonathan Wood | last post by:
I have a databound dropdownlist control. Based on some other criteria, I need to specify the selected item in my pages Load event. The problem is that, in my load event, the control does not yet have any data. I've found I can call DataBind() on that control and then it works okay. However, this has me wondering where the control normally databinds, and if me doing it manually would actually introduce the overhead of having the control...
6
4268
by: Ahmedhussain | last post by:
Hi there, I m doing work on a gridview and Im getting an error: A potentially dangerous Request.Form value was detected from the client (ctl00$Content$GridView1$ctl03$TextBox1="<span class='txtColo...") Im using an access database. and when ever I try to update this it doesnt work. <%@ Page Language="C#" MasterPageFile="Mysite.master" Title="Untitled Page" %> <script runat = "server"> protected void Page_Load(object sender,...
0
8316
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
8833
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...
1
8509
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,...
1
6174
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
5636
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
4168
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
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.