在需要调用日期选择的页面(WebForm1.aspx)放置两个TEXTBOX与BUTTON以选择开始时间与结束时间,并在html代码的 </body>之前加入如下javascript语句: <script language="javascript">
function openModeBegin()
{
var returnValue=window.showModalDialog("CalendarForm2.aspx",Form1.TextBoxBeginDate.value);
Form1.TextBoxBeginDate.value=returnValue;
}
</script> 在本页面WebForm1.aspx.cs代码部分页面加载Page_Load事件内加入如下语句将定义的javascript行为赋予Button: ButtonBeginDate.Attributes.Add("onclick", "openModeBegin()");
ButtonBeginDate为某一按钮的ID,奇怪的问题就在这时发生了,我运行页面点击 ButtonBeginDate,
并没有执行openModeBegin(),但是如果我把 ButtonBeginDate换成textbox,即Page_Load事件内加入如下语句
TextBoxBeginDate.Attributes.Add("onclick", "openModeBegin()");
点击TextBoxBeginDate就可以执行openModeBegin()");
请问大侠这是什么原因阿,是不是因为button控件已经有onclick事件了。
请高人指点,都卡在这了,急急急啊。
function openModeBegin()
{
var returnValue=window.showModalDialog("CalendarForm2.aspx",Form1.TextBoxBeginDate.value);
Form1.TextBoxBeginDate.value=returnValue;
}
</script> 在本页面WebForm1.aspx.cs代码部分页面加载Page_Load事件内加入如下语句将定义的javascript行为赋予Button: ButtonBeginDate.Attributes.Add("onclick", "openModeBegin()");
ButtonBeginDate为某一按钮的ID,奇怪的问题就在这时发生了,我运行页面点击 ButtonBeginDate,
并没有执行openModeBegin(),但是如果我把 ButtonBeginDate换成textbox,即Page_Load事件内加入如下语句
TextBoxBeginDate.Attributes.Add("onclick", "openModeBegin()");
点击TextBoxBeginDate就可以执行openModeBegin()");
请问大侠这是什么原因阿,是不是因为button控件已经有onclick事件了。
请高人指点,都卡在这了,急急急啊。
解决方案 »
- asp.net网站不能运行
- dataTable添加行问题
- 在VS2008里,是不是不用PAGELAYOUT=GRIDLAROUT了
- 如何判断用户选择的treeview节点是根节点还是子节点
- 还是页面打印的问题
- DataList数据处理的问题
- 小弟有几个简单的问题请教!
- 怎样返回数据库的所有表名,存储过程。一个表的列名,类型,大小,
- 关于输入数据的散列 和散列后的恢复 救救我吧 谢谢大家了~~~~~~~~~~~
- 数据导出到excel表 使用activeX控件问题,请高手解答!!!
- 把重定向语句放在弹出对话框之后,弹出对话框就不起作用了?
- 请问怎样配置我的IIS服务器才能使我的网站被局域网里的计算机访问到呢?
function openModeBegin()
{
var returnValue=window.showModalDialog("WebForm6.aspx",Form1.TextBoxBeginDate.value);
Form1.TextBoxBeginDate.value=returnValue;
}
</script>
private void Page_Load(object sender, System.EventArgs e)
{
ButtonBeginDate.Attributes.Add("onclick", "openModeBegin()");
TextBoxBeginDate.Attributes.Add("onclick", "openModeBegin()");
}代码没问题,经测试两个都执行