Advertisement

10.30.2007 at 09:30AM PDT, ID: 22927409
[x]
Attachment Details

trouble with Gridview and DataKeyNamese attribute

Asked by jcook32 in Programming for ASP.NET

Tags:

I have a grid view that returns a image button in the first column and i need to get the value of the second column in the datagrid to pass that value to back to beable to edit the record.
I also set up a datakeyname using that same field name from the database.
here is my code:
   Protected Sub GridView2_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView2.RowEditing
        Dim billid As Integer

        billid = GridView2.SelectedRow.Cells(2).Text

        Response.Redirect("main.aspx?mode=edit&billid=" & billid)

    End Sub

I get  a null excetion on this line everytime

     billid = GridView2.SelectedRow.Cells(2).Text

what is the problem?

Please help
Thanks

jcookStart Free Trial
[+][-]10.30.2007 at 09:47PM PDT, ID: 20182882

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.

 
[+][-]10.30.2007 at 09:47PM PDT, ID: 20182886

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

Zone: Programming for ASP.NET
Tags: gridview
Sign Up Now!
Solution Provided By: madhevan_pillai
Participating Experts: 1
Solution Grade: A
 
 
[+][-]10.31.2007 at 05:36AM PDT, ID: 20184752

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.

 
[+][-]10.31.2007 at 05:58AM PDT, ID: 20184946

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

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

 
[+][-]10.31.2007 at 05:58AM PDT, ID: 20184948

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.

 
[+][-]10.31.2007 at 07:25AM PDT, ID: 20185729

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.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628