zoukankan      html  css  js  c++  java
  • repeater嵌套RadioButtonList赋值

        <asp:Repeater ID="Repeater1" runat="server"
            onitemdatabound="Repeater1_ItemDataBound">
            <ItemTemplate>
                <%# Convert.ToDateTime(Eval("createtime")).ToShortDateString() %><br />
                <a href='<%#Eval("id") %>'></a><%--传参用--%>
                <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
                    <asp:ListItem Value="aa">aa&nbsp;&nbsp;</asp:ListItem>
                    <asp:ListItem Value="bb">bb&nbsp;&nbsp;</asp:ListItem>
                    <asp:ListItem Value="cc">cc&nbsp;&nbsp;</asp:ListItem>    
                </asp:RadioButtonList>
                备注<asp:TextBox ID="txtDetail" Width="500px" Height="50px" runat="server"></asp:TextBox><br /><br />
            </ItemTemplate>
        </asp:Repeater>

    cs代码页:

        protected void BindRepeater1()
        {
            kaoqinTab = kaoqinAda.GetData(**);
            Repeater1.DataSource = kaoqinTab;
            Repeater1.DataBind();
        }

        //绑定原考勤信息
        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                RadioButtonList rbl = e.Item.FindControl("RadioButtonList1") as RadioButtonList;
                TextBox txtDetail = e.Item.FindControl("txtDetail") as TextBox;
                DataRowView rowv = (DataRowView)e.Item.DataItem;
                string id = rowv["id"].ToString();
                kaoqinTab = kaoqinAda.GetDataById(Convert.ToInt32(id));
                if ("1" == kaoqinTab[0]["aaaa"].ToString())
                {
                    rbl.SelectedValue = "aa";
                }
                if ("1" == kaoqinTab[0]["bbbb"].ToString())
                {
                    rbl.SelectedValue = "bb";
                    txtDetail.Text = kaoqinTab[0]["bbDetail"].ToString();
                }
                if ("1" == kaoqinTab[0]["cccc"].ToString())
                {
                    rbl.SelectedValue = "cc";
                    txtDetail.Text = kaoqinTab[0]["ccDetail"].ToString();
                }
            }
        }

  • 相关阅读:
    ABAP实现屏幕自己刷新和跳转功能
    SAP 邮件发送
    MIRO做发票校验时实现替代功能的多种方式
    SAP资产折旧,消息编号AA687:在上一年结算之后您只能记帐到新的一年
    SAP 月结F.19与GR/IR
    ABAP字符串的加密与解密
    ABAP DEBUG
    NUMBER_GET_NEXT
    OO ALV 学习参考
    Crontab定时任务配置
  • 原文地址:https://www.cnblogs.com/yubufan/p/3422950.html
Copyright © 2011-2022 走看看