How to Get a Gridview Cell Value

Written by alexander gokhfeld
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Get a Gridview Cell Value
GrdView control classes allows easy access to the data tables. (Jupiterimages/Photos.com/Getty Images)

The GridView control class is used to retrieve and present data in the table form. The GridView class and its supporting classes enable the users of Microsoft Framework to view data sets by using interactive column headers. It displays a list of data items by binding data cells to columns and by showing a column header to identify the cell. The ability to dynamically view and retrieve columns is built into the GridView control. The properties of the DataGrid must be bound to the data set to get a GridView cell value.

Skill level:
Easy

Other People Are Reading

Instructions

  1. 1

    Click the "Start" button in Windows and select "Visual Studio" application from the "All Programs" menu.

  2. 2

    Click on "Open" in the "File" menu and locate the C program you want

    to use the GridView control for retrieving a cell value.

  3. 3

    Add the following code after the "public GridView" line:

    TextBox.Text = DataGridView1.Item(1, DataGridView1.SelectedRows

    (0).Index).Value

    protected void GridView1_DataBound(object sender, GridViewRowEventArgs e)

    {
    
        if (e.Row.RowType == DataControlRowType.DataRow)
    
        {
    
            if (e.Row.Cells[0].Text.Contains("sometext"))
    
            {
    
                e.Row.Cells[0].Font.Bold = true;
    
            }
    
        }
    
    }.
    
  4. 4

    Click "FIle" and select the "Save" option. Click the "OK" button to add the function for getting the GridView cell value in your C program.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.