473,657 Members | 2,763 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 7673
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........wh atever.........
get the full string from the gridview cell......I think you know well how to retrieve cell value of a gridview......t here 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_stringGridCol Value = new ArrayList();
int lengthc=stringG ridColValue.Ind exOf(",");
if(lengthc>0)
{
while(stringGri dColValue.Lengt h > 0)
{

int i=stringGridCol Value.IndexOf(" ,");
string c=stringGridCol Value.Substring (0,i);
ListItem item=new ListItem(c,c);
m_stringGridCol Value.Add(item) ;
stringGridColVa lue=stringGridC olValue.Substri ng(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
3080
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 comparison is to check that if product a who supplies products 1,2,3,4,5 can be used instead of product b who supplies 3,5 as product a already supplies them
11
2526
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
3124
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 VS.net doesn't like the User.IsInRole("domain"); With the error "type or namspace for User not found". I can't work out which reference i'm missing! Basically the idea is to create a auth component that is called for
1
5307
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 values files I put double quotes are the column name. What I see is that the name ends up getting displayed correctly in the DataGrid column, "Class (1,2,3)". When I click on the column to sort I see the following error: "Additional information:...
6
15173
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. When I edit the row, it is still a comma in the editable textbox. And if I click on Update that way, it gives an error, that the input value cannot be converted to a float, when doing the UPDATE. If I change the comma for a point, it works, which I...
9
5309
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 table_a and table_b, that is, say you have this: Here is where the problem lies. I am required to be able to sort by 'Phil', no problem:
3
29589
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, 1,2,34,56,67,, afg, ttt, 3,4,5,6,,,,,
4
4651
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 have been successfully registered.</div>"); within 1.5 seconds. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta...
3
29755
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, until...my computer got fried and the repair shop re-installed Windows XP in French (I
0
8394
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7327
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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 we have to send another system
2
1615
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.