62,243
社区成员




<%@ Control Language="C#" ClassName="spc" %>
<%@ Import Namespace="admin" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>
<script runat="server">
private SqlConnection conn;
private string cmdtext;
private DataSet dataset;
protected void Page_Load(object sender, EventArgs e)
{
string connstr = new conn().constr();
dataset = new DataSet();
//cmdtext = "select * from TB_cptype where ID<>28 order by ID";
conn = new SqlConnection(connstr);
conn.Open();
sm1.RegisterAsyncPostBackControl(Button1);
//new SqlDataAdapter(cmdtext,this.conn).Fill(dataset,"cp");
//Repeater1.DataSource=dataset.Tables["cp"].DefaultView;
//Repeater1.DataBind();
cmdtext = "select pn,ID from TB_products order by ID";
new SqlDataAdapter(cmdtext, conn).Fill(dataset, "pn");
rbl_PN.DataSource = dataset.Tables["pn"].DefaultView;
rbl_PN.DataTextField = "pn";
rbl_PN.DataValueField = "ID";
rbl_PN.DataBind();
}
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
TextBox txtcp = (TextBox)e.Item.FindControl("txt1");
Label lbltypename=(Label)e.Item.FindControl("typename");
//Mytools.print(txtPN.Text);
//if (txtcp == null)
//{
// txtcp = (TextBox)e.Item.FindControl("txt" + lbltypename.Text);
// tmp = "txtcp=null";
//}
//txtcp.ID = "txt" + lbltypename.Text;
txtcp.Text = txtcp.Text + DateTime.Now.ToLocalTime().ToString();
}
protected void calDay_SelectionChanged(object sender, EventArgs e)
{
pce1.Commit(calDay.SelectedDate.ToShortDateString());
// Repeater1.DataBind();
// up3.Update();
}
protected void txtsearch_TextChanged(object sender, EventArgs e)
{
cmdtext = "select pn,ID from TB_products where pn like '%"+txtsearch.Text+"%' order by ID";
new SqlDataAdapter(cmdtext, conn).Fill(dataset, "pn1");
rbl_PN.DataSource = dataset.Tables["pn1"].DefaultView;
rbl_PN.DataTextField = "pn";
rbl_PN.DataValueField = "ID";
rbl_PN.DataBind();
}
protected void rbl_PN_SelectedIndexChanged(object sender, EventArgs e)
{
pce2.Commit(rbl_PN.SelectedItem.Text);
// Repeater1.DataBind();
//up3.Update();
rbl_PN.ClearSelection();
}
protected void Repeater1_Load(object sender, EventArgs e)
{
Repeater rep = (Repeater)sender;
for (int j = 0; j <= rep.Items.Count - 1; j++)
{
TextBox txtcp = (TextBox)rep.Items[j].FindControl("txt1");
Label lbltypename = (Label)rep.Items[j].FindControl("typename");
txtcp.Text =txtcp.Text+ DateTime.Now.ToShortTimeString();
}
//Mytools.print(txtPN.Text);
//if (txtcp == null)
//{
// txtcp = (TextBox)e.Item.FindControl("txt" + lbltypename.Text);
// tmp = "txtcp=null";
//}
//txtcp.ID = "txt" + lbltypename.Text;
}
protected void Button1_Click(object sender, EventArgs e)
{
Repeater1.DataBind();
//Repeater rep = (Repeater)sender;
//for (int j = 0; j <= Repeater1.Items.Count - 1; j++)
//{
// TextBox txtcp = (TextBox)Repeater1.Items[j].FindControl("txt1");
// Label lbltypename = (Label)Repeater1.Items[j].FindControl("typename");
// txtcp.Text = txtcp.Text + DateTime.Now.ToShortTimeString();
//}
// up3.Update();
}
</script>
<asp:ScriptManager ID="sm1" EnablePartialRendering="true" runat="server"></asp:ScriptManager>
<asp:Panel ID="p2_PN" Width="150px" BackColor="ActiveBorder" BorderColor="GhostWhite" BorderStyle="Solid" runat="server">
<asp:UpdatePanel ID="up2" ChildrenAsTriggers="true" UpdateMode="Conditional" runat="server" >
<ContentTemplate>
搜索:<asp:TextBox ID="txtsearch" AutoPostBack="true" Width="80px" runat="server" OnTextChanged="txtsearch_TextChanged"></asp:TextBox>
<asp:RadioButtonList ID="rbl_PN" AutoPostBack="true" runat="server" OnSelectedIndexChanged="rbl_PN_SelectedIndexChanged">
</asp:RadioButtonList>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<asp:Panel ID="p1" runat="server">
<asp:UpdatePanel ID="up1" ChildrenAsTriggers="true" runat="server">
<ContentTemplate>
<asp:Calendar ID="calDay" runat="server" OnSelectionChanged="calDay_SelectionChanged" BackColor="#FFFFCC" BorderColor="#FFCC66" BorderWidth="1px" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="#663399" Height="200px" ShowGridLines="True" Width="220px">
<SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
<SelectorStyle BackColor="#FFCC66" />
<TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
<OtherMonthDayStyle ForeColor="#CC9966" />
<NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
<DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" />
<TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt" ForeColor="#FFFFCC" />
</asp:Calendar>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<cc1:PopupControlExtender ID="pce1" PopupControlID="p1" TargetControlID="txtCalendar" Position="Right" CommitProperty="value" CommitScript="e.value" runat="server" >
</cc1:PopupControlExtender>
<cc1:PopupControlExtender ID="pce2" PopupControlID="p2_PN" TargetControlID="txtPN" Position="Right" CommitProperty="value" CommitScript="e.value" runat="server" >
</cc1:PopupControlExtender>
<table width="80%" cellpadding=0 cellspacing=0>
<tr>
<td>请选择产品</td>
<td>
<asp:TextBox ID="txtPN" runat="server"></asp:TextBox>
</td>
</tr>
<tr style="background-color:LightGray">
<td>请选择日期</td>
<td><asp:TextBox ID="txtCalendar" runat="server"></asp:TextBox></td>
<asp:Label ID="lblmsg" runat="server"></asp:Label></tr>
<asp:UpdatePanel ID="up3" runat="server" >
<ContentTemplate>
<asp:Repeater ID="Repeater1" DataSourceID="sds_Input" runat="server" OnItemDataBound="Repeater1_ItemDataBound" OnLoad="Repeater1_Load">
<AlternatingItemTemplate>
<tr style="background-color:LightGray">
<td><%#Eval("descript")%><asp:Label ID="typename" runat="server" Text='<%#Eval("typename") %>' Visible="false"></asp:Label></td>
<td><asp:TextBox ID="txt1" runat="server"></asp:TextBox></td>
</tr>
</AlternatingItemTemplate>
<ItemTemplate>
<tr>
<td><%#Eval("descript")%></td>
<td><asp:TextBox ID="txt1" runat="server"></asp:TextBox><asp:Label ID="typename" runat="server" Text='<%#Eval("typename") %>' Visible="false"></asp:Label></td>
</tr>
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="sds_Input" runat="server" SelectCommand="select * from TB_cptype where ID<>28" ConnectionString="<%$ ConnectionStrings:TwebConnectionString %>" ProviderName="<%$ ConnectionStrings:TwebConnectionString.ProviderName %>" ></asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</table>
<asp:But