473,395 Members | 1,624 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,395 software developers and data experts.

Find ItemIndex given DataKey in DataGrid

Rod
While working with a datagrid I have a value for the datakey, from this I
want to find the ItemIndex.

How please?

many thanks in advance.

Mar 9 '07 #1
2 4383
On Mar 9, 12:59 pm, "Rod" <RodRodRod...@Hotmail.comwrote:
While working with a datagrid I have a value for the datakey, from this I
want to find the ItemIndex.

How please?

many thanks in advance.
If I got you right, you can enumerate all items...

VB:

For Each dgItem In MyDataGrid.Items

'Retrieve key value of each record based on DataGrids DataKeyField
property
If MyDataGrid.DataKeys(dgItem.ItemIndex) = datakey then

.....
Mar 9 '07 #2
Rod

"Alexey Smirnov" <al************@gmail.comwrote in message
news:11*********************@64g2000cwx.googlegrou ps.com...
On Mar 9, 12:59 pm, "Rod" <RodRodRod...@Hotmail.comwrote:
>While working with a datagrid I have a value for the datakey, from this I
want to find the ItemIndex.

How please?

many thanks in advance.

If I got you right, you can enumerate all items...

VB:

For Each dgItem In MyDataGrid.Items

'Retrieve key value of each record based on DataGrids DataKeyField
property
If MyDataGrid.DataKeys(dgItem.ItemIndex) = datakey then

That's good

Thanks
Mar 9 '07 #3

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

Similar topics

0
by: A frustrated developer | last post by:
I would like to find a specific row on web datagrid, locate its pageindex and itemindex, then highlight to the specific row I found. I know its datakeyfield value, is there anyway we could search...
12
by: Jim H | last post by:
We ahve a .NET web page that we dynamically create a bunch of DataGrids and add them to a place holder. When the user hits submit we need to go through all of the DataGrids to get some data. We...
0
by: Popoxinhxan | last post by:
Hi guy , i would like to have a Find search function like in Ms Excel to search for specific keyword in the list view. Could anyone help me to do so. Currently i can only get the index of the item...
2
by: Alex | last post by:
I'm wondering how I can add data to the datakey property of the DataGrid. It seems to be read only. How can I populate it? I'm using data bound columns, however do not autogenerate the entire grid...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
0
by: brian yeo via .NET 247 | last post by:
I could not fetch "userID/column0" since my datagrid does not usethe DataKeyField (due to reformatting of dates - not shown). TheItemIndex can be located from clicking Edit button. How do Iread the...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
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...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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.