473,725 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update Databound controls within a DetailsView TemplateField

This is driving me nuts, it is such a simply thing to do but i cannot for the
life of me work out how you are suposed to do it. I want to update the data
in DropDownListB based on what is selected in DropDownListA. I am not trying
to do anything fancy with AJAX, i am happy to use Post Backs. If it were two
controls just on the page then i would simply specify a control parameter for
the SelectCommand of the SQLDataSource control which the DropDownListB is
bound to. However the DDLs are in seperate TemplateFields that are in a
DetailsView control so i can't put the SQLDataSource control anywhere on the
page where DropDownListB can see it and It can see DropDownListA. It has
just occured to me that i could put them both in the same TemplateField but
this is not ideal. I have tried a million ways to do this all to no avail,
i would list them but it would make this post about 2000 words long.
Mar 23 '06 #1
5 14108
Right i have tried the both DDL controls and the SQLDataSource in the same
TemplateField technique and i bump up against the same error as i have been
getting with everything i try as follows

I think the error has something to do with the point at which the databound
controls are refreshed but the error is so vague i can't really get to the
bottom of it.

Server Error in '/Portal' Application.
Databinding methods such as Eval(), XPath(), and Bind() can only be used in
the context of a databound control.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.InvalidO perationExcepti on: Databinding methods
such as Eval(), XPath(), and Bind() can only be used in the context of a
databound control.

Source Error:

[No relevant source lines]
Source File: c:\WINDOWS\Micr osoft.NET\Frame work\v2.0.50727 \Temporary ASP.NET
Files\portal\3f ee1574\f20094c7 \App_Web_xdk9ey pg.0.cs Line: 0

Stack Trace:

[InvalidOperatio nException: Databinding methods such as Eval(), XPath(), and
Bind() can only be used in the context of a databound control.]
System.Web.UI.P age.GetDataItem () +1996866
ASP.complaints_ aspx.__DataBind ing__control350 (Object sender, EventArgs e)
in c:\WINDOWS\Micr osoft.NET\Frame work\v2.0.50727 \Temporary ASP.NET
Files\portal\3f ee1574\f20094c7 \App_Web_xdk9ey pg.0.cs:0
System.Web.UI.C ontrol.OnDataBi nding(EventArgs e) +99
System.Web.UI.W ebControls.List Control.OnDataB inding(EventArg s e) +11
System.Web.UI.W ebControls.List Control.Perform Select() +31
System.Web.UI.W ebControls.Base DataBoundContro l.DataBind() +70
System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd() +82
System.Web.UI.W ebControls.List Control.OnPreRe nder(EventArgs e) +26
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +77
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +1360

Mar 23 '06 #2
http://www.webswapp.com/codesamples/...s/default.aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"clickon" wrote:
Right i have tried the both DDL controls and the SQLDataSource in the same
TemplateField technique and i bump up against the same error as i have been
getting with everything i try as follows

I think the error has something to do with the point at which the databound
controls are refreshed but the error is so vague i can't really get to the
bottom of it.

Server Error in '/Portal' Application.
Databinding methods such as Eval(), XPath(), and Bind() can only be used in
the context of a databound control.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.InvalidO perationExcepti on: Databinding methods
such as Eval(), XPath(), and Bind() can only be used in the context of a
databound control.

Source Error:

[No relevant source lines]
Source File: c:\WINDOWS\Micr osoft.NET\Frame work\v2.0.50727 \Temporary ASP.NET
Files\portal\3f ee1574\f20094c7 \App_Web_xdk9ey pg.0.cs Line: 0

Stack Trace:

[InvalidOperatio nException: Databinding methods such as Eval(), XPath(), and
Bind() can only be used in the context of a databound control.]
System.Web.UI.P age.GetDataItem () +1996866
ASP.complaints_ aspx.__DataBind ing__control350 (Object sender, EventArgs e)
in c:\WINDOWS\Micr osoft.NET\Frame work\v2.0.50727 \Temporary ASP.NET
Files\portal\3f ee1574\f20094c7 \App_Web_xdk9ey pg.0.cs:0
System.Web.UI.C ontrol.OnDataBi nding(EventArgs e) +99
System.Web.UI.W ebControls.List Control.OnDataB inding(EventArg s e) +11
System.Web.UI.W ebControls.List Control.Perform Select() +31
System.Web.UI.W ebControls.Base DataBoundContro l.DataBind() +70
System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd() +82
System.Web.UI.W ebControls.List Control.OnPreRe nder(EventArgs e) +26
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +77
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +1360

Mar 23 '06 #3
Thanks very much, that's great. I have been trying to do this simple thing
for a day and a half and i was about to commit an act of extreme violence
against my computer. I think i may just go back to using PHP, it's so much
easier ;-)
"Phillip Williams" wrote:
http://www.webswapp.com/codesamples/...s/default.aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"clickon" wrote:
Right i have tried the both DDL controls and the SQLDataSource in the same
TemplateField technique and i bump up against the same error as i have been
getting with everything i try as follows

I think the error has something to do with the point at which the databound
controls are refreshed but the error is so vague i can't really get to the
bottom of it.

Server Error in '/Portal' Application.
Databinding methods such as Eval(), XPath(), and Bind() can only be used in
the context of a databound control.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.InvalidO perationExcepti on: Databinding methods
such as Eval(), XPath(), and Bind() can only be used in the context of a
databound control.

Source Error:

[No relevant source lines]
Source File: c:\WINDOWS\Micr osoft.NET\Frame work\v2.0.50727 \Temporary ASP.NET
Files\portal\3f ee1574\f20094c7 \App_Web_xdk9ey pg.0.cs Line: 0

Stack Trace:

[InvalidOperatio nException: Databinding methods such as Eval(), XPath(), and
Bind() can only be used in the context of a databound control.]
System.Web.UI.P age.GetDataItem () +1996866
ASP.complaints_ aspx.__DataBind ing__control350 (Object sender, EventArgs e)
in c:\WINDOWS\Micr osoft.NET\Frame work\v2.0.50727 \Temporary ASP.NET
Files\portal\3f ee1574\f20094c7 \App_Web_xdk9ey pg.0.cs:0
System.Web.UI.C ontrol.OnDataBi nding(EventArgs e) +99
System.Web.UI.W ebControls.List Control.OnDataB inding(EventArg s e) +11
System.Web.UI.W ebControls.List Control.Perform Select() +31
System.Web.UI.W ebControls.Base DataBoundContro l.DataBind() +70
System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd() +82
System.Web.UI.W ebControls.List Control.OnPreRe nder(EventArgs e) +26
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +77
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +1360

Mar 23 '06 #4
You are welcome. I get emails from many people who had similar experiences
regarding this issue. Hope that makes you feels a bit better ;-)

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"clickon" wrote:
Thanks very much, that's great. I have been trying to do this simple thing
for a day and a half and i was about to commit an act of extreme violence
against my computer. I think i may just go back to using PHP, it's so much
easier ;-)
"Phillip Williams" wrote:
http://www.webswapp.com/codesamples/...s/default.aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"clickon" wrote:
Right i have tried the both DDL controls and the SQLDataSource in the same
TemplateField technique and i bump up against the same error as i have been
getting with everything i try as follows

I think the error has something to do with the point at which the databound
controls are refreshed but the error is so vague i can't really get to the
bottom of it.

Server Error in '/Portal' Application.
Databinding methods such as Eval(), XPath(), and Bind() can only be used in
the context of a databound control.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.InvalidO perationExcepti on: Databinding methods
such as Eval(), XPath(), and Bind() can only be used in the context of a
databound control.

Source Error:

[No relevant source lines]
Source File: c:\WINDOWS\Micr osoft.NET\Frame work\v2.0.50727 \Temporary ASP.NET
Files\portal\3f ee1574\f20094c7 \App_Web_xdk9ey pg.0.cs Line: 0

Stack Trace:

[InvalidOperatio nException: Databinding methods such as Eval(), XPath(), and
Bind() can only be used in the context of a databound control.]
System.Web.UI.P age.GetDataItem () +1996866
ASP.complaints_ aspx.__DataBind ing__control350 (Object sender, EventArgs e)
in c:\WINDOWS\Micr osoft.NET\Frame work\v2.0.50727 \Temporary ASP.NET
Files\portal\3f ee1574\f20094c7 \App_Web_xdk9ey pg.0.cs:0
System.Web.UI.C ontrol.OnDataBi nding(EventArgs e) +99
System.Web.UI.W ebControls.List Control.OnDataB inding(EventArg s e) +11
System.Web.UI.W ebControls.List Control.Perform Select() +31
System.Web.UI.W ebControls.Base DataBoundContro l.DataBind() +70
System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd() +82
System.Web.UI.W ebControls.List Control.OnPreRe nder(EventArgs e) +26
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +77
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +1360

Mar 23 '06 #5

right second question, you code uses the e object that you have to put in
every event procedure. I have never been able to work out what it is, what
it does, why it is there and what you are suposed to do with it so i am
finding your code a bit hard to follow. would you mind explaining it to me.
Forgive my ignorance, i have only been learning ASP.net for a few weeks and
all the books i have read have just never atempted an explanation.
Mar 23 '06 #6

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

Similar topics

3
19340
by: Martin | last post by:
Hi, I have a very frustrating problem that I have researched for countless hours to no avail. There are many posts asking very similar things, however none usefull in my situation. I am using VS 2005 (ASP 2.0) and VB .NET. I have a page with a datalist, a gridview and then other data controls, nested in that order. This all works great, and produces a nice looking page, but I cannot for the life of me figure out how to reference
4
6315
by: jens Jensen | last post by:
Hello, I have an image file name in a table that a let users modify via a GridView/DetailView pair. * The actual image file is saved in the image folder of the application. But the image is rendered in a templatefield 's <itemtemplate> on the detailsview. In the <edititemtemplate> i have a fileupload control . leting users upload a new picture and thus replace the old one.
5
11345
by: Mike P | last post by:
The default format for the DetailsView control is for there to be a row per field. Is it possible set it to show more than one column per row (see below)? ID ... Name ... Address ... Country ... etc. I have tried to add <tr>'s and <td>'s within the DetailsView to do this, but it just causes errors.
1
2081
by: odd.morten.sveas | last post by:
Hi I'm building a web site where some users can create receivables (invoices). This website will support several organisations and different users migth have responibility for more that one organisation. My problem is when I'm buliding this receivables page. The receivable are entered through a asp.net DetailsView. The first thing a user will do i to choose organisation. This is done by adding a DropDownList in a
1
10404
by: Evan M. | last post by:
Here's my GridView and my SqlDataSource <asp:GridView ID="ContactHistoryGrid" runat="server" AutoGenerateColumns="False" DataSourceID="ContactHistoryDS" DataKeyNames="JobHistoryID" OnRowCreated="ContactHistoryGrid_RowCreated" CssClass="GridViewTable" GridLines="None" CellSpacing="1" CellPadding="3" AllowSorting="True" AllowPaging="True"> <EmptyDataTemplate>
1
1882
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi, I am a newbie to ASP.NET 2.0. This is driving me nuts! I think I might have a fundamental misunderstanding of how this all works! I am using a DetailsView which is populated dynaically at runtime: table = DataTable from Dataset passed back from Data Access Layer DV1 = DetailsView
1
1594
JustRun
by: JustRun | last post by:
I have a problem with the select option at the gridview and gonna pull my hair out cause it doesn't work at all. Here is the Grid view code: I want to get the selected row when the user click "Select" I think it might related to the database Table !! <asp:SqlDataSource ID="sdsCustomer" runat="server" ConflictDetection="CompareAllValues" ConnectionString="Data Source=.;Initial Catalog=TimeSheet;Integrated...
1
1954
by: ranger979 | last post by:
I am using the emptydatatemplate for a gridview control. I have a detailsview control within the emptydatatemplate. In the detailsview I have another templatefield that contains an imagebutton control and a textbox control. <EmptyDataTemplate> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:DetailsView ID="DetailsView1"...
1
2024
by: ranger979 | last post by:
I am using the emptydatatemplate for a gridview control. I have a detailsview control within the emptydatatemplate. In the detailsview I have a templatefield that contains an imagebutton control and a textbox control. <EmptyDataTemplate> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:DetailsView ID="DetailsView1"...
0
8888
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
8752
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
9401
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
9257
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
9113
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
4519
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
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
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.