i have create 2 drop down list..and i set value for first DropDownList1..its working good..
now i trying to add a method to collect all (list) data from DropDownList1 and split into words and display into DropDownList2..
when i add method to Default.aspx.cs page it nt working...get me some help to find out the problem..
heres my code(no errors):
<span style="text-decoration:underline Default.aspx
<body><br/>
<form id="form1" runat="server <br/>
<br/>
<br/>
<asp
ropDownList ID="DropDownList1" runat="server"
<br/>
DataSourceID="SqlDataSource1" DataTextField="name" DataValueField="name <br/>
</asp
ropDownList><br/>
<br/>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
<br/>
ConnectionString="<%$ ConnectionStrings:tempdbConnectionString %>"
<br/>
SelectCommand="SELECT * FROM [student] </asp:SqlDataSource><br/>
<br /><br/>
<br /><br/>
<br /><br/>
<br/>
<asp
ropDownList ID="DropDownList2" runat="server <br/>
</asp
ropDownList><br/>
<br/>
<br/>
<br/>
<br/>
</form><span style="text-decoration:underline
<span style="text-decoration:underline Default.aspx.cs
public partial class _Default : System.Web.UI.Page <br/>
{<br/>
protected void Page_Load(object sender, EventArgs e)<br/>
{<br/>
foreach (object o in dropDownList.Items)<br/>
{<br/>
string[] splitted = o.ToString().Split(new char[] { });<br/>
foreach (string s in splitted)<br/>
DropDownList1.Items.Add(s);<br/>
}<br/>
}<br/>
}
View the full article
now i trying to add a method to collect all (list) data from DropDownList1 and split into words and display into DropDownList2..
when i add method to Default.aspx.cs page it nt working...get me some help to find out the problem..
heres my code(no errors):
<span style="text-decoration:underline Default.aspx
<body><br/>
<form id="form1" runat="server <br/>
<br/>
<br/>
<asp

<br/>
DataSourceID="SqlDataSource1" DataTextField="name" DataValueField="name <br/>
</asp

<br/>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
<br/>
ConnectionString="<%$ ConnectionStrings:tempdbConnectionString %>"
<br/>
SelectCommand="SELECT * FROM [student] </asp:SqlDataSource><br/>
<br /><br/>
<br /><br/>
<br /><br/>
<br/>
<asp

</asp

<br/>
<br/>
<br/>
<br/>
</form><span style="text-decoration:underline
<span style="text-decoration:underline Default.aspx.cs
public partial class _Default : System.Web.UI.Page <br/>
{<br/>
protected void Page_Load(object sender, EventArgs e)<br/>
{<br/>
foreach (object o in dropDownList.Items)<br/>
{<br/>
string[] splitted = o.ToString().Split(new char[] { });<br/>
foreach (string s in splitted)<br/>
DropDownList1.Items.Add(s);<br/>
}<br/>
}<br/>
}
View the full article