473,382 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

DataBoundLiteralControl loses plot

I've got a databound templated custom control.

The data is a list of simple objects which (in essence) have a name and a
percentage value in them.

This control works fine - mostly.

Now I can navigate between different sections of my system showing this
control and often it seems to work.

Sometimes however it crashes with an index out of range error.

If I trace into the code, what I'm doing is
looping through the list,
creating a template container control
instantiating the template in it
Adding the container control to the Controls collection
Calling DataBind on the container

What I'm seeing is that before the container control is added to the
controls collection it has its _dataBountLiteral value and _staticLiterals
values absolutely correct (in this case there are 2 dimensions (with null
values in) for the _dataBoundLiteral and 3 for the statics).
then I call Controls.Add(container) and the _dataBoundLiterals and
_StaticLiterals values are changed as the container control is added to the
collection.

In this particular instance this is the second time the control has been
created in this page lifecyle, the first time from viewstate with an event
being rasied and bubbled up and the section switched.

This bubbling caused the list (which contains the bound data) to be changed
and I then clear the controls collection and refresh with the new data.

In this instance the new data picks a different template with fewer
variables to be incorporated.

What is happening when the container control that I've just constructed is
added to the Controls list is that the values I've just set for that
control are replaced with the values from the first creation of the
control.

I'm actually track the DataBoundLiteralControl object during this process
and something is most definately resetting the binding information during
the Controls.Add process.

So in short, when a templated databaound control is recreated (in
Page.OnLoadCompleted) the binding information in DataBoundLiteralControls
appears to be replaced with the equivalend information from the control
proviously in that location in the controls collection.

Sorry if this question is a tad long, but it's not a simple issue.

Any help or pointers gratefully received.
Iain
--
Iain Downs (DirectShow MVP)
Commercial Software Therapist
www.idcl.co.uk
Jun 7 '06 #1
1 1709
On Wed, 7 Jun 2006 20:07:25 +0100, Iain wrote:

....
So in short, when a templated databaound control is recreated (in
Page.OnLoadCompleted) the binding information in DataBoundLiteralControls
appears to be replaced with the equivalend information from the control
proviously in that location in the controls collection.


The problem appears to be due to the controls values being refreshed from
the ViewState when it is added to the control collection.

If you call ClearChildViewState after clearing the Controls, the problem
goes away.
Iain
--
Iain Downs (DirectShow MVP)
Commercial Software Therapist
www.idcl.co.uk
Jun 8 '06 #2

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

Similar topics

2
by: Dr. Colombes | last post by:
MatPlotLib question: How to get more different size plot symbols in the plot function ? Is there a way to get different size squares (or circles or triangles, etc.) ? For example, in a two...
1
by: Dr. Colombes | last post by:
Using MatPlotLib plot function, is there a way to get variable size plot symbols? For example, using symbol strings like 'o' (circle), 's' (square), 'x' (cross), etc., is there a way to specify...
1
by: Jan Wienhausen | last post by:
Hi, I need to do a plot of data that is beeing acuired. For that the plot needs to be updated after aquiering a new tuple. At the moment I allways do this after a new tuple is aqcuired: ...
1
by: endlesschuck | last post by:
Hello, I have a repeater which simply has the following: <input type="checkbox" id='chkRptItem_<%# DataBinder.Eval(Container.DataItem, "ID") %>' name="chkRptItems" value='<%#...
0
by: toton | last post by:
Hi, for my project I needs a few plots to visualize the data (mostly x-y plot) . Most of the existing plotting library either copy the data and do plotting, or takes a data pointer to an 2d x-y...
6
by: redcic | last post by:
Hi all, I've just downloaded scipy v 0.5.2 and I would like to be able to draw plots. I've tried: import scipy.gplt import scipy.plt import scipy.xplt and none of them work. Are these...
0
by: meggahertz | last post by:
I am using matplotlib to generate plot in python in linux. The porblem I am facing is that when I generate a plot using plot() then show() the script stops at that point until I close the plot...
1
by: dazzler | last post by:
Hi! I just moved using wxpython so I'm a quite newbie. I was wondering how to update plotcanvas? In my code I made button with event to update plotcanvas with new results, but how to properly do...
1
by: oyinbo55 | last post by:
I am trying to use the pylab plot command on my laptop running Ubuntu 6.06 (Dapper). Although the plot command works fine on my XP desktop at work, I cannot open the plot window on the laptop. I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.