DataGridItem.Cells[Index].Text question

  • Thread starter Thread starter CC
  • Start date Start date
C

CC

Does anyone know the answer to this question? I am encountering the
same "" empty value.

Thanks!

-----------------------------------------
Message 1 in thread
From: christian strevel ([email protected])
Subject: DataGridItem.Cells[Index].Text question

Newsgroups: microsoft.public.dotnet.languages.csharp
Date: 2003-04-01 15:40:17 PST


I have a C# ASP.NET webform, in which I have a DataGrid binded to some
SQL results.

I have a checkbox in the first column, to allow selection of items in
the grid. After a set of items is selected, I want to store those
items in a hashtable. That works ok, but when storing the value of a
HyperLink column, it gives me a "" (empty) value.

The sentence I'm using is this:

foreach (DataGridItem itm in grid.Items)
{
CheckBox chk = (CheckBox) itm.Cells[0].FindControl("chk");
if (chk.Checked)
{
mht.Add(itm.Cells[0].Text, itm.Cells[3].Text);
}
}

Does anyone knows how to get the Text value from a HyperLink column?

I have tried creating a templatecolumn, then put a hyperlink and do a
findcontrol("hk") to get the hk.Text and does work. I have even tried
putting a Label control inside a hyperlink control and still doesn't
work.

Can you gimme out some pointers on this?
 
Back
Top