split field by comma

Discussion in 'ASP .Net' started by =?Utf-8?B?UGFvbGE=?=, May 21, 2004.

  1. How can I split a field that is being displayed as an asp:label with a dataview? Currently the field is being displayed using this code
    <asp:label id=dept runat="server" Font-Size="Smaller" Font-Names="Arial" Text='<%# DataBinder.Eval(DataView1, "[0].CATEGORY_APPROVER")%>'></asp:label
    What can I add to get it to split by comma? I need it to also line break after each comma. I'm a beginner and don't know how to modify the code to get the split

    Please help

    Paol
    =?Utf-8?B?UGFvbGE=?=, May 21, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?UGFvbGE=?=

    Darren Clark Guest

    string res = e.CommandArgument.ToString();

    string delimStr = ",";

    char [] delimiter = delimStr.ToCharArray();

    string[] vals = res.Split(delimiter);

    string s = vals[0].ToString();

    string x = vals[1].ToString();

    string s2 = vals[2].ToString();

    "Paola" <> wrote in message news:...
    > How can I split a field that is being displayed as an asp:label with a dataview? Currently the field is being displayed using this code:
    > <asp:label id=dept runat="server" Font-Size="Smaller" Font-Names="Arial" Text='<%# DataBinder.Eval(DataView1, "[0].CATEGORY_APPROVER")%>'></asp:label>
    > What can I add to get it to split by comma? I need it to also line break after each comma. I'm a beginner and don't know how to modify the code to get the split.
    >
    > Please help!
    >
    > Paola
    >
    Darren Clark, May 21, 2004
    #2
    1. Advertising

  3. If you need a line break where the comma is, can you just use replace() to
    change the comma into "<br />" ?

    "Paola" <> wrote in message
    news:...
    > How can I split a field that is being displayed as an asp:label with a
    > dataview? Currently the field is being displayed using this code:
    > <asp:label id=dept runat="server" Font-Size="Smaller"
    > Font-Names="Arial" Text='<%# DataBinder.Eval(DataView1,
    > "[0].CATEGORY_APPROVER")%>'></asp:label>
    > What can I add to get it to split by comma? I need it to also line break
    > after each comma. I'm a beginner and don't know how to modify the code to
    > get the split.
    >
    > Please help!
    >
    > Paola
    >
    Ken Cox [Microsoft MVP], May 21, 2004
    #3
  4. Thanks Darren but where do i put this code? This looks like i can't use my label call? sorry, jus learning .net
    =?Utf-8?B?UGFvbGE=?=, May 21, 2004
    #4
  5. well i need it to split on table rows. any ideas?
    =?Utf-8?B?UGFvbGE=?=, May 21, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer

    Re: splitting field by comma

    Kevin Spencer, May 19, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    444
    =?Utf-8?B?UGFvbGE=?=
    May 20, 2004
  2. dmitrey
    Replies:
    4
    Views:
    446
  3. skywalker skywalker

    asp excel: comma in field value (split into array)

    skywalker skywalker, Apr 13, 2010, in forum: ASP General
    Replies:
    1
    Views:
    827
    Evertjan.
    Apr 13, 2010
  4. Sound
    Replies:
    2
    Views:
    418
    Randy Webb
    Sep 28, 2006
  5. jr
    Replies:
    3
    Views:
    390
Loading...

Share This Page