473,671 Members | 2,363 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 7104
Hi
Use itembound u can get the each and every cell value
private void dgdUserBrowse_I temDataBound(ob ject sender,
System.Web.UI.W ebControls.Data GridItemEventAr gs e)

{

if(e.Item.ItemT ype != ListItemType.He ader && e.Item.ItemType !=
ListItemType.Fo oter)

{

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

}

}
pls check this code

Regards
Venu.
"Mohammed Abdel-Razzak" <an*******@disc ussions.microso ft.com> wrote in
message news:87******** *************** ***********@mic rosoft.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.Curre ntCell
string cellValue = dt.Rows(dgc.Row Number).Item(dg c.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
1489
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 exposing interfaces for other methods to pass me the data that needs to be displayed. In such a case is the data grid the best control to use in .NET? Also if I am using a data grid, how can I obtain the value in the current cell of the data grid?(where...
2
1678
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 list item by specifying two integer values - one for the row number and the other for the column number of the target cell. When users submit the form for processing I need to validate that the following are all true: Please note that I can...
1
1836
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 cell has changed? TIA Blake
2
2211
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 "*****" at which the categoryName always get the past value no matter what it has been changed. How do I fix it? Thanks. Joe. Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As...
15
3949
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 the progress/solution grid. This being a square, I would have used a 9x9 2-dimensional array in my teenage years back in the 80's, using BASIC.
7
10049
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 great, at least on my system. The reason I am doing this is some customers are pulling from VPN connections which are slow. This allows the list of rows in the data grid to appear a little quicker while the list which are not used as soon load in...
0
1297
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 following data Sample Number Location Reading1 Reading2 Reading3 Reading4.......ReadingX 12345 1 22.3 21.2 31.5 28.3 54.2 12345 2 21.4...
6
2938
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) Constraint pk_table1 Primary Key,
0
1877
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 properly by placing it on a panel control. I have added label as button on panel control to display data from datasource on to datagrid and create a binding source. Another Label which act as a button is used to update data from grid to databse.
0
8919
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
8821
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
8599
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
8670
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7439
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
4225
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4409
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2052
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1810
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.