Advertisement

09.06.2007 at 08:31AM PDT, ID: 22811077
[x]
Attachment Details

Cannot get Datakey Value from a Gridview in vb.net

Asked by jcook32 in Visual Studio .NET 2005, Programming for ASP.NET, Microsoft Visual Basic.Net

Tags: gridview, get, datakey, value

I am new to the gridview in .net 2.0.
i am tying to get the id for the record that i select in the grid.
this is my code
 Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
        Dim tempid As String
        tempid = GridView1.SelectedDataKey.Item(
     

        myBL.Load(tempid)
    End Sub

this is the line that i cannot figure out
GridView1.SelectedDataKey.Item(

i have a Datakey set that is the index of my dataset.
do i need to create a column to beable to use the value of it or is it like vs 2003 where you set the datakey and once you reference it you  using e.item.item value you have the value and can use it

please help
jcook32Start Free Trial
[+][-]09.06.2007 at 09:00AM PDT, ID: 19841233

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.06.2007 at 10:12AM PDT, ID: 19841955

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.06.2007 at 12:58PM PDT, ID: 19843228

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio .NET 2005, Programming for ASP.NET, Microsoft Visual Basic.Net
Tags: gridview, get, datakey, value
Sign Up Now!
Solution Provided By: CONCEPTINFOTECH
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628