Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Blank value returned on ItemDataBound event using e.Item.Cells

Thread Tools

Blank value returned on ItemDataBound event using e.Item.Cells

Posts: n/a

I have a datagrid and want to be able to assess the value of one cell
on each line in order to hide or display the hyperlink in the next
cell. I therefore used the ItemDataBound, and intially wrote the cell
values to screen (to test it) - however, for some reason only only the
first column rows are visble?

The first column is just text, the second is a TemplateColumn - could
this be a problem? If so, any ideas how to get around it?

Any help would be appreciated:

*****************************CODE BEHIND*****************************
private void dgCreationTermination_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
if((e.Item.ItemType == ListItemType.AlternatingItem) ||
(e.Item.ItemType == ListItemType.Item) )

Response.Write(e.Item.Cells[0].Text + "<br>");
Response.Write(e.Item.Cells[1].Text + "<br>");
Response.Write(e.Item.Cells[2].Text + "<br>");
************************************************** ******************
****************************PAGE CODE*******************************
<aspataGrid id="dgCreationTermination" runat="server"
CssClass="phonebookContent" Width="500px" AutoGenerateColumns="False">
<HeaderStyle CssClass="tableHeader"></HeaderStyle>
<asp:BoundColumn DataField="name" HeaderText="Staff
<asp:TemplateColumn HeaderText="Status">
<%#(formatStatusStaff((int)DataBinder.Eval(Contain er.DataItem,"status")))%>
<asp:HyperLinkColumn Text="view" DataNavigateUrlField="id"
DataNavigateUrlFormatString="viewStaffMember.aspx? id={0}"></asp:HyperLinkColumn>
************************************************** ************************
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Repeater: Items.count in ItemDataBound Event Josh Daws ASP .Net 2 09-11-2006 10:32 PM
GV Databound Event vs DG ItemDataBound Event GaryDean ASP .Net 1 08-18-2006 03:47 AM
A blank string instead of the actual number is returned when selecting from an Excell sheet. Joakim Olesen ASP General 3 09-25-2005 01:22 PM
ItemDataBound Event - How to access the previous record when this event is raised in DataGrid? NH ASP .Net Datagrid Control 2 12-17-2004 03:58 PM
ref dropdownlist in itemdatabound event? Tina ASP .Net 1 10-14-2003 06:33 PM