Microsoft Content Management Server - Custom PlaceHolder Control failing to persist data on post-back

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > August 2006 > Custom PlaceHolder Control failing to persist data on post-back





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Custom PlaceHolder Control failing to persist data on post-back
alistair

2006-08-24, 1:23 am

hi...
I've created this custom placeholder that renders a dropdown in Author-Mode
and a button in Presentation-mode.
This is created in a ASP.NET 2.0 proj using MCMS 2002 w/ SP2.

This custom control is decorated w/
& #91;SupportedPlaceholderDefinitionType(t
ypeof(XmlPlaceholderDefinition))] and
extends the BasePlaceholderControl as required with all the necessary
overrides.

What I can't understand is that in author-mode the user selects a option
from the dropdown and clicks "Save" from the default CMS console. On the
server-side the dropdown's SelectedItemValue = null....

I had done s simular custom control in .NET 1.1 and all worked fine, I
ported over the code into my .NET 2.0 solution and I'm getting this
persistence issue.
any help would be appreciated

THanks
Alistair

alistair

2006-08-24, 1:23 am

Found the issue (not that I understand it yet????)
Here is the code :
public DropdownButtonPlaceholderControl(string dropDownLabel, string
buttonText, ListItemCollection itemsList)
{
_buttonText = buttonText;
_caption = dropDownLabel;
// this._ddList.DataSource = itemsList;
foreach (ListItem item in itemsList)
this._ddList.Items.Add(item);
}

I commented the culprit above and added the foreach below....
This solved the issue.....for some reason when setting the datasource of the
dropdown would cause it to reinitialize and lose its previously selectedValue.
Using a FOREACH seemed to solve the issue and the SELECTEDVALUE was persisted
Stefan [MSFT]

2006-08-24, 7:22 am

Hi Alistair,

yes that is correct. That's what I also found.

Cheers,
Stefan

--
This posting is provided "AS IS" with no warranties, and confers no rights


"alistair" <alistair@discussions.microsoft.com> wrote in message
news:38AEBC3B-1472-4F28-91C4-AA17F24BBECF@microsoft.com...
> Found the issue (not that I understand it yet????)
> Here is the code :
> public DropdownButtonPlaceholderControl(string dropDownLabel,
> string
> buttonText, ListItemCollection itemsList)
> {
> _buttonText = buttonText;
> _caption = dropDownLabel;
> // this._ddList.DataSource = itemsList;
> foreach (ListItem item in itemsList)
> this._ddList.Items.Add(item);
> }
>
> I commented the culprit above and added the foreach below....
> This solved the issue.....for some reason when setting the datasource of
> the
> dropdown would cause it to reinitialize and lose its previously
> selectedValue.
> Using a FOREACH seemed to solve the issue and the SELECTEDVALUE was
> persisted



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com