0

我的中继器 我想要做的是我想将我得到的响应绑定到转发器控件。在响应中有名称、问题、免责声明等字段。我想将这些字段数据绑定到转发器中的控件。

我正在做的是:

 protected void rptCustInfo_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Header)
            {
                Label headertext = new Label();
                headertext = e.Item.FindControl("lblHeaderText") as Label;
                //headertext.Text = custInfo.CustomizationName;
                Label questiontext = new Label();
                questiontext = e.Item.FindControl("lblQuestionText") as Label;
                //questiontext.Text = custInfo.QuestionText;
                //headertext.Text = "";
                //headertext.Text = 
            }
        }

这就是我的响应的创建方式:

public List<CustomizationListCustomization> GetPackageCustomization(string PackageCode)
    {
        List<CustomizationListCustomization> arrCusts = SiteConfiguration.customizationList.Customization.Where(cust => cust.PackageList.Contains(PackageCode)).ToList();

        return arrCusts;
    }

但我找不到任何结果。有什么建议我怎么能做到这一点? 我的对象响应

4

1 回答 1

0
 protected void rptCustInfo_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        CustomizationListCustomization custItem = e.Item.DataItem as CustomizationListCustomization;
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            if (custItem != null)
            {
                Label headertext = e.Item.FindControl("lblHeaderText") as Label;
                Label questiontext = e.Item.FindControl("lblQuestionText") as Label;
                Label lblFooter = e.Item.FindControl("lblDisclaimerText") as Label;
                RadioButtonList rdbOptions = e.Item.FindControl("rdbtnOption") as RadioButtonList;

                headertext.Text = custItem.CustomizationName;
                questiontext.Text = custItem.QuestionText;
                lblFooter.Text = custItem.CustomizationDisclaimer;
                ListItem radiolistitem = null;

                if (rdbOptions != null)
                {
                    foreach (var ip in custItem.OptionList)
                    {
                        radiolistitem = new ListItem();
                        radiolistitem.Text = ip.OptionText + " " + ip.OptionPrice.ToString("c");
                        radiolistitem.Value = ip.OptionText;
                        rdbOptions.Items.Add(radiolistitem);
                    }
                }

                //radiolistitem.Attributes.AddAttributes(ip.OptionXML) = custItem.OptionList.Where(p => p.OptionXML != null);

            }
        }
    }
于 2013-09-19T14:39:06.550 回答