Click here to Skip to main content
15,851,387 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am using DetailsView in my web application. There is DropDownList in view in Insert and Edit mode. now when i open DetailsView in Insert mode then i get dropdown control without any error.

But, when i open DetailsView in edit mode i am not getting DropDownList control

I am using following code

C#
if (dvCategoryMaster.CurrentMode == DetailsViewMode.Edit)
{
     DropDownList ddlParentCategory = (DropDownList)dvCategoryMaster.FindControl("ddl");
     ddlParentCategory.Items.FindByValue(categoryInstance.Category_Parent_ID.ToString()).Selected = true;
}


Here i am getting ddlParentCategory = null

So kindly help me, how to solve this error?
Posted
Updated 25-Oct-12 20:13pm
v4
Comments
AshishChaudha 26-Oct-12 1:07am    
share code snippet of dropdown bind.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900