I am writing a site that uses strongly typed datasets.
The DBA who created the table made gave a column a value that represents a negative. The column is 'Do_Not_Estimate_Flag' where the column can contain 'T' or 'F'. I can't change the underlying table or the logic that fills it. What I want to do is to add a 'ESTIMATION_ALLOWED' column to the DataRow of my strongly typed DataSet. I have done this using the partial class that I can modify. (There is the autogenerated partial class and the non autogenerated partial class that I can safely modify.) The logic is in a property in the partial class. The trouble is that when the value is loaded ala
<%#DataBinder.Eval(Container.DataItem, "ESTIMATION_ALLOWED")%>
it goes straight to the underlying DataRow ignoring my property. How can I best achieve the desired result?
here is my code:
partial class MyFunkyDataTable {
private System.Data.DataColumn columnESTIMATION_ALLOWED;
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.Data.DataColumn ESTIMATION_ALLOWEDColumn
{
get
{
return columnESTIMATION_ALLOWED;
}
}
public override void EndInit()
{
//init class
columnESTIMATION_ALLOWED = new System.Data.DataColumn("ESTIMATION_ALLOWED", typeof(string), null, global::System.Data.MappingType.Element);
Columns.Add(columnESTIMATION_ALLOWED);
columnESTIMATION_ALLOWED.ReadOnly = true;
//init Vars
columnESTIMATION_ALLOWED = Columns["ESTIMATION_ALLOWED"];
base.EndInit();
}
}
partial class MyFunkyRow
{
public string ESTIMATION_ALLOWED
{
get
{
if(DO_NOT_EST_FLAG == "N")
{
return "Yes";
}
return "No";
}
}
}