Please hekp, error: Item has already been added. Key in dictionary: 'id' Key being added: 'id'

I had that error before on FormView, I didn't find any solution, and managed to avoid that code. But now I really need a solution on this, please help.

That happens when I reload page, on my page, my FormView is loaded dynamically, and that error happens on LoadControlState and LoadViewState,  in LoadControlState, it is on

            if (objArray1[5] != null)
            {
                  OrderedDictionaryStateHelper.LoadViewState(this.KeyTable, (ArrayList) objArray1[5]);
            }
in LoadViewState, it is on

         if (objArray1[7] != null)
            {
                  OrderedDictionaryStateHelper.LoadViewState((OrderedDictionary) this.BoundFieldValues, (ArrayList) objArray1[7]);
            }
they both call OrderedDictionaryStateHelper.LoadViewState, and in OrderedDictionaryStateHelper.LoadViewState, it will add whatever keys in the second parameter to the first parameter. And if the first parameter(a collection) has the key already, it will give the error I got.

So, since it doesn't check the collection before add keys in , it must assume the collection is empty. But in my case, both collections are not empty. Does I do something wrong? It doesn't look like it is the case, for example I define datakeynames in FormView, that makes the KeyTable is not empty when LoadControlState.

 

Any suggestion?

! thanks

0
wyx2000
4/29/2006 8:09:19 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

0 Replies
1063 Views

Similar Articles

[PageSpeed] 7
Get it on Google Play
Get it on Apple App Store

Reply:

Similar Artilces:

Item has already been added. Key in dictionary: 'Id' Key being added: 'Id'
hi , when i am trying to delete a project from the project_list page i'm getting the following error : Item has already been added. Key in dictionary: 'Id'  Key being added: 'Id' can anybody help me ? thanks.Lebanese Please post your code. It will help us assess your issue.Ryan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question it's the time tracker starter kit code.Lebanese Charbel_Chalhoub wrote:it's the time tracker starter kit code. OK. Were you able to resolve it?Ryan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to a...

Hashtable error
Hi,  Can someone point me in the right direction? I have no idea why I get this error because I am quite sure that in my code, "ItemNo" is being added as a key for the FIRST time into the Hashtable.<code>Hashtable htCredent = new Hashtable();... (I have left out some chunks of code here that populates the datareader drCredent.)while (drCredent.Read()){htCredent.Add("ItemNo", drCredent.GetString(0)); (*** ERROR Line)htCredent.Add("ItemDescription", drCredent.GetString(1));htCredent.Add("GST", drCredent.GetDecimal(2));htCredent.Add("...

Item has already been added. Key in dictionary: 'Name' Key being added: 'Name'
I am trying to bind a hashtable to dropdopwlist as below but I get this:"Item has already been added. Key in dictionary: 'Name'  Key being added: 'Name'" Error. Any ideas?    Hashtable docs = new Hashtable();    foreach (string s in Roles.GetUsersInRole("Physician"))    {      ProfileCommon p = (ProfileCommon)ProfileCommon.Create(s);      string fullname = p.PersonalInfo.FirstName + " " + p.PersonalInfo.LastName;      docs.Add("Name", fullname);   &...

Item has already been added. Key in dictionary: 'cbo_' Key being added: 'cbo_'
When I use a module of a combobox, the error message is shown as below. Item has already been added. Key in dictionary: 'cbo_' Key being added: 'cbo_' Actually, in a same project, this module is also used in another webpages and it is ok but now I build a new one and the problem occurs.  How can I solve this problem? Thank you Actually, this problem occurs after I re-install windows xp and visual studio 2005. I found that the webpages wrote before are ok but the webpages after re-installation have this problem. These webpages are in the same project. After installation, I deleted...

Item has already been added. Key in dictionary: 'FitName' Key being added: 'FitName'
i am using a hashtable to keep key value pairbut i am getting an error like this Item has already been added. Key in dictionary: 'FitName'  Key being added: 'FitName'But i need a Collection which replaces the old if  we add the  same key againis there any such collection?  How about writing a custom put method like: private void putItem(HashTable myTable, string key, string value){    if( myTable.containsKey( key ) )           myTable.remove( key );   myTable.put( key, value); } Of course,...

Membership.GetAllUsers(); Item has already been added. Key in dictionary: '' Key being added: ''
 Hi, I get the following error while trying to retrive all the users in AD,Item has already been added. Key in dictionary: ''  Key being added: ''  i presume this is because a user has somehow been duplicated in th AD and the collection has to be unique. is there any method which gets all unique users as i cannot seem to find one. Thanks, Ommer Check the exist property of AD before adding user. Shah Dharnendra GSr.Analyst Programmer,GTL-Ahmedabad  Hi, is that to actually check whether a user exists in AD before adding another user? Is t...

Item has already been added. Key in dictionary: 'Cellular' Key being added: 'Cellular'
 Hi, When inserting a new item i get the following error: Item has already been added. Key in dictionary: 'Cellular'  Key being added: 'Cellular' As far as I know you get that error if you enter the parameter more than once, however i can't find anywhere in my code where the value is entered more than once. What could be the problem? Thanks in advance for the help :-) Details.aspx <asp:objectdatasource id="ObjectDataSource1" runat="server" insertmethod="InsertMomDetails" oninserted="Formview2_Inserted" oninserting="Numbers_Inserting" selectmethod="GetSingleMom" typena...

Item has already been added. Key in dictionary: '0' Key being added: '0' gridview
i'm trying to add a key and value to the hashtable and then put that hashtable in Session and this works fine but i'm getting error when i try to browse to different pages in gridview and here is the error message: Item has already been added. Key in dictionary: '0'  Key being added: '0' gridview here is my code: Hashtable ht = new Hashtable();  //declare in class level variable  protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) {        ............      &nbs...

Refresh for second time a gridview which includes a second gridview, gives the error Item has already been added. Key in dictionary: 's_no' Key being added: '_no'
I have a gridview which includes another gridview in a template field. Included gridview is resfreshed in 'RowCreated' event of first gridview based on its' datakey values. 'Their data are refreshed by clicking a button. The first time both gridviews are filled with data without any problem. The next time I click on button for refreshing their data, I get the error Key in dictionary: 's_no'  Key being added: 's_no'. 's_no' is a datakey column of included gridview. What is the problem ?...

Key 'd' and Key 'Control'
Dear sirs / madams, I want to add a short cut key in my datawindow, the script as shown as below, Script 1 IF KeyFlags = 2 THEN IF KeyDown(Keyd!) THEN THIS.TriggerEvent("ue_deleterow") END IF END IF Script 2 IF KeyDown(KeyControl!) then IF KeyDown(Keyd!) then THIS.TriggerEvent("ue_deleterow") END IF END IF Script 3 IF KeyDown(KeyControl!) AND KeyDown(Keyd!) THEN THIS.TriggerEvent("ue_deleterow") END IF But, all of the above, if I press the Key 'Control' first, and then press Key 'd',...

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

How do fix the error The DataSourceID of 'DataGrid1' must be the ID of a control of type IDataSource. A control with ID 'SqlMedTable' could not be found.
How do you fix the error: The DataSourceID of 'DataGrid1' must be the ID of a control of type IDataSource.  A control with ID 'SqlMedTable' could not be found.Here is the code.protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) {MedicalClassLibrary.Connection c = new MedicalClassLibrary.Connection(); c.GetMedicalTable();DataGrid1.AutoGenerateColumns = true; DataGrid1.DataSource = c.DS;InputDiv.Visible = false;Label1.Visible = false; txtRx.Focus(); } } Here is the class medhod:public void GetMedicalTable() {string medTable = "SELECT ...

Error: Primary key for row in table 'x' is referenced by foreign key 'f' in table 'y'
(ASA 9 newest ebf) I'm getting this error even though mentioned foreign key has cascade updates (and deletes too) enabled. Is this some new behaviour in asa 9, or why can i get such message for cascaded foreign key? Any ideas? Thanks Pete Found a reason for it...but should it really work so? It's this way: - table a has columns a,b,c - table b has columns a,c, and references columns a,c (with a,c) in table a with cascade updates - table a hes before update trigger to change columns a when column b is changed (set new_row.a = ...) and that set new_row.a = ... i...

Web resources about - Please hekp, error: Item has already been added. Key in dictionary: 'id' Key being added: 'id' - asp.net.presentation-controls

Resources last updated: 12/29/2015 5:21:26 PM