(int) DataGrid2.DataKeys[(int) e.Item.ItemIndex]

Posted on 2005-04-25
Last Modified: 2010-04-07
does anyone has any idea why (int) DataGrid2.DataKeys[(int) e.Item.ItemIndex]  - specifically DataGrid2.DataKeys will not have any count records on one page and yes on another?

Question by:epmo
    LVL 12

    Accepted Solution

    It depends on whether the DataKeyField attribute of the datagrid is set or not.

    Author Comment

    how do you set it?
    LVL 12

    Expert Comment

    I think you should have figured it out.

    Like this:
    <asp:datagrid id="details" runat="server" Height="370px" Width="850px" AutoGenerateColumns="False" DataKeyField="ID" >

    Author Comment

    Thank you!

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now