Error:"The IListSource does not contain any data sources."

Error:"The IListSource does not contain any data sources."

Post by UmFq » Thu, 14 Apr 2005 02:18:02


Hi,
I am getting "The IListSource does not contain any data sources."
error,While I am devoloping a Custom Placeholder with a DropDown List and try
to bind it with a dataset from Database in CreateAuthoringChildControls()
method, herez the code that I have now,

protected override void CreateAuthoringChildControls(BaseModeContainer
authoringContainer)
{
this.ddlCodes=new DropDownList();
this.ddlCodes.AutoPostBack=false;
this.ddlCodes.ID="ddlCodes";
this.ddlCodes.EnableViewState=false;
DataSet dsCodes=new DataSet();
dsCodes=DatabaseManager.getDropDownItemList(this.codeOption.ToString());
if(dsCodes.Tables[0].Rows.Count>0)
{
this.ddlCodes.DataTextField="CODE_TEXT";
this.ddlCodes.DataValueField="CODE_VALUE";
this.ddlCodes.DataSource=dsCodes.Tables[0].DefaultView;
this.ddlCodes.DataBind();
}
else ddlCodes.Items.Add(new ListItem("",""));
authoringContainer.Controls.Add(this.ddlCodes);
}

I have even tried by just adding one blank item like else clause in the
above code, Can someone suggest me some remedy for this..

TIA
 
 
 

Error:"The IListSource does not contain any data sources."

Post by Stefan [MS » Thu, 14 Apr 2005 04:36:26

Hi Raj,

that is more a .NET framework question than a MCMS question.
But if you resolve this you will notice that it will not be possible to set
the SelectedIndex of your Dropdown.
This will not work in a placeholder control when using databind.

You would need to add each item separatly to set the SelectedIndex.

Cheers,
Stefan

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

New to MCMS?
Check out this book: Building Websites Using MCMS: http://www.yqcomputer.com/
----------------------




try

 
 
 

Error:"The IListSource does not contain any data sources."

Post by UmFq » Thu, 14 Apr 2005 06:12:21

Hi,
there is very basic error in my earlier code that, i missed prefixing
"this." for the dropdownlist control and as usual i didnt find databind()
function doesnt seem to be working again..so i'm going with adding items
separately...

Thanks..