Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

Changing Gridview Value

Hello,

I have a gridview control.  This has several columns and multiple rows.

I’d like to accomplish the following.  Take the value of column 4 and pass it into a function which returns a value and then displays that in the original cell.
This is to be done for each row.

I thought I could do this like this but this gives an Object reference not set to an instance of an object error:

    Protected Sub GV_All_Actions_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GV_All_Actions.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim lblActioner As Label = DirectCast(GV_All_Actions.FindControl("lbl_actioner"), Label)
            lblActioner.Text = callFunction(lblActioner.Text.ToString())
        End If
    End Sub

Any suggestions?
0
andyw27
Asked:
andyw27
  • 2
1 Solution
 
sonawanekiranCommented:
Try

e.Row.FindControl("SqlDataSource1") instead of GV_All_Actions.FindControl("lbl_actioner")

0
 
sonawanekiranCommented:
Replace SqlDataSource1 with lbl_actioner
0
 
andyw27Author Commented:
Cheers worked like a charm.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now