Container.DataItem

שלומית74

New member
Container.DataItem

אני מעונינת לשים ערך ע"י Container.DataItem אך הבעיה היא ששלפתי ממספר טבלאות אז יכול להיות שברשומה מסוימת ערך זה לא יהיה והדף נתקע. מה ניתן לעשות שרק אם יש ערך שיציב אחרת שלא יעשה כלום. (כמות TRY ICATCH שאינם פעילים כמובן בקוד של HTML) אשמח אם תעזרו לי בהקדם!!
 

[eLad]

New member
התנייה ב-Late Binding

2 שיטות:
<%#((SomeObject)Container.DataItem).SomeProperty!=null ? ((SomeObject)Container.DataItem).SomeProperty.AnotherProperty : "SomeProperty is null"%> <%#ShowAnotherProperty((SomeObject)Container.DataItem)%> // code behind string ShowAnotherProperty(SomeObject o) { string anotherProperty=""; if (o.SomeProperty!=null) anotherProperty=o.SomeProperty.AnotherProperty; return anotherProperty; }​
 
למעלה