0
私は、データソースコントロールとListViewコントロールを持っているとのaspxファイル内のパラメータとして評価を()を使用することができますどのように私はListViewの
データソース持って
「StudentID、StudentName、誕生日、ガンダー(M、F) >ではない誕生日、ガンダー(オス - 、Course_IDに年齢 "
は、私は私のListView
(に表示させたいです" 、女性) - > Fまたは」M、そして CourseNameない - >ないcourseID :))この
public string CalculateAge(DateTime birthDate) { // cache the current time DateTime now = DateTime.Today; // today is fine, don't need the timestamp from now // get the difference in years int years = now.Year - birthDate.Year; // subtract another year if we're before the // birth day in the current year if (now.Month < birthDate.Month || (now.Month == birthDate.Month && now.Day < birthDate.Day)) --years; return years.ToString(CultureInfo.InvariantCulture); }
のように、この作業を行うため
は、私はいくつかのメソッドを書くが、私はどのように使用することができます私のListView
にと私のaspxファイルのこのメソッド?注:別の名前空間にこのメソッドを書きました
おかげでジェームズが、何についての私のメソッドが異なる名前空間にある場合 – tito11
その名前空間はページにアクセスできますか?コードビハインドからアクセスできますか? –
はい私はコードビヘイビアからアクセスすることができます。今すぐ試してみてください – tito11