473,881 Members | 1,616 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

possible .NET 2 compatability issue

bne
Hi All,

I have a shopping cart app that (I think) has broken due to an upgrade
to .NET 2.0.

Some products display fine:
<http://ukweddinggroup. com/default.aspx?pr d=11>

Others display okay but validation on the dropdown list options break:
<http://ukweddinggroup. com/default.aspx?pr d=249>

And still others completely wipe out with "System.Argumen tException: An
entry with the same key already exists":
<http://ukweddinggroup. com/default.aspx?pr d=420>

The drop down list controls are created dynamically depending on what
options are available for each product in the database.

I'm presuming that there is a bug somewhere that was forgiven by .NET
1.1 but has now cropped up in .NET 2.0

The code that the runtime error objects to is:
System.Argument Exception: An entry with the same key already exists.

------------------------------------------------------

@&nbsp;<span id="itemPriceIn dicator"><%= this.ItemPrice. ToString("c")
%></span></strong></span>

------------------------------------------------------

ItemPrice is from an overridden page control used across the site:

------------------------------------------------------

public decimal ItemPrice
{
get
{
object o = ViewState["ItemPrice"];
if(o == null)
{
return 0.0M;
}
return (decimal)o;
}
set
{
ViewState["ItemPrice"] = value;
}
}

------------------------------------------------------

The code where I think something is going wrong is:

------------------------------------------------------

private void rptProductOptio ns_ItemCreated( object sender,
RepeaterItemEve ntArgs e)
{
if(e.Item != null && (e.Item.ItemTyp e == ListItemType.It em ||
e.Item.ItemType == ListItemType.Al ternatingItem))
{
PlaceHolder plh = (PlaceHolder)e. Item.FindContro l("plhControl") ;
DataSet dsProductOption Data = this.ProductOpt ionData();
DataRow drOptionGroup =
dsProductOption Data.Tables["OptionGrou p"].Rows[e.Item.ItemInde x];
DataView dvOptions = new DataView(
dsProductOption Data.Tables["Option"],
String.Format(" OptionGroupID = {0}", drOptionGroup["ID"]),
"Incidence" ,
DataViewRowStat e.OriginalRows) ;

// JS price array
foreach(DataRow View drv in dvOptions)
{
RegisterArrayDe claration("aPri ce", drv["Price"].ToString());
}

bool mandatory = Convert.ToBoole an(drOptionGrou p["Mandatory"]);
HYL.Cart.Option GroupType type =
(HYL.Cart.Optio nGroupType)Enum .Parse(typeof(H YL.Cart.OptionG roupType),
drOptionGroup["Type"].ToString());
RequiredFieldVa lidator rfv;

if(type == OptionGroupType .List || type ==
OptionGroupType .MultipleList)
{
#region Lists
// display checkbox as only 1 option
if(dvOptions.Co unt == 1)
{
CheckBox cbx = new CheckBox();
if(mandatory)
{
cbx.Checked = true;
cbx.Enabled = false;
this.ItemPrice += Convert.ToDecim al(dvOptions[0]["Price"]);
}
else
{
cbx.Attributes. Add("onclick", "UpdatePrice(); ");
}
cbx.Text = dvOptions[0]["Descriptio n"].ToString();
cbx.CssClass = "ProductOption" ;

plh.Controls.Ad d(cbx);
}
else if(dvOptions.Co unt > 1) // display drop down list/listbox
{
if(type == HYL.Cart.Option GroupType.Multi pleList)
{
ListBox lbx = new ListBox();
lbx.Attributes. Add("onchange", "UpdatePrice(); ");
lbx.CssClass = "ProductOption" ;
lbx.Rows = 5;
lbx.SelectionMo de = ListSelectionMo de.Multiple;
lbx.DataTextFie ld = "Descriptio n";
lbx.DataValueFi eld = "ID";
lbx.DataSource = dvOptions;
lbx.DataBind();

plh.Controls.Ad d(lbx);

// to add client id after everything has finished databinding
lbx.PreRender += new EventHandler(lb x_PreRender);

if(mandatory)
{
rfv = new RequiredFieldVa lidator();
rfv.CssClass = "errText";
rfv.Display = ValidatorDispla y.Dynamic;
rfv.Text = "Please select an option.<br>";
rfv.ControlToVa lidate = lbx.ClientID;

plh.Controls.Ad dAt(0, rfv);
}
}
else
{
DropDownList ddl = new DropDownList();
ddl.Attributes. Add("onchange", "UpdatePrice(); ");
ddl.CssClass = "ProductOption" ;
ddl.DataTextFie ld = "Descriptio n";
ddl.DataValueFi eld = "ID";
ddl.DataSource = dvOptions;
ddl.DataBind();

plh.Controls.Ad d(ddl);

// to add blank option and client id after everything has
finished databinding
ddl.PreRender += new EventHandler(dd l_PreRender);

if(mandatory)
{
rfv = new RequiredFieldVa lidator();
rfv.CssClass = "errText";
rfv.Display = ValidatorDispla y.Dynamic;
rfv.Text = "Please select an option.<br>";
rfv.ControlToVa lidate = ddl.ClientID;
rfv.InitialValu e = "0";

plh.Controls.Ad dAt(0, rfv);
}
}
}
#endregion
}
else if(type == OptionGroupType .IntegerInput || type ==
OptionGroupType .StringInput)
{
#region TextBoxes
TextBox txt = new TextBox();

if(type == OptionGroupType .IntegerInput)
{
txt.CssClass = "txtFieldSm ";
}
else
{
txt.CssClass = "txtField";
txt.TextMode = TextBoxMode.Mul tiLine;
}

plh.Controls.Ad d(txt);
txt.PreRender += new EventHandler(tx t_PreRender);

if(mandatory)
{
if(type == OptionGroupType .IntegerInput)
{
CompareValidato r cmpv = new CompareValidato r();
cmpv.CssClass = "errText";
cmpv.Display = ValidatorDispla y.Dynamic;
cmpv.Text = "Please enter a valid number.<br>";
cmpv.Type = ValidationDataT ype.Integer;
cmpv.Operator = ValidationCompa reOperator.Data TypeCheck;
cmpv.ControlToV alidate = txt.ClientID;

plh.Controls.Ad dAt(0, cmpv);
}
else
{
rfv = new RequiredFieldVa lidator();
rfv.CssClass = "errText";
rfv.Display = ValidatorDispla y.Dynamic;
rfv.Text = "Please enter a value.<br>";
rfv.ControlToVa lidate = txt.ClientID;

plh.Controls.Ad dAt(0, rfv);
}
}
#endregion
}
else if(type == OptionGroupType .DateInput)
{
#region Date Drop Downs

HYL.Web.Control s.DateDropDown ddd = new
HYL.Web.Control s.DateDropDown( );
ddd.DateValue = DateTime.Today;
ddd.CalendarLin kText = "<img class=\"icoCale ndar\" alt=\"calendar
select\" src=\"img/ico_calendar.gi f\">";
ddd.CalendarPos ition = 3;
ddd.CalendarSty lePath = "@import 'Page/pfcal.css';";
ddd.DisplayForm at = "dMMMMyyyy" ;
ddd.ShowCalenda r = true;
ddd.CssClass = "dateDropDo wn";
ddd.YearUpperBo und = 3;

plh.Controls.Ad d(ddd);
ddd.PreRender += new EventHandler(dd d_PreRender);

if(mandatory)
{
DateTime minDate = DateTime.Today. AddDays(7);
ddd.DisabledDat es = new HYL.Web.Control s.SelectionRang e[] { new
HYL.Web.Control s.SelectionRang e(DateTime.MinV alue, minDate) };
ddd.DateValue = minDate;

HYL.Web.Control s.DateDropDownC ompareValidator dcv = new
HYL.Web.Control s.DateDropDownC ompareValidator ();
dcv.CssClass = "errText";
dcv.Display = ValidatorDispla y.Dynamic;
dcv.Text = "Please enter a date at least 1 week from
today.<br>";
dcv.DateToCompa re = minDate;
dcv.Operator = ValidationCompa reOperator.Grea terThanEqual;
dcv.ControlToVa lidate = ddd.ClientID;

plh.Controls.Ad dAt(0, dcv);
}

#endregion
}
else if(type == OptionGroupType .None)
{
// do nothing
}
}
}

------------------------------------------------------

Anyone got an bright ideas?

Cheers

bne

Jul 1 '06 #1
0 1105

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

Similar topics

4
7710
by: J Fisk | last post by:
Hi, I've been banging my head on the wall over this for about two days now so any thoughts are much appreciated. I have a static .svg file with embedded onclick="open()"'s all over. The svg is <embed>ded in a minimal .html file. The onclick's work fine in IE w/Adobe SVG viewer 3: click and a new
5
1120
by: BBeasley | last post by:
I've written severl dot net applications for users who use IE only. Now I'm developing one for a netscape user. My text boxes and lables resize in Netscape. Any ideas? Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ---------------------------------------------------------- http://www.usenet.com
6
1678
by: Nak | last post by:
Hi there, I was wondering if anyone knew of a way to maintain compatability with assemblies providing the interfaces remains the same? At the moment if I re-compile an assembly without actually changing an interface it breaks compatability, forcing all of my consuming assemblies to need recompiling. I know this could be done with VB6, what about .NET? Nick.
3
1651
by: Richard Cleaveland | last post by:
A client has just successfully upgraded from Access 97 to 2000. I don't have Access 2000, but I do have Office XP. Can I successfully use my Access on their database? They kind of did this behind my back, and I'm responsible for the application maintenance...! Dick
0
1128
by: SenthilVel | last post by:
hi I have my application built with Dotnet Framework 1.1 and now i can see most of clients having both the versions 2.0 and 1.1 in their systems, i get an issue when i run my 1.1 application . what r the ways to achieve the forward compatability for 1.1 developed applications ? i know we can use the <strartup><supportedruntime> in the app.config ..
0
1356
by: David | last post by:
I am trying to migrate a .net 1.1 Web Application to a 2.0 Web Application. I am experiencing issues when putting a strongly typed dataset into session, and then navigation to a page where aspcompat is set to "true". I can reproduce the problem by creating a brand new web site project in VS2005, and creating a new page where I set aspcompat=true. Then i create a new named dataset class in solution explorer. I add an instance of this...
4
1902
by: zak | last post by:
we have a suite of products that have a number of shared assemblies. During development and support the shared assemblies code will change . I want to control the versioning, so if the code chnages are binary compatable ( i.e interfaces have not changed) then we can retain the same version number for the assembly and just change the hot fix number in the assembly. But how do I know that binary compatability has been maintained to...
1
1342
by: internet.system.error | last post by:
Hello, I write the casual Java code, and to make life easier at work I´ve decided to write a C# application that reads two excel files and does the usual number crunching and spits out a new file. However, I´m not really familiar with C# nor Visual Studio so before buying an expensive programming environment, I´d like some advise.... The computer running the application has Windows XP Professional & Excel 2002. The computer where I...
1
3708
by: jsmall | last post by:
Hi, We currently have a fairly old product, which was originally only compatible with SQL 2000. When we upgraded our server to SQL 2005, the client product gave us a "This product is not compatible with this version of SQL server" error. We put the server into SQL 2000 compatability mode, and things worked.
0
11098
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
10814
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,...
0
10401
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
9552
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7953
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
7109
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
5977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4597
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
2
4196
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.