using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;using System.Text;
using System.IO;
using System.Data; public partial class DownloadItem_CmdExeItem : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ if (!IsPostBack)
{
Btn_Commit_BCF.Attributes.Add("OnClick", "javascript:return confirm('您确定提交吗?!');"); } }
protected void Btn_search_BCF_Click(object sender, EventArgs e)
{
InitData();
rpt_BCF_DataBinds();
TotalControls = Rpt_BCF.Items.Count;
for (int i = ; i < TotalControls; i++)
{
(Rpt_BCF.Items[i].FindControl("DropDownList1") as DropDownList).Enabled = false; }
}
protected void Rpt_BCF_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
(e.Item.FindControl("DropDownList1") as DropDownList).SelectedValue = DDL_Seach_City.SelectedItem.Value;
}
}
protected void Btn_addline_BCF_Click(object sender, EventArgs e)
{
DataTable dt = CopyFormData();
Random rd_year = new Random(), rd_month = new Random(), rd_date = new Random();
string datestr = rd_year.Next(, ).ToString("d4") + "/" + rd_month.Next(, ).ToString("d2") + "/" + rd_date.Next(, ).ToString("d2");
DataRow dr = dt.NewRow(); dr["HIDUKE"] = datestr;//DateTime.Now.Date.ToString();
dr["PV_CNT"] = -;
dr["CL_CNT"] = -;
dt.Rows.Add(dr); ViewState.Add("Data", dt); rpt_BCF_DataBinds();
for (int i = ; i < TotalControls; i++)
{
(Rpt_BCF.Items[i].FindControl("DropDownList1") as DropDownList).Enabled = false;
(Rpt_BCF.Items[i].FindControl("TextBox2") as TextBox).Enabled = false;
(Rpt_BCF.Items[i].FindControl("Btn_repcld") as Button).Enabled = false; } Btn_search_BCF.Enabled = false; }
private void Phl_table_addline(int num)
{
//for (int i = 0; i < num; i++)
//{
TableRow tr;
TableCell tc;
DropDownList ddl_citydynamic;
ListItem li;
Calendar cld;
TextBox Tbox_date, Tbox_pvno, Tbox_clno;
Button Btn_chosedate;
//if(IsPostBack)
//{ tr = new TableRow(); tc = new TableCell();
ddl_citydynamic = new DropDownList();
li = new ListItem("请xx", "-1");
ddl_citydynamic.Items.Add(li);
li = new ListItem("xxx", "");
ddl_citydynamic.Items.Add(li);
li = new ListItem("xxx", "");
ddl_citydynamic.Items.Add(li);
li = new ListItem("xxx", "");
ddl_citydynamic.Items.Add(li);
li = new ListItem("xxx", "");
ddl_citydynamic.Items.Add(li);
li = new ListItem("xxx", "");
ddl_citydynamic.Items.Add(li);
tc.Controls.Add(ddl_citydynamic);
tr.Cells.Add(tc); tc = new TableCell();
Tbox_date = new TextBox();
Btn_chosedate = new Button();
Btn_chosedate.Text = "▼";
tc.Controls.Add(Tbox_date);
tc.Controls.Add(Btn_chosedate);
tr.Cells.Add(tc); tc = new TableCell();
Tbox_pvno = new TextBox();
tc.Controls.Add(Tbox_pvno);
tr.Cells.Add(tc); tc = new TableCell();
Tbox_clno = new TextBox();
tc.Controls.Add(Tbox_clno);
tr.Cells.Add(tc); tc = new TableCell();
tr.Cells.Add(tc); //tbl_BCF.Rows.Add(tr);
//} }
protected int CurrentItem
{
get
{
return ViewState["CurrentItem"] == null ? : (int)(ViewState["CurrentItem"]);
}
set
{
ViewState["CurrentItem"] = value;
}
}
protected int TotalControls
{
get
{
return ViewState["TotControls"] == null ? : (int)(ViewState["TotControls"]);
}
set
{
ViewState["TotControls"] = value;
}
}
protected void rpt_BCF_DataBinds()
{
Rpt_BCF.DataSource = ViewState["Data"] as DataTable;
Rpt_BCF.DataBind();
}
protected DataTable CopyFormData()
{
DataTable dt = (ViewState["Data"] as DataTable).Clone(); foreach (RepeaterItem ri in Rpt_BCF.Items)
{
DataRow dr = dt.NewRow(); dr["xxx"] = (ri.FindControl("TextBox1") as TextBox).Text; dt.Rows.Add(dr);
} return dt;
} protected void InitData()
{
DateTime time = DateTime.Now; DataTable dt = new DataTable(); StringBuilder sb = new StringBuilder();
sb.Append("select xxx,xxx,xxx,xxx from 00 where "); if (DDL_Seach_City.SelectedItem.Text != "请选择")
sb.Append("xxx='" + DDL_Seach_City.SelectedItem.Text + "' and ");
if (TBox_Datebegin.Text.Length == && TBox_Dateend.Text.Length == )
sb.Append("xxx>='" + TBox_Datebegin.Text + "' and xxx<='" + TBox_Dateend.Text + "' and ");
else if (TBox_Datebegin.Text.Length == )
sb.Append("xxx='" + TBox_Datebegin.Text + "' and "); if (sb.Length <= )
{ }
else
{ string sqlstr = sb.ToString().Substring(, sb.Length - );
BCF bcfr = new BCF();
dt = bcfr.search_BCF(sqlstr);
} ViewState.Add("Data", dt);
}
protected void Btn_repcld_Click(object sender, EventArgs e)
{
RepeaterItem rptItem = ((Button)sender).Parent as RepeaterItem;
CurrentItem = rptItem.ItemIndex;
Div_Cld_common.Style["Display"] = "Block";
}
protected void Cld_common_SelectionChanged(object sender, EventArgs e)
{
(Rpt_BCF.Items[CurrentItem].FindControl("TextBox2") as TextBox).Text = Cld_common.SelectedDate.ToShortDateString();
Div_Cld_common.Style["Display"] = "None";
}
}

前台:

<div class="new_area_BCF">
<table style="width: 900px; text-align: center; align-self: center;">
<tr>
<td class="auto-style1">
<asp:Label ID="Label1" runat="server" Text="城市"></asp:Label><asp:DropDownList ID="DDL_Seach_City" runat="server">
<asp:ListItem Text="请选择" Value="-1"></asp:ListItem>
<asp:ListItem Text="xx" Value="1"></asp:ListItem>
<asp:ListItem Text="xx" Value="2"></asp:ListItem>
<asp:ListItem Text="xx" Value="3"></asp:ListItem>
<asp:ListItem Text="xx" Value="4"></asp:ListItem>
<asp:ListItem Text="xx" Value="5"></asp:ListItem>
</asp:DropDownList></td> <td style="text-align: right;" class="auto-style1">
<asp:Label ID="Label2" runat="server" Text="日期"></asp:Label>
<asp:TextBox ID="TBox_Datebegin" runat="server"></asp:TextBox>
<asp:Button ID="Btn_Datebegin" runat="server" Text="▼" OnClick="Btn_Datebegin_Click" />~
</td>
<td style="text-align: left;" class="auto-style1">
<asp:TextBox ID="TBox_Dateend" runat="server"></asp:TextBox>
<asp:Button ID="Btn_Dateend" runat="server" Text="▼" OnClick="Btn_Dateend_Click" />
</td>
<td class="auto-style1">
<asp:Button ID="Btn_search_BCF" runat="server" Text="检索" OnClick="Btn_search_BCF_Click" /><asp:Button ID="Btn_addline_BCF" OnClick="Btn_addline_BCF_Click" runat="server" Text="+" />
</td>
<td class="auto-style1"></td>
</tr>
<tr>
<td></td>
<td style="text-align: right;">
<asp:Calendar ID="Cld_begin" Visible="false" runat="server" OnSelectionChanged="Cld_begin_SelectionChanged"></asp:Calendar>
</td>
<td style="text-align: left;">
<asp:Calendar ID="Cld_end" Visible="false" runat="server" OnSelectionChanged="Cld_end_SelectionChanged"></asp:Calendar>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="5">
<asp:Repeater ID="Rpt_BCF" runat="server" OnItemDataBound="Rpt_BCF_ItemDataBound">
<HeaderTemplate>
<table class="Rpt_table_BCF">
<tr>
<th>xx</th>
<th>xx</th>
<th>xx</th>
<th>xx</th>
<th></th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr class="tr_white_BCF">
<td>
<asp:DropDownList ID="DropDownList1" runat="server" OnDataBinding="DropDownList1_DataBinding">
<asp:ListItem Text="请选择" Value="-1"></asp:ListItem>
<asp:ListItem Text="xxx" Value="1"></asp:ListItem>
<asp:ListItem Text="xxx" Value="2"></asp:ListItem>
<asp:ListItem Text="xxx" Value="3"></asp:ListItem>
<asp:ListItem Text="xxx" Value="4"></asp:ListItem>
<asp:ListItem Text="xxx" Value="5"></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox1" Text='<%#Eval("xxx")%>' Visible="false" runat="server"></asp:TextBox></td>
<td>
<asp:TextBox ID="TextBox2" Text='<%#Eval("xxx")%>' runat="server"></asp:TextBox><asp:Button ID="Btn_repcld" OnClick="Btn_repcld_Click" runat="server" Text="▼" /></td>
<td>
<asp:TextBox ID="TextBox3" Text='<%#Eval("xxx")%>' runat="server"></asp:TextBox></td>
<td>
<asp:TextBox ID="TextBox4" Text='<%#Eval("xxx")%>' runat="server"></asp:TextBox></td>
<td></td>
</tr>
</ItemTemplate>
<%--<AlternatingItemTemplate>
<tr class="tr_black_BCF">
<td><%#Eval("xxx")%></td>
<td><%#Eval("xxx")%></td>
<td>
<asp:TextBox ID="TextBox1" Text='<%#Eval("xxx")%>' runat="server"></asp:TextBox></td>
<td>
<asp:TextBox ID="TextBox2" Text='<%#Eval("xxx")%>' runat="server"></asp:TextBox></td>
<td>
</td>
</tr>
</AlternatingItemTemplate>--%>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<div id="Div_Cld_common" runat="server">
<asp:Calendar ID="Cld_common" runat="server" OnSelectionChanged="Cld_common_SelectionChanged"></asp:Calendar>
</div>
</td> </tr>
<tr>
<td colspan="5" style="text-align: right;">
<asp:Button ID="Btn_Commit_BCF" runat="server" Text="提交" OnClick="Btn_Commit_BCF_Click" /></td> </tr>
<tr><td><p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</p></td></tr>
</table>
</div>

ASP.NET Repeater 绑定 DropDownList Calendar 选择日期的更多相关文章

  1. Asp.Net MVC绑定DropDownList等控件

    测试环境:vs2013..Net4.5.mvc5 一.Asp.Net MVC绑定控件原理说明 以Html.TextBox为例 /// <param name="name"&g ...

  2. repeater绑定dropdownlist,jquery+ajax页面无刷新,修改dropdownlist默认值

    html代码: <td>                        <asp:HiddenField ID="hiddenchuli" Value='< ...

  3. ASP.NET - List<> 绑定 DropDownList

    代码: //声明泛型 List<category> inof = new List<category>();//二级分类 //声明类使用的对象类 public class ca ...

  4. asp.net 弹出式日历控件 选择日期 Calendar控件

    原文地址:asp.net 弹出式日历控件 选择日期 Calendar控件 作者:逸苡 html代码: <%@ Page Language="C#" CodeFile=&quo ...

  5. 【2017-05-19】WebForm复合控件、用DropDownList实现时间日期选择。

    自动提交的属性: AutoPostBack="True" 1.RadioButtonList     单选集合 -属性:RepeatDirection:Vertical (垂直排布 ...

  6. 《ASP.NET》数据绑定—DropDownList、ListBox

    DropDownList和ListBox实现两级联动功能.他们也能够将从后台数据库中搜选的出来的信息加以绑定.这里要实现的功能是在DropDownList中选择"省",然后让Lis ...

  7. "不能在 DropDownList 中选择多个项。"其解决办法及补充

    探讨C#.NET下DropDownList的一个有趣的bug及其解决办法 摘要: 本文就C#.Net 环境下Web开发中经常使用的DropDownList控件的SelectedIndex属性进行了详细 ...

  8. asp.net mvc中DropDownList

    asp.net mvc中DropDownList的使用. 下拉列表框 以分为两个部分组成:下拉列表和默认选项 DropDownList扩展方法的各个重载版本基本上都会传递到这个方法上:   publi ...

  9. 不能在DropDownList 中选择多个项

    在绑定DropDownList时如果出现多次绑定,会出错以下错误: “不能在DropDownList 中选择多个项” 经了解,只需要在选中值是清空选择即可:xxDropDownList.ClearSe ...

随机推荐

  1. IOS开发--支付宝支付

    前言:继上次<IOS开发--微信支付>以来,一直没有太多时间,更新总结详细支付这样的长篇大论,很抱歉.今天,推出支付宝支付的详细流程. 1.开始下载和查看支付宝支付的Demo. 我们直接进 ...

  2. 使用sencha cmd 一键生成你的应用程序代码

    一键生成你的应用程序代码: ------------------------------------------------------------ 我们的出发点就是使用命令来产生一个应用程序,执行以 ...

  3. .NET文档生成工具ADB使用图文教程

    .NETv3.0 可再发行组件包 类型:编程辅助大小:2.7M语言:中文 评分:1.8 标签: 立即下载 ADB2.3使用指南 ADB2.3使用方法如下图所示: (1)主界面: (2)批量选择: 4. ...

  4. 华为S5700S-52P-LI-AC千兆网管交换机web登录界面配置

    研究一下午,包装附的说明书根本就是错误的,通过技术售后和官方的文档结合,总算可以登录交换机的web管理界面. 首先需要使用通讯控制线缆(包装中附)连接电脑和交换机,一头接交换机的Console口,一头 ...

  5. Java中静态类型检查是如何进行的

    以下内容来自维基百科,关于静态类型检查和动态类型检查的解释: 静态类型检查:基于程序的源代码来验证类型安全的过程: 动态类型检查:在程序运行期间验证类型安全的过程: Java使用静态类型检查在编译期间 ...

  6. EF框架学习手记

    转载: [ASP.NET MVC]: - EF框架学习手记 1.EF(Entity Framework)实体框架EF是ADO.NET中的一组支持开发面向数据的软件应用程序的技术,是微软的一个ORM框架 ...

  7. linux下svn命令使用大全(share)

     转自:http://blog.chinaunix.net/uid-22566367-id-1965771.html 1.将文件checkout到本地目录 svn checkout path(path ...

  8. sql语句 在字段前面加0

    目前数字如下: 1 2 3 10 想变成长度为5位,如果不够,前面补0, 写法如下 select right('00000'+ltrim(你的字段),5) 结果: 00001 00002 00003 ...

  9. SQLServer查询锁表

    查看被锁表: select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName from sys. ...

  10. openstack-kilo--issue(九) heat stacks topology中图形无法正常显示

    ======声明======= 欢迎转载:转载请注明出处 http://www.cnblogs.com/horizonli/p/6186581.html ==========环境=========== ...