Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i need the solution for following error is any one can give?

Type 'System.Web.UI.WebControls.ListItem' in Assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable

i described here my code of databinding

design page
<asp:DropDownList ID="DdlDealerName" runat="server"                                                    onselectedindexchanged="DdlDealerName_SelectedIndexChanged1">

code behind
dsDM = objBusInfoBAl.GetDealerMasterInfoDetails("MS", OrgId, BusId, FrmType);
            if (dsDM != null)
            {
                if (dsDM.Tables[0].Rows.Count > 0)
                {
                    DdlDealerName.DataSource = dsDM.Tables[0].DefaultView;
                    DdlDealerName.DataTextField = "BUSINESS_NAME";
                    DdlDealerName.DataValueField = "BUSINESS_ID";
                    dlDealerName.DataBind()
                 }
             }
Posted
Updated 2-Aug-11 1:36am
v2
Comments
sujit0761 2-Aug-11 7:36am    
on debugging is the control coming inside the "dsDM.Tables[0].Rows.Count > 0" loop?
Sandesh M Patil 2-Aug-11 7:37am    
Use following code if it helps?


DdlDealerName.DataSource = dsDM.Tables[0].DefaultView;
DdlDealerName.DataTextField = "BUSINESS_NAME";
DdlDealerName.DataValueField = "BUSINESS_NAME";
dlDealerName.DataBind()

1 solution

This[^] may help.
 
Share this answer
 
Comments
Sandesh M Patil 2-Aug-11 7:52am    
This is already posted
http://www.codeproject.com/Questions/234864/data-binding-to-drop-down-list-with-dataset
Member 7959293 2-Aug-11 8:19am    
i already tell you that drop down liast is not located in gridview

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