asp.net repeater_asp.net core

asp.net repeater_asp.net coreasp.net在Repeater嵌套的Repeater中使用复选框来自森大科技官方博客http://www.cnsendblog.com/index.php/?p=109.aspx文件中:<%–顶层Repeater–%><asp:RepeaterID=“rptChannel”runat=“server”><%#Eval(“ChannelName”…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

asp.net在Repeater嵌套的Repeater中使用复选框
来自森大科技官方博客 http://www.cnsendblog.com/index.php/?p=109
.aspx文件中:
<%–顶层Repeater–%>
<asp:Repeater ID=“rptChannel” runat=“server”>

<%# Eval(“ChannelName”)%>
<%–嵌套的Repeater,指定使用后台创建的Releation来获取数据源–%>
<asp:Repeater ID=“rptClassify” DataSource=’<%# Eval(“myrelation”) %>’ runat=“server”>

<asp:Label ID=“lbl_FlagName” runat=“server” Text=’<%# Eval(“FlagName”)%>’></asp:Label>

</asp:Repeater >
<%–end 嵌套的Repeater,指定使用后台创建的Releation来获取数据源–%>

</asp:Repeater >
<%–end 顶层Repeater–%>
.aspx.cs文件中:
#region Repeater嵌套的Repeater中使用复选框
//★Repeater嵌套-经典运用★
string sqlstr1, sqlstr2;
sqlstr1 = “select distinct a.ChannelID,b.ChannelName from IE_FlagGroup a left join IE_Channel b on a.ChannelID=b.ChannelID where a.isClose=0 order by a.ChannelID asc”;
sqlstr2 = “select * from IE_FlagGroup where isClose=0 order by FlagID asc”;
DataSet dsChannel = DBFun.dataSetTwo(sqlstr1, “Channel”, sqlstr2, “Classify”, “myrelation”);
dsChannel.Relations.Add(“myrelation”, dsChannel.Tables[“Channel”].Columns[“ChannelID”], dsChannel.Tables[“Classify”].Columns[“ChannelID”], false);
this.rptChannel.DataSource = dsChannel.Tables[“Channel”];//绑定顶层Repeater(注意:只要绑定顶层就好,嵌套层不能绑定)
this.rptChannel.DataBind();
#endregion
//……略相关数据库操作代码
#region 设置Repeater嵌套的Repeater中相应的复选框为选中状态
string[] selTeamflag = drw[“Teamflag”].ToString().Split(’,’);
HtmlInputCheckBox checkBox;
Repeater rpClass;
for (int i = 0; i < this.rptChannel.Items.Count; i++)
{

rpClass = (Repeater)this.rptChannel.Items[i].FindControl(“rptClassify”);
for (int j = 0; j < rpClass.Items.Count; j++)
{

checkBox = (HtmlInputCheckBox)rpClass.Items[j].FindControl(“chk_FlagID”);
if (selTeamflag.Contains(checkBox.Value))
checkBox.Checked = true;
}
}
#endregion
#region 获取Repeater嵌套的Repeater中的复选框所选择的值的组合,以”,”隔开
string str_Teamflag = “”;
HtmlInputCheckBox checkBox;
Repeater rpClass;
for (int i = 0; i < this.rptChannel.Items.Count; i++)
{

rpClass = (Repeater)this.rptChannel.Items[i].FindControl(“rptClassify”);
for (int j = 0; j < rpClass.Items.Count; j++)
{

checkBox = (HtmlInputCheckBox)rpClass.Items[j].FindControl(“chk_FlagID”);
if (checkBox.Checked)
str_Teamflag += checkBox.Value + “,”;
}
}
if (str_Teamflag != “”)
{

//去除最后一个字符
//str_Teamflag = str_Teamflag.Substring(0, str_Teamflag.Length – 1);
str_Teamflag = str_Teamflag.Remove(str_Teamflag.Length – 1);
}
#endregion

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/182501.html原文链接:https://javaforall.net

(0)
上一篇 2022年10月13日 上午11:00
下一篇 2022年10月13日 上午11:00


相关推荐

  • Docker 上安装、启动 MySQL (图解)「建议收藏」

    Docker 上安装、启动 MySQL (图解)「建议收藏」1.在docker仓库中搜索mysql的镜像:dockersearchmysql下载镜像:dockerpullmysql2.查看本地镜像:dockerimages-aa.参数-a表示所有b.启动mysql容器,并进入shell命令交互界面:dockerrun-itmy…

    2022年10月4日
    5
  • React图片懒加载

    React图片懒加载话不多说了,创建一个LazyLoad.js的React组件,然后将下面的代码复制过去:importReactfrom’react’//import’./lazyload.css’//thresholdconstthreshold=[0.01]classLazyLoadextendsReact.Component{construc…

    2022年4月6日
    37
  • 方法的改造

    方法的改造

    2022年2月23日
    56
  • 金融公司2014年度工作总结与2015年度工作计划

    金融公司2014年度工作总结与2015年度工作计划正文:一、 员工个人对全年重点工作、核心绩效指标进行罗列。自6月入职以来参加730、825、917、1015、1126的版本测试,测试的各个功能点,前台涉及的测试功能点包括广发、汇添富的申购、赎回,基金双持,票据购买、冻结收银台、理财管理、后台功能点包括用户开户信息查询等各种报表处理、申购异常处理、赎回异常处理、强制赎回等异常处理、定时任务管理、日常管理包括基础配置管理、基金管理中的…

    2022年7月26日
    9
  • Spark初识-什么是Spark

    Spark初识-什么是SparkSpark 是一个基于内存的开源计算框架 于 2009 年诞生于加州大学伯克利分校 AMPLab AMP Algorithms Machines People 它最初属于伯克利大学的研究性项目 后来在 2010 年正式开源 并于 2013 年成为了 Apache 基金项目 到 2014 年便成为 Apache 基金的顶级项目 该项目整个发展历程刚过六年时间 但其发展速度非常惊人 正由于 Spark 来自于大学 其整个发展过程都充满了学术研究的标记 是学术带动 Spark 核心架构的发展 如弹性分布式数据集 RDD resi

    2026年3月17日
    2
  • nc隧道技术

    nc隧道技术使用场景 客户端 嵌入式 Linux 网关服务器 阿里云服务器 1 正向 shell 客户端连接服务器 获取服务器的 shell 服务器 root VM 0 14 centos mkfifo tmp fifo root VM 0 14 centos cat tmp fifo bin bash i2 gt amp 1 nc l10000 gt tmp

    2026年3月17日
    1

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号