if (list.options[i].selected) {
listval=list.options[i].value +"," + listval
}
if muliple items are slected then there is no issue but if only one item is selected i get i double times
In that case check that is should not be rebind every time otherwise selections will be lost
its binded everytime
1) populated at run time in postback as population depends on condition from user
2) so binded everytime
as per current flow i will have values only in the session variable
If you bind everytime the controls viewstate is lost hence selections will be lost. No hence bind only once
did not get
code i have
select name as theName from tab;le1 where name='"+textbox1.text+"'"; ddlValues; ddlValues = cmd.ExecuteReader(); DropDownList1.DataSource = ddlValues; DropDownList1.DataValueField = "theName"; DropDownList1.DataTextField = "theName"; DropDownList1.DataBind(); cmd.Connection.Close(); cmd.Connection.Dispose();
Meaning you should bind listbox only once on page load !ispostback so that the selections are retained. If you bind listbox on each postback what the user has selected will be lost
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.