473,507 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data Grid cell value

dir sir
I have a problem with the data gri
I want to get the data in the selected cell and store it in a strin
How can I do that??!

thanks si
Mohammed
Nov 16 '05 #1
2 7095
Hi
Use itembound u can get the each and every cell value
private void dgdUserBrowse_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)

{

if(e.Item.ItemType != ListItemType.Header && e.Item.ItemType !=
ListItemType.Footer)

{

((LinkButton)e.Item.Cells[0].Controls[2]).Attributes["onclick"] =
"javascript:return confirm('Delete user. " +
DataBinder.Eval(e.Item.DataItem,"name") + "?')";

}

}
pls check this code

Regards
Venu.
"Mohammed Abdel-Razzak" <an*******@discussions.microsoft.com> wrote in
message news:87**********************************@microsof t.com...
dir sirs
I have a problem with the data grid
I want to get the data in the selected cell and store it in a string
How can I do that??!!

thanks sir
Mohammed

Nov 16 '05 #2
Mohammed Abdel-Razzak wrote:
I have a problem with the data grid
I want to get the data in the selected cell and store it in a string
How can I do that??!!


Are you just trying to get the value of the current cell? If so, you can
use the CurrentCell property of the DataGrid object and get the
RowNumber and ColumnNumber of the cell. Then you can use those with the
DataTable object associated with the DataGrid to get the value. For
example,

Dim dgc As DataGridCell = DataGrid1.CurrentCell
string cellValue = dt.Rows(dgc.RowNumber).Item(dgc.ColumnNumber)

Cheers

Arne Janning
Nov 16 '05 #3

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

Similar topics

1
1481
by: Ananth | last post by:
Hi, I have a question regarding data grids My application requires me to use a grid for displaying data, however I would not be using a database for procuring the data, instead I would be...
2
1667
by: Jeremy S | last post by:
In a Web Forms application I present users with a list of items - each of which the user is to assign to a grid. The grid is N rows by 3 columns. The users enter the desired target cell for each...
1
1830
by: Blake Versiga | last post by:
When editing a datagrid (C#) I need to know if the user changed the value of cell AND what the previous value was. Is this possible? If so how do I get the previous value or at least if the...
2
2207
by: Joe Au | last post by:
I follow the Walkthrough documented on Visual Studio to create an editable data grid but it does not work on getting the value of the textbox in the data grid. The code is copied here. I mark...
15
3933
by: anthonyberet | last post by:
Hello again - rather a newbie here... I want to work on a sudoku brute-forcer, just for fun. I am considering different strategies, but first I need to decide on the data-structure to use for...
7
10039
by: John J. Hughes II | last post by:
I have a DataGridView with a TextBoxColumn. I setting the data source to a List<stringvalue in a static class. The list is filled from a background thread. So far all is fine and it works...
0
1288
by: John Wright | last post by:
I have a datagrid that contains a list of decimal values. I want to compare the values of one datatable to the other datatable and update my data grid. For example my first datatable has the...
6
2930
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1)...
0
1870
by: jchaturv | last post by:
All, I have a customized DataGridView where I have implemented extra functionality and bounded datasource in the same custom DataGridView (Using C# and .NET). Now, I could able to use it...
0
7111
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
7319
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,...
1
7031
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...
1
5042
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
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1542
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
760
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.