Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,
Cannot have multiple items selected in dropdown list i m using drop down list in asp.net i got this error, how to solve this error.
I called button click

tnNSD.Attributes.Add("onClick", "return ShowScrollPopup('NSDEntry.aspx','','','NSD Entry','1000','800');");
---

<%			
			Response.CacheControl = "Private";
			Response.Expires= -1;
			Response.AddHeader("pragma", "no-cache");	
		%>


i got error here...

------

private void FillEmployeeNSDDetails()
{
	try
	{
		_objnsd = new clsNSD();	
		string _colname="";
		DataTable _dttable = _objnsd.GetNSDDetails(Convert.ToInt64(Session["ECode"]),Session["GpfSuffix"].ToString(),Convert.ToInt32(Session["Desig"]),Convert.ToInt32(Session["BillCode"]),Session["Orderid"].ToString());
		if (_dttable.Rows.Count > 0)
		{
			foreach(DataColumn dc in _dttable.Columns)
			{
				_colname = dc.ColumnName.Trim();
				((TextBox)pnlNSDEntry.FindControl("txt"+_colname)).Text = _dttable.Rows[0][_colname].ToString();
			}
			if(Session["language"].ToString()!="English")
				btnSave.Text=Session["tupdate"].ToString();
			else
			    btnSave.Text = "Update";
		}
	}
	catch(Exception ex)
	{
		ErrorLabel1.Visible = true;
		ErrorLabel1.ErrorText = ex.Message;
	}
}
Posted
Updated 12-Mar-13 0:42am
v4
Comments
NaVeN Kumar 12-Mar-13 5:55am    
Please post your code here...
manuel_joseph 12-Mar-13 6:02am    
I called button click

btnNSD.Attributes.Add("onClick", "return ShowScrollPopup('NSDEntry.aspx','','','NSD Entry','1000','800');");
---

<%
Response.CacheControl = "Private";
Response.Expires= -1;
Response.AddHeader("pragma", "no-cache");
%>

i got error here...

------

private void FillEmployeeNSDDetails()
{
try
{
_objnsd = new clsNSD();
string _colname="";
DataTable _dttable = _objnsd.GetNSDDetails(Convert.ToInt64(Session["ECode"]),Session["GpfSuffix"].ToString(),Convert.ToInt32(Session["Desig"]),Convert.ToInt32(Session["BillCode"]),Session["Orderid"].ToString());
if (_dttable.Rows.Count > 0)
{
foreach(DataColumn dc in _dttable.Columns)
{
_colname = dc.ColumnName.Trim();
((TextBox)pnlNSDEntry.FindControl("txt"+_colname)).Text = _dttable.Rows[0][_colname].ToString();
}
if(Session["language"].ToString()!="English")
btnSave.Text=Session["tupdate"].ToString();
else
btnSave.Text = "Update";
}
}
catch(Exception ex)
{
ErrorLabel1.Visible = true;
ErrorLabel1.ErrorText = ex.Message;
}
}

--------
Nandakishore G N 12-Mar-13 7:14am    
check the places where you are binding data to the dropdownlist.because this error occurs when you are trying to bind to the same dropdownlist multiple times.
ZurdoDev 12-Mar-13 7:23am    
What's the error?
kishore sharma 12-Mar-13 7:43am    
In your code we are unable to find the line where you are getting error as there is no dropdownlist. So the work around is where ever you are binding the dropdownlist and selecting the value ,before the selection try to use property of dropdownlist clearselection() and then you select the value.

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