Search This Blog

Loading...

Nov 18, 2010

Split Function in C#


Sponsored Links:

With the Help of split function we can split string with single character as below

/* 
* let's assume we are storing name of Users
* In single column (James, Veronica,Riddick)
* and we want to split to fill the dropdown
*/
string[] users = Convert.ToString
(
ds.Tables[0].Rows[0]["LIST_OFUSERS"]
).Split(',');
//Code to Fill Drop Down 
ArrayList ar = new ArrayList();
cboUsers.Items.Add("Select");
for (int x = 0; x < users.Length; x++)
{
ar.Add(users);
}
cbo.DataSource = ar; //dropdown filled
cbo.DataBind();
  

Follow by Email