473,569 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

another simple datagrid question

how can i get the value from a specific column from the selected row of a
datagrid

in the sub i can get the datakey for item command
Me.dgMems.DataK eys(e.Item.Item Index) will get me the key field, but what if
i want the value of column(2). I get nothing when i use
Me.dgMems.Colum ns(2).ToString( ). View state is on.

thanks
(and i hope i don't have to refill the dataset on each select!)
kes

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes
Nov 19 '05 #1
5 1513
If you use the OnItemCommand, you can pickup the value quite easily using
e.Item.Cells[2].Text;
or
((TextBox)e.Ite ms.FindControl( "tb")).Text ; //If it is not a
<Asp:BoundColum n you'll need to cast it

HTH
"WebBuilder 451" <We***********@ discussions.mic rosoft.com> wrote in message
news:76******** *************** ***********@mic rosoft.com...
how can i get the value from a specific column from the selected row of a
datagrid

in the sub i can get the datakey for item command
Me.dgMems.DataK eys(e.Item.Item Index) will get me the key field, but what
if
i want the value of column(2). I get nothing when i use
Me.dgMems.Colum ns(2).ToString( ). View state is on.

thanks
(and i hope i don't have to refill the dataset on each select!)
kes

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes

Nov 19 '05 #2
try this (assuming Label is the first control and language c#):

string the_value = (MyRow.Cells[2].Controls[0]) as Label.Text;
"WebBuilder 451" <We***********@ discussions.mic rosoft.com> wrote in message
news:76******** *************** ***********@mic rosoft.com...
how can i get the value from a specific column from the selected row of a
datagrid

in the sub i can get the datakey for item command
Me.dgMems.DataK eys(e.Item.Item Index) will get me the key field, but what
if
i want the value of column(2). I get nothing when i use
Me.dgMems.Colum ns(2).ToString( ). View state is on.

thanks
(and i hope i don't have to refill the dataset on each select!)
kes

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes

Nov 19 '05 #3
e.Item.Cells(2)

Eliyahu

"WebBuilder 451" <We***********@ discussions.mic rosoft.com> wrote in message
news:76******** *************** ***********@mic rosoft.com...
how can i get the value from a specific column from the selected row of a
datagrid

in the sub i can get the datakey for item command
Me.dgMems.DataK eys(e.Item.Item Index) will get me the key field, but what if i want the value of column(2). I get nothing when i use
Me.dgMems.Colum ns(2).ToString( ). View state is on.

thanks
(and i hope i don't have to refill the dataset on each select!)
kes

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes

Nov 19 '05 #4
e.Item.Cells(2) .Text

Eliyahu

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:eZ******** ******@TK2MSFTN GP12.phx.gbl...
e.Item.Cells(2)

Eliyahu

"WebBuilder 451" <We***********@ discussions.mic rosoft.com> wrote in message
news:76******** *************** ***********@mic rosoft.com...
how can i get the value from a specific column from the selected row of a datagrid

in the sub i can get the datakey for item command
Me.dgMems.DataK eys(e.Item.Item Index) will get me the key field, but what

if
i want the value of column(2). I get nothing when i use
Me.dgMems.Colum ns(2).ToString( ). View state is on.

thanks
(and i hope i don't have to refill the dataset on each select!)
kes

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes


Nov 19 '05 #5
thanks everyone,
i knew it just had to be simple!

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes
"Grant Merwitz" wrote:
If you use the OnItemCommand, you can pickup the value quite easily using
e.Item.Cells[2].Text;
or
((TextBox)e.Ite ms.FindControl( "tb")).Text ; //If it is not a
<Asp:BoundColum n you'll need to cast it

HTH
"WebBuilder 451" <We***********@ discussions.mic rosoft.com> wrote in message
news:76******** *************** ***********@mic rosoft.com...
how can i get the value from a specific column from the selected row of a
datagrid

in the sub i can get the datakey for item command
Me.dgMems.DataK eys(e.Item.Item Index) will get me the key field, but what
if
i want the value of column(2). I get nothing when i use
Me.dgMems.Colum ns(2).ToString( ). View state is on.

thanks
(and i hope i don't have to refill the dataset on each select!)
kes

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes


Nov 19 '05 #6

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

Similar topics

1
1206
by: serge calderara | last post by:
Dear all, I have a simple datagrid binding to a datasource dataset object that collect a simple table from a database. When I get data from that table, my datagrid appeard with a tree node sign + that i need to deploy for exploring my table. is there a way to supress that node sign and display directly table information ?
7
2325
by: Sky | last post by:
What I have currently: I have a user control called mod_container.aspx that is basically two divs -- the top a toolbar, that expands/collapse the second div which can contain other modules/controls (eg a newsfeed, quick phonelist, login, etc.) But the controls end up too 'deep': it appears that it would be lighter/better if I could just...
2
1319
by: Bart Schelkens | last post by:
Sorry but I have another question about a button in a datagrid. I have the following button in my datagrid : asp:TemplateColumn HeaderText=""> <HeaderStyle width="20px"></HeaderStyle> <ItemTemplate> <asp:Button id="btnSubCategory" Text="Sub-Categorie" runat="server" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"CategoryID")...
5
1650
by: Lyners | last post by:
What I want to do, I have a datagrid with totals in one column and a text field in the next. What I would like to provide is a way for the user to click on an arrow under/next to the total amount that would then load into the text field. I know I could just use an edit button and have an event handle it, but that would take too much time with...
5
2462
by: Nathan Sokalski | last post by:
I am writing an ASP.NET application in which I need to copy DataRows from one DataTable to another. When I use code such as the following: temprows = nodes.Select("state='PA'") temptable.Clear() For Each row As DataRow In temprows temptable.Rows.Add(row) Next
2
1113
by: Rich Wallace | last post by:
I know datasets have been beaten to death in here, I have what is hopefully a simple question about the integrity of a dataset when used in an application. Scenario: User A and User B are updating data in a SQL database via an application that utilizes a dataset, dataadapter and datagrid. User A retrieves data from data source and sits...
2
1211
by: James | last post by:
I have a very simple datagrid, with an edit button that I added in PropertyBuilder. This fires the EditCommand event just fine and I show a panel where the user can edit certain fields. I have a button to save the changes. Within that button, I refer to dataGrid1.EditItemIndex and it's returning -1. Isn't this property set when I click on...
13
2437
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever works best) to display a dropdown menu of fields populated from table tblInvoiceData. This control also includes a textbox which the user can input a...
2
5872
by: SePp | last post by:
Hi all. I want to refresh a Datagrid from another form. For Example I have a Datagrid in that I want to edit data. The user has the ability to press a button to change these data. A new Form opens and the user changes the data. After that he saves the changes and the current form is closing and the old form with the datagrid gets the...
0
7701
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...
0
7979
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...
0
6284
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...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
940
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...

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.