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();
                }
            }
        }

  • 相关阅读:
    jQuery 请指出'$'和'$.fn'的区别?或者说出'$.fn'的用途。
    ie8及其以下浏览器的document.getElementsByClassName兼容性问题
    document.all的详细解释(document.all基本上所有浏览器可用!)
    CSS浮动属性Float介绍
    JCarouselLite--帮助文档
    css定位之z-index问题分析
    Android手机同步电脑端google chrome书签
    AWK原理及命令和文件输入
    Sed命令
    Shell正则表达式
  • 原文地址:https://www.cnblogs.com/yubufan/p/3422950.html
Copyright © 2011-2022 走看看