Get value from Cell B1 and C1 from Datagrid

  • Thread starter Thread starter Mark B
  • Start date Start date
M

Mark B

I'd like to display the values of cells B1 and C1 from a datagrid (i.e. the
2nd and 3rd columns of the first row) on another part of the aspx page in
large text. This is because these are important sales figures.

Is is possible to return each of those two values so I can include them in a
<% =.............. %> ?

Something like <% =Datagrid1.RowColumn(1,2).Value %>
 
Thanks. One of the cells is a template cell which calls a function. It is
not returning any data even though the grid displays data.
 
Hello Mark,

We can call FindControl method on the template cell to get the control with
the value in need. Suppose there's a Label control whose id is lblText in
the template, the ReturnCalculateValue function can be writtern in this way:

public string ReturnCalculateValue()
{
Label lbl =
(Label)GridView1.Rows[0].Cells[0].FindControl("lblText");
return lbl.Text;
}

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
 
Back
Top