473,387 Members | 1,416 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to get Datakey from gridview row?

jc
Duh..

How do I do this? CreditId is my datakey, but I can't seem to get to
it.

Dim dgItem As GridViewRow
For Each dgItem In gridEmployeeCredits.Rows
If dgItem.DataItem("CreditId") = 0 Then
Dim textboxCreditDate As TextBox =
CType(dgItem.FindControl("textboxCreditDate"), TextBox)
textboxCreditDate.Text = ""
End If
Next

Thanks.
Mar 6 '08 #1
1 40125
Using the GridView.SelectedValue property
you can get the data key value of the selected row in a GridView control
see here:
http://msdn2.microsoft.com/en-us/lib...ue(VS.80).aspx

Or if you want to get a collection of datakeys objects that represents the
data key value of each row in a GridView control, you can use the
GridView.DataKeys property
see here:
http://msdn2.microsoft.com/en-us/lib...ys(VS.80).aspx
--

SorCereSs
MCTS: NET Framework 2.0 - Web-Based Client Development
MCPD: Web Developer
Microsoft Student Partner - Paraguay

Mar 6 '08 #2

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

Similar topics

1
by: mike | last post by:
i'd like to get datakey of GridView So i write code like below but it wasn't work well. how should i do? protected void BookGridView_RowDataBound(object sender, GridViewRowEventArgs e) { int...
1
by: Mark Richards | last post by:
I posted this earlier, and got no response. Basically I need to be able to grab a value from one of the fields in a gridView to populate a dropdown in another column of the gridview: I have a...
3
by: MasterChief | last post by:
I am trying to add an attribute to a gridview row so when you click on it, it will pop up an alert saying the current datakey for that row. How is it possible to get a datakey when using the...
5
by: NH | last post by:
How do I find out the row index selected in the gridveiw row command method? I have an imageButton in a gridview cell and its corresponding code in the row command method needs to know the row...
1
by: Steven Blair | last post by:
Here is my problem: I have a GridView with a Select column. Once the user clicks the Select button the following things need to happen. 1. Need to store the DataKey of the selectedindex 2....
1
by: ram_kri | last post by:
Hi Guys, Here is a uncommon scenario that I had to work on.. I have a GridView which is associated to a DataSource. But I have a couple of columns (item-templates while the rest of the columns...
3
by: denvercr | last post by:
Hi how do i possibly get the value of a hidden column (id) of a gridview binded in sqldatasource? i have this code in C# usng GridViewRow and DataKey Classes to retrieve it, I also set the...
7
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
Is there a way to use a gridview in a timecard application, and if so, how? I was looking at using a gridview to display a person's hours worked in a week. To do this, many different data records...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview control with a template column that has a textbox and when the control is bound to the datasource the textbox is filled ok. I then change what is in the textbox in the gridview...
2
by: furqi | last post by:
hello every body my name is furqan ahmed and i am new to asp.net and so to .net controls can any tell me what the following code is saying and what does datakey means thanxxx i am waiting for ur...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
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...

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.