473,543 Members | 1,983 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 14100
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
19329
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,...
4
6308
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...
5
11332
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
2075
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...
1
10384
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">...
1
1873
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
1573
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" ...
1
1939
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; ...
1
2010
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...
0
7355
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...
0
7594
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. ...
0
7748
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...
0
7697
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...
0
4900
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...
0
3395
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...
1
1830
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
1
979
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
648
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...

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.