标题:[求助]使用母版页出现的问题
只看楼主
ice_beiyu
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2007-7-10
 问题点数:0 回复次数:5 
[求助]使用母版页出现的问题

<%@ Page Language="C#" MasterPageFile="xyggl.master" AutoEventWireup="true" CodeFile="zywh.aspx.cs" Inherits="zywh" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" ID="Content1" Runat="Server">
<script language="JavaScript">

function Button7_onclick()
{
var str=showModalDialog("xuanzerenyuan/xuanzerenyuan.asp?iniurl=wenjianzhonglei_guanliyuan.asp?id="+Content.id.value,"","center:yes;status:yes;scroll:no;help:no;dialogWidth:500px;dialogHeight:290px");

if(str!=null)
{
var mingcheng,bianhao,string;
string=str.split("$");
mingcheng=string[0];
bianhao=string[1];
if(bianhao.length>7)
{
window.alert("只能选择一个!");
return false;
}
window.document.Content1.fuzeren.value=mingcheng;
window.document.Content1.gonghao.value=bianhao;
}
}

</script>


<asp:Label ID="Label1" runat="server" Text="设置专业培养负责人:" Width="176px" Font-Underline="True" ForeColor="Red"></asp:Label><br />
<asp:Label ID="Label2" runat="server" Text="选择专业" Width="68px"></asp:Label>
&nbsp;<asp:DropDownList ID="DropDownList1" runat="server"
DataTextField="dic_zy" DataValueField="dic_zy" >
</asp:DropDownList>
<asp:Label ID="Label3" runat="server" Text="选择负责人" Width="86px"></asp:Label>
<asp:TextBox ID="fuzeren" runat="server" Width="63px"></asp:TextBox>&nbsp;<input id="Button7" type="button" value="选择" language="javascript" runat =server onclick="return Button7_onclick()" />
<asp:Label ID="Label4" runat="server" Text="负责人工号" Width="87px"></asp:Label>
<asp:TextBox ID="gonghao" runat="server" Width="70px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="确定" OnClick="Button1_Click" />
<br />
<asp:Label ID="Label6" runat="server" Text="专业维护" Width="74px" Font-Underline="True" ForeColor="Red"></asp:Label><br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" AllowPaging="True" PageSize="8" onPageIndexChanging="GridView1_PageIndexChanging"
ForeColor="#333333" GridLines="None" OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing"
OnRowUpdating="GridView1_RowUpdating" OnRowCancelingEdit="GridView1_RowCancelingEdit">
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="dic_id" HeaderText="ID" ReadOnly="True" />
<asp:BoundField DataField="dic_zy" HeaderText="专业名" />
<asp:BoundField DataField="zyfzr" HeaderText="专业负责人" />
<asp:BoundField DataField="fzrid" HeaderText="统筹编号" />
<asp:CommandField HeaderText="选择" ShowSelectButton="True" />
<asp:CommandField HeaderText="编辑" ShowEditButton="True" />
<asp:CommandField HeaderText="删除" ShowDeleteButton="True" />
</Columns>
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
</asp:GridView>

<br />
&nbsp;
<asp:Label ID="Label7" runat="server" Text="添加专业"></asp:Label>
<asp:TextBox ID="tianjiazy" runat="server"></asp:TextBox>
<asp:Button ID="Button3" runat="server" Text="确定" OnClick="Button3_Click" /><br />

</asp:Content>

请问红色代码部分应该怎么写?不用母版页的时候id="+Content.id.value,"这里是id="+form1.id.value,"。可使用了母版页,没有form1了。求助!!!

搜索更多相关主题的帖子: asp function center scroll 
2007-08-16 16:42
ice_beiyu
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2007-7-10
得分:0 
回复:(ice_beiyu)[求助]使用母版页出现的问题
function Button7_onclick()
{
var str=showModalDialog("xuanzerenyuan/xuanzerenyuan.asp?iniurl=wenjianzhonglei_guanliyuan.asp?id="+form1.id.value,"","center:yes;status:yes;scroll:no;help:no;dialogWidth:500px;dialogHeight:290px");

if(str!=null)
{
var mingcheng,bianhao,string;
string=str.split("$");
mingcheng=string[0];
bianhao=string[1];
if(bianhao.length>7)
{
window.alert("只能选择一个!");
return false;
}
window.document.form1.fuzeren.value=mingcheng;
window.document.form1.gonghao.value=bianhao;
}
}
</script>
<form id="form1" method = "post" >
.................
</form>
</asp:Content>

加上form的话(如上)form的属性不能加runat ="server"属性
这样可以打开选择窗口了
可是文本框还是取不到值
2007-08-16 17:57
ice_beiyu
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2007-7-10
得分:0 

没人解答,自己顶上去

2007-08-17 07:49
cyyu_ryh
Rank: 8Rank: 8
等 级:贵宾
威 望:45
帖 子:1899
专家分:176
注 册:2006-10-21
得分:0 
你是用ASP作的吗
怎么下段是ASP不是ASPX
xuanzerenyuan/xuanzerenyuan.asp?iniurl

有事无事都密我. MSN: cyyu_ryh@hotmail.co.jp E-mail: cyyu_ryh@
2007-08-17 09:51
卡卡艾
Rank: 6Rank: 6
等 级:贵宾
威 望:22
帖 子:672
专家分:0
注 册:2007-4-3
得分:0 
用Master的FindControl()方法来取值

革命尚未成功,同志仍需努力-----+++
2007-08-18 08:20
ice_beiyu
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2007-7-10
得分:0 

已经解决

2007-08-18 10:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-163220-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.302574 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved