473,511 Members | 12,087 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting comma separated values from a cell in gridview

48 New Member
Hi,

In the datagridview control, one of my column has multiple values separated by a comma
Is there a way to get individaual values which are separated by a comma from that particular cells?


Thanks in advance,
Brugu
Sep 17 '07 #1
4 7654
dip_developer
648 Recognized Expert Contributor
Hi,

In the datagridview control, one of my column has multiple values separated by a comma
Is there a way to get individaual values which are separated by a comma from that particular cells?


Thanks in advance,
Brugu
I dont know the language you are using........whatever.........
get the full string from the gridview cell......I think you know well how to retrieve cell value of a gridview......there are plenty of ways......like...

Expand|Select|Wrap|Line Numbers
  1. foreach (GridViewRow row in GridView1.Rows)
  2. {
  3. string col1Value = row.Cells[0].Text;
  4. }
  5.  
or

Expand|Select|Wrap|Line Numbers
  1. foreach (GridViewRow row in GridView1.Rows)
  2. {
  3. string col1Value = ((Label)row.FindControl("lblName")).Text;
  4. }
  5.  
now split the string by the Split() method of the string class...like

Expand|Select|Wrap|Line Numbers
  1.  
  2. string[] result ; 
  3. char[] stringSeparators={','};
  4. result = col1Value .Split(stringSeparators);
  5.  
Sep 17 '07 #2
navneetkaur
45 New Member
i suppose above method is absolutely fine i have also done with it....jst use it 'd reply whether its wrking or not
Sep 17 '07 #3
mzmishra
390 Recognized Expert Contributor
This code is in C#
private ArrayList m_stringGridColValue = new ArrayList();
int lengthc=stringGridColValue.IndexOf(",");
if(lengthc>0)
{
while(stringGridColValue.Length > 0)
{

int i=stringGridColValue.IndexOf(",");
string c=stringGridColValue.Substring(0,i);
ListItem item=new ListItem(c,c);
m_stringGridColValue.Add(item);
stringGridColValue=stringGridColValue.Substring(i+ 1);


}
}
Sep 17 '07 #4
CSKR
1 New Member
How can I collect from the gridview ,all the cell values from the 'email column' in a string separated by' ;' so that I can use the string to send email by smtp from the web application?

Thanks,
CSKR
Sep 25 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
3068
by: Craig Keightley | last post by:
is it possible to compare acomma separated list aginst another eg comma list 1 => 1,2,3,4,5 comma list 2 => 3,5 can you check that 3 is in both, and 5 is in both, therfore they match??? the...
11
2517
by: Craig Keightley | last post by:
I have a mysql database with a list of companies who supply specific products tblSuppliers (simplified) sID | sName | goodsRefs 1 | comp name | 1,2,3,4,5 2 | company 2 | 2,4
4
3116
by: Mark | last post by:
hey, i'm trying to get the current windows user and the groups they are in. Intergrated windows auth on and annoymous access turned off on IIS. However when trying to compile the following code...
1
5294
by: nate axtell | last post by:
In VB .NET I load the contents of an Excel or comma seperated values file into a dataGrid (via a datatable). One of the columns has a comma in the name of the column. So for the comma separated...
6
15134
by: ibiza | last post by:
Hi all, I've binded some data from a DB in a gridview and one of the values is a float. Even if the flot is represented as 4.2 in the DB, it is rendered as 4,2 in the gridview, with a comma....
9
5291
by: phillip.s.powell | last post by:
Ok, you have three tables. You're supposed to be able to not only sort (ORDER BY) according to a_name, no problem, but you must also have the ability to sort (ORDER BY) the relationship between...
3
29574
by: mahe23 | last post by:
All, How do One convert a comma separated column from a text file into rows in oracle. I have a scenario where the list of comma separated values changes dynamically. It is like: abc, ttt,...
4
4637
by: sufian | last post by:
Below is the field where user enters his/her email address and the AJAX post request is sent to the server and the user sees the message: echo("<div id=\"message\" class=\"success\">Thank you! You...
3
29736
by: nigel | last post by:
Hi, I'm using VBA to export data from a table direct to a CSV file DoCmd.TransferText acExportDelim, , "ExportTable", filePath this produced a file with COMMA separated values,...
0
7245
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
7144
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
7427
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
5671
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
5069
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
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
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
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.