problems getting text from labels in datagrid control

C

Charles

I am having some problems with getting the text from a
label inside of a datagrid control. I want to put the
text of the label into an array.

Here is part of the *.aspx file:
<asp:TemplateColumn HeaderText="Last Name">
<ItemTemplate>
<asp:Label id=lblLName runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.LName") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id=LName CssClass=grid runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.LName") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>

Just before the EditCommand event I want to get the
current values of all (I have eight, but only show one
here) labels. Right now in my EditCommand event I have:

For I = 1 To e.Item.Cells.Count - 1
Dim label1 As Label = DataGrid1.Items(I).Cells
(0).Controls(1)
CurrentValues(I) = label1.Text
Next

Before this line:

DataGrid1.EditItemIndex = e.Item.ItemIndex

How do I get a text value from a label from a datagrid
control? I want to compare two arrays to find what
information in the grid (edited row) has been changed. I
am not sure if this is a good way, so if there is please
share that with me.

Thanks,
Charles
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top