0
리피터 컨트롤이 일반 List<>
에 바인딩되어 있습니다.리피터 컨트롤 : 개별 항목 이동
중계기의 항목은 모두 자체 <div>
태그입니다. 따라서 모든 항목에 대한 표준 자리 표시 자뿐만 아니라 훌륭한 블록 시각 효과를 제공합니다.
사용자 지정 정렬을 통해 결과를 자체 표준으로 정렬 할 수 있었지만 지금은 표준이 아닌 무언가가 필요합니다.
<div>
블록에서 선택한 항목을 가져 와서 중계기 항목 목록의 하단 또는 상단으로 이동할 수 있어야합니다.
내가 할 수있는 방법이 있습니까? 바인딩하거나 중계기의 repeater_ItemDataBound()
메소드를 사용 하시겠습니까?
코드가 상당히 길다. 그래서 나는 '알 필요'라고 생각하는 것을 올릴 것이다.
일반 목록
을 채우기 while (rdr.Read())
{
challenge.Add(new ChallengeList
{
GameName = rdr["gameName"].ToString(),
CreatorName = rdr["creatorName"].ToString(),
MediatorName = rdr["mediatorName"].ToString(),
ChallengeID = rdr["challengeId"].ToString(),
ChallengeAccepted = rdr["accepted"].ToString(),
MatchDate = DateTime.Parse(rdr["matchDate"].ToString()).ToString("dd MMMM yyyy hh:mm")
});
}
- 같은 방법 - 데이터를 정렬 한 후
/// <summary>
/// Class ChallengeList
/// With sorting
/// </summary>
public class ChallengeList
{
/// <summary>
/// Compares the name of the game.
/// </summary>
/// <param name="game1">The game1.</param>
/// <param name="game2">The game2.</param>
/// <returns>System.Int32.</returns>
public static int CompareGameName(ChallengeList game1, ChallengeList game2)
{
return String.Compare(game1.GameName, game2.GameName, StringComparison.Ordinal);
}
/// <summary>
/// Compares the status.
/// </summary>
/// <param name="status1">The status1.</param>
/// <param name="status2">The status2.</param>
/// <returns>System.Int32.</returns>
public static int CompareStatus(ChallengeList status1, ChallengeList status2)
{
return string.Compare(status1.ChallengeAccepted, status2.ChallengeAccepted, StringComparison.Ordinal);
}
/// <summary>
/// Compares the date.
/// </summary>
/// <param name="date1">The date1.</param>
/// <param name="date2">The date2.</param>
/// <returns>System.Int32.</returns>
public static int CompareDate(ChallengeList date1, ChallengeList date2)
{
return string.Compare(date1.MatchDate, date2.MatchDate, StringComparison.Ordinal);
}
/// <summary>
/// Compares the date reverse.
/// </summary>
/// <param name="date2">The date2.</param>
/// <param name="date1">The date1.</param>
/// <returns>System.Int32.</returns>
public static int CompareDateReverse(ChallengeList date2, ChallengeList date1)
{
return string.Compare(date1.MatchDate, date2.MatchDate, StringComparison.Ordinal);
}
/// <summary>
/// Gets or sets the name of the game.
/// </summary>
/// <value>The name of the game.</value>
public string GameName { get; set; }
/// <summary>
/// Gets or sets the name of the creator.
/// </summary>
/// <value>The name of the creator.</value>
public string CreatorName { get; set; }
/// <summary>
/// Gets or sets the name of the mediator.
/// </summary>
/// <value>The name of the mediator.</value>
public string MediatorName { get; set; }
/// <summary>
/// Gets or sets the challenge ID.
/// </summary>
/// <value>The challenge ID.</value>
public string ChallengeID { get; set; }
/// <summary>
/// Gets or sets the challenge accepted.
/// </summary>
/// <value>The challenge accepted.</value>
public string ChallengeAccepted { get; set; }
/// <summary>
/// Gets or sets the match date.
/// </summary>
/// <value>The match date.</value>
public string MatchDate { get; set; }
}
(정렬)와 함께
switch (sort)
{
case "name":
Comparison<ChallengeList> name = ChallengeList.CompareGameName;
challenge.Sort(name);
break;
case "date":
Comparison<ChallengeList> date = ChallengeList.CompareDate;
challenge.Sort(date);
break;
case "status":
Comparison<ChallengeList> status = ChallengeList.CompareStatus;
challenge.Sort(status);
break;
}
rptChallenges.DataSource = challenge;
rptChallenges.DataBind();
일반 목록 클래스를 바인딩내 질문의 617,451,515,
실제 애플리케이션에 'stickied'경기가있을 경우 -에 관계없이 날짜, 상태 또는 이름의 일치의 상단에 표시되어야합니다