473,503 Members | 1,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

split field by comma

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

Nov 18 '05 #1
4 4559
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" <an*******@discussions.microsoft.com> wrote in message news:EB**********************************@microsof t.com...
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

Nov 18 '05 #2
If you need a line break where the comma is, can you just use replace() to
change the comma into "<br />" ?

"Paola" <an*******@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
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


Nov 18 '05 #3
Thanks Darren but where do i put this code? This looks like i can't use my label call? sorry, jus learning .net
Nov 18 '05 #4
well i need it to split on table rows. any ideas?
Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1388
by: Hans Almåsbakk | last post by:
Hi, I have a problem which I believe is seen before: Finding the correct pattern to use, in order to split a line correctly, using the split function in the re module. I'm new to regexp, and...
6
7834
by: JLM | last post by:
Haven't seen this question yet. I have a field that has "LastName,FirstName". I want to split that field into two, based on the comma. Size of LastName is obviously different in each record,...
4
728
by: William Stacey [MVP] | last post by:
Would like help with a (I think) a common regex split example. Thanks for your example in advance. Cheers! Source Data Example: one "two three" four Optional, but would also like to...
8
2723
by: mannyGonzales | last post by:
Hey guys, Earliery I posted this common task of reading a csv file. My data read as: "1","2","3" Unfortunately it now reads as: "1","Text with, comma", "2" embedded commas!...
0
378
by: simonjackson500 | last post by:
I have a field as follows: aa_comp 03, 04, 05 03, 07, 05, 20 03, 06, 07 It is imported from xml (along with other fields), and I am aware of multiple values in a field is bad normalisation.
10
11889
by: pantagruel | last post by:
Hi, I'm looking for an optimal javascript function to split a camelcase string and return an array. I suppose one could loop through the string, check if character is uppercase and start...
9
2173
by: MrHelpMe | last post by:
Hello again experts, I have successfully pulled data from an LDAP server and now what I want to do is drop the data into a database table. The following is my code that will insert the data but...
14
4691
by: tom t/LA | last post by:
Here is a function to convert a CSV file to a Javascript array. Uses idealized file reading functions based on the std C library, since there is no Javascript standard. Not fully tested. ...
5
11925
sicarie
by: sicarie | last post by:
I am attempting to parse a CSV, but am not allowed to install the CSV parsing module because of "security reasons" (what a joke), so I'm attempting to use 'split' to break up a comma-delimited file....
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.