Get value from Cell B1 and C1 from Datagrid

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 %>
 
M

Mark B

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.
 
J

Jialiang Ge [MSFT]

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.
=================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top