Deepak Awashti

Deepak Awashti

  • NA
  • 301
  • 74.6k

how to used store multiple data in textbox move single data

Dec 21 2015 6:28 AM
how to used store multiple data in textbox in saparation in comma ,move single selected word in listbox using c# code 
 
------------------------- Source Code ----------------------------------------- 
 
<textarea ID="Textarea1" runat="server" rows="10" cols="50"></textarea>
 
<asp:ListBox style="text-align:right" ID="List2" runat="server" Height="100px" Width="300px"></asp:ListBox>
 
<asp:Button ID="Button1" runat="server" Text="Move Data" OnClick="Button1_Click1" /> 
 
 
-------------------------- Page Load Code----------------------
DataTable dt=null; 
 
if(ViewState["data"]==null)
{
DataTable dt = new DataTable();
dt.Columns.Add("ColumnID");
ViewState["data"] = dt;
}
 
 
 
----------------------- Button Code-------------------------------
 
protected void Button1_Click1(object sender, EventArgs e)
{
string str = Textarea1.Value.Trim();
dt = (DataTable)ViewState["data"];
dt.Rows.Add(str);
ViewState["data"] = dt;
List2.DataSource = dt;
List2.DataValueField = "ColumnID";
List2.DataBind();
}
 
please help me.... 
 

Answers (1)