Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.1 KiB

  1. using System;
  2. using System.Data;
  3. using System.Web;
  4. using System.Web.UI.WebControls;
  5. using UDDI;
  6. namespace UDDI.Web
  7. {
  8. public class DataRowViewAccessor
  9. {
  10. public static int GetInt( DataGridItem item, string field )
  11. {
  12. DataRowView row = (DataRowView)item.DataItem;
  13. object data = row[ field ];
  14. if( null == data )
  15. return 0;
  16. return Convert.ToInt32( data );
  17. }
  18. public static string GetString( DataGridItem item, string field )
  19. {
  20. return GetString( item, field, false );
  21. }
  22. public static string GetString( DataGridItem item, string field, bool encode )
  23. {
  24. DataRowView row = (DataRowView)item.DataItem;
  25. object data = row[ field ];
  26. if( null == data )
  27. return null;
  28. else if( encode )
  29. return HttpUtility.HtmlEncode( data.ToString() );
  30. return data.ToString();
  31. }
  32. public static string GetStringOrNone( DataGridItem item, string field, bool encode )
  33. {
  34. string data = GetString( item, field, encode );
  35. if( Utility.StringEmpty( data ) )
  36. return Localization.GetString( "HEADING_NONE" );
  37. return data;
  38. }
  39. }
  40. }