DataGrid Template Column Question

Results 1 to 2 of 2

Thread: DataGrid Template Column Question

  1. #1
    Join Date
    Dec 1969

    Default DataGrid Template Column Question

    I have a template column in my editable datagrid that uses an &#060;asp:Label&#062; control to diplay the text when the datagrid is bound and a Textbox control to edit the cell when the edit event fires. <BR><BR>I am using a button click event to render the grid - after a user enters a date range for the records to display - all fine there... <BR><BR>When I try to programatically call the text of the label though - nothing apears. <BR><BR>I am putting Response.Write(dataGridItem.Cells[4].Text); in the button event (before the other code))- but the text does not write to the screen ( I am needing this text value to perform some additional calculations later). <BR><BR>How is it that I can see the text IN the grid but not outside the grid? If I Response.Write the other cells they show up - just not this one (the other cells are just bound columns - not template cols)? <BR><BR>Is there other some way to call the text of the label control that resides inside the template column of a datagrid besides dataGridItem.Cells[4].Text that will get me the text value? <BR><BR>I knw there is something I am missing - but not sure what? <BR><BR>Thanks <BR><BR>Chuke

  2. #2
    Join Date
    Dec 1969

    Default prob is

    I am putting Response.Write(dataGridItem.Cells[4].Text); <BR><BR>that there is no "Text" in the Cell, but there is an &#060;asp:Label&#062; that has text...<BR><BR>so you have to say:<BR><BR>CType(dataGridItem.Cells[4].FindControl("ID_of_Label"),Label).Text<BR><BR><BR >also as a side note... Response.Write is a thing of the past, check out Tracing when you have time :)<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts