asp.net新手 分享个刚刚做好的提交日期的控件

teemai 2009-09-22 02:11:28

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class 出生日期 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
DropDownList3.Visible = false;
DropDownList4.Visible = false;
DropDownList5.Visible = false;
DropDownList6.Visible = false;
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
string str = DropDownList1.SelectedValue;
string strMonth = DropDownList2.SelectedValue;
int year = int.Parse(str);
int month = int.Parse(strMonth);
if (month == 2)
{
if ((year % 4 == 0) && (year % 100 != 0) || year % 400 == 0)
{
DropDownList3.Visible = false;
DropDownList4.Visible = true;
DropDownList5.Visible = false;
DropDownList6.Visible = false;
}
else
{
DropDownList3.Visible = true;
DropDownList4.Visible = false;
DropDownList5.Visible = false;
DropDownList6.Visible = false;
}

}
else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
{
DropDownList3.Visible = false;
DropDownList4.Visible = false;
DropDownList5.Visible = true;
DropDownList6.Visible = false;
}
else if (month == 4 || month == 6 || month == 9 || month == 11)
{
DropDownList3.Visible = false;
DropDownList4.Visible = false;
DropDownList5.Visible = false;
DropDownList6.Visible = true;
}

}
}


DropDownList1是年份下拉

DropDownList2是月份下拉
DropDownList3 、DropDownList4、DropDownList5、DropDownList6是“日”下拉.
分别对应28天、29天、31天、30天。
在页面上的dropdownlist为什么autoPostBack=ture才能显示后面的“日”
...全文
72 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
teemai 2009-09-22
  • 打赏
  • 举报
回复
谢谢上面的回答
pvir 2009-09-22
  • 打赏
  • 举报
回复
如果非要后台回发 就在POSTBACK里获取password再赋回
llsen 2009-09-22
  • 打赏
  • 举报
回复
支持分享,不过楼主可以使用其他的一些js控件
my97就不错
wuyq11 2009-09-22
  • 打赏
  • 举报
回复
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList id="ddlyear" runat="server" Width="100%" AutoPostBack="True" ></asp:DropDownList>
<asp:DropDownList id="ddlmonth" runat="server" Width="100%" AutoPostBack="True">
<asp:DropDownList id="ddlday" runat="server" Width="100%"></asp:DropDownList>
</ContentTemplate> </asp:UpdatePanel>
</div>
huming_h 2009-09-22
  • 打赏
  • 举报
回复
放在updatepanle里面试试
teemai 2009-09-22
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 ivws_19 的回复:]
这个最好用js写
[/Quote]难道ASP.NET没有解决的方法吗?
huming_h 2009-09-22
  • 打赏
  • 举报
回复
用客户端控件,js操作
teemai 2009-09-22
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 ivws_19 的回复:]
不回发不行吧
[/Quote]恩。必须回发才可以。。怎么解决2楼的问题呢?
ivws_19 2009-09-22
  • 打赏
  • 举报
回复
这个最好用js写
ivws_19 2009-09-22
  • 打赏
  • 举报
回复
不回发不行吧
teemai 2009-09-22
  • 打赏
  • 举报
回复
如果在本页面前面有密码的注册的时候,改变下拉列表的值(就是回发了),填写好的密码就要重新填写。。怎么解决这样的问题?

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧