0

所以我有一个通过中继器运行的列表控件。他们想添加标题或分隔列表中组的行,但我需要创建组。他们希望通过 SURVEY_TYPE 将组分开。有谁知道我如何添加带有控件和中继器的组?

<table>
    <asp:Repeater id="dlSurveyList" runat="server"  OnItemCommand="dlSurveyList_ItemCommand" OnItemDataBound="dlSurveyList_ItemDataBound">
        <HeaderTemplate>
            <TR id="SurveyListHeader" class="header">
                <td></td>
                <TD nowrap valign=bottom>
                    <asp:Label id="lblNameHdg" runat="server" Text="Courses"></asp:Label></TD>
                <TD nowrap align=center>
                    <asp:Label id="lblSurveyTypeHdg" runat="server" Text="Type"></asp:Label></TD>
                <TD nowrap align=center>
                    <asp:Label id="lblScoreHdg" runat="server" Text="Score (%)"></asp:Label></TD>
                <TD  nowrap align=center>
                    <asp:Label id="lblDateCompletedHdg" runat="server" Text="Date Passed"></asp:Label></TD>
            </TR>
        </HeaderTemplate>
        <ItemTemplate>              
                <td></td>
                <TD id="SurveyListField_Name" nowrap>
                    <asp:Label id="lblName" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"SURVEY_NAME")) %>'/></TD>
                <TD id="SurveyListField_Type" align=center>
                    <asp:Label id="lblSurveyType" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"SURVEY_TYPE"))%>'/></TD>
                <TD id="SurveyListField_Score" align=center>
                    <asp:Label id="lblScore" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"SCORE"))%>'/></TD>
                <TD id="SurveyListField_Date" align=center>
                    <asp:Label id="lblDateCompleted" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"DATE_COMPLETED"))%>'/></TD> 
            </TR>
        </ItemTemplate>

代码背后

        private string replaceFields(string msg)
        {
            msg = msg.Replace("[FIRST_NAME]", PortalSession.Current.LoggedInTravelAgent.FirstName);
            msg = msg.Replace("[LAST_NAME]", PortalSession.Current.LoggedInTravelAgent.LastName);
            msg = msg.Replace("[EMAIL_ADDRESS]", PortalSession.Current.LoggedInTravelAgent.EmailAddress.ToString());
            msg = msg.Replace("[SURVEY_NAME]", oSurvey.SurveyName);
            msg = msg.Replace("[SURVEY_TYPE]", oSurvey.SurveyType);
            msg = msg.Replace("[PASS_SCORE]", oSurvey.PassScore.ToString());
}

protected void dlSurveyList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
{
    if (e.CommandName == "select" )
    {
        redirectDetail(int.Parse(e.CommandArgument.ToString()));
    }
}

private void redirectDetail(int surveyId)
        {

            Survey oSurvey = Survey.GetById(surveyId);
            if (oSurvey == null)
                throw new ArgumentException("SurveyList", "Requested Survey Not Found. Survey Id:" + surveyId.ToString());

            Hashtable queueProfile = new Hashtable();
            queueProfile.Add(TravelUniversityUserControl.SURVEY_HASHKEY_ID, profileSurveyId);


            if (oSurvey.SurveyType == Survey.SurveyTypes.TravelUniversity.ToString() && surveyId != profileSurveyId)
            {

                if (PortalSession.Current.LoggedInTravelAgent.GetItuPassDate().IsNull())
                    TravelUniversitySession.Current.SurveyQueue.Enqueue(queueProfile);
            }

            Hashtable queueExam = new Hashtable();
            queueExam.Add(TravelUniversityUserControl.SURVEY_HASHKEY_ID, surveyId);

            if (this.Page.Request["score"] != null)
                queueExam.Add(TravelUniversityUserControl.SURVEY_HASHKEY_SCORE, this.Page.Request["score"]);

            TravelUniversitySession.Current.SurveyQueue.Enqueue(queueExam);

            if (!PortalSession.Current.LoggedInTravelAgent.GetItuPassDate().IsNull() || oSurvey.SurveyType == Survey.SurveyTypes.SpecialistCertification.ToString())
                TravelUniversitySession.Current.SurveyQueue.Enqueue(queueProfile);

            // redirect to detauil entry
            Response.Redirect(SurveyDetailEntryUrl);
        }
4

0 回答 0