Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Put .Net Data List under control


Message #1 by "Quynh D. Nguyen" <quynhnguyen@b...> on Mon, 9 Apr 2001 18:14:51 +0700
Hi all,



To those who would be interested in the problem below



I would be grateful to those who could help me with the following problem:



I am utilizing DataList object to display data on my Web page.

Each item in the data list is displayed as plain text or a hyperlink

on the base of its status.



<template name="ItemTemplate">

	<tr>

		<%

		  string strStatus = DataBinder.Eval(Container.DataItem, "Status")

		  if (strStatus.CompareTo("change")){

		%>

		  <td valign=top><a href="edit-item.aspx"><%#

DataBinder.Eval(Container.DataItem, "ItemName")%></a></td>

		<% } else %>

   		  <td valign=top><%# DataBinder.Eval(Container.DataItem,

"ItemName")%></td>

	</tr>

</template>





However, perhaps the code 'DataBinder.Eval(Container.DataItem, "Status")'

is put into effect at the run-time so that

variable strStatus (which may be already put into effect) is assigned a null

rather than the value expected

and consequently, the above code become a dump.



Maybe I made a mistake somewhere or the code should be replaced with a

entirely new one ?



I was hoping to hear from you soon.



Thank you very much.



Quynh Nguyen




  Return to Index