在一个界面上有一个GridView,然后在每一个模板列中都有不同的label且绑定了值,现在想要将模板列中label的值赋值给一个弹出层中lblremainVd,其中弹出层是经过js实现的,那么给label赋值要怎么办?
页面的主要代码:
<div id="div_vacation" align="left" valign="top" style="position:static;top:100;left:100;background-color:#ffffff;visibility:hidden; ">
<table align="center" border="0" cellpadding="0" cellspacing="0" height="120" style="border-right: #c0cfb2 1px solid;
border-top: #c0cfb2 1px solid; left: 304px; border-left: #c0cfb2 1px solid; width: 304px;
border-bottom: #c0cfb2 1px solid; position: absolute; top: 168px; background-color: menu">
<tr>
<td bgcolor="#6666ff" style="padding-left: 30px; width: 236px; cursor: move; color: #ffffff;
border-bottom: #c0cfb2 1px solid; height: 26px; background-color: activeborder">
<strong style="font-size: small">Vacation Day</strong></td>
</tr>
<tr style="font-size: 12pt">
<td class="xiaoxi_bg" style="padding-right: 30px; padding-left: 30px; width: 236px;
padding-top: 5px; height: 100px; font-size: 12px;" valign="top">
<asp:Label ID="lblCNNameVD" runat="server" Font-Size="X-Small" Text="CNName" Font-Bold="True" Font-Names="Calibri"></asp:Label>
<asp:Label
ID="lblDateVD" runat="server" Font-Size="X-Small" Text="Date" Font-Names="Calibri"></asp:Label>
<asp:Label ID="lblEmployeeIDVD" runat="server" Font-Size="X-Small" Visible="False"></asp:Label><br />
<asp:Label ID="lblvacationsun" runat="server" Text="Vacation" Font-Size="Small" Font-Bold="True" Font-Names="Calibri"></asp:Label>
<asp:DropDownList ID="ddlvacationVD" runat="server" DataSourceID="SqlDataSourceVacation" DataTextField="VacationName"
DataValueField="VacationCode" Font-Size="X-Small">
</asp:DropDownList><br />
<asp:Label ID="lblvacationdaysVD" runat="server" Text="Hour" Font-Size="Small" Font-Bold="True" Font-Names="Calibri"></asp:Label>
<input type="text" id="txthourVD" style="width: 64px; font-size: 12px; height: 13px;" />
<input type="checkbox" onclick="show(this,1,'8')" title="oneday" />1天<br />
<asp:Label ID="lblstarttimeVD" runat="server" Text="Start Time" Font-Size="Small" Font-Bold="True" Font-Names="Calibri"></asp:Label>
<asp:TextBox ID="txtboxstarttimeVD" runat="server" Font-Size="X-Small" ToolTip="时间格式为:HH:MM"
Width="64px"></asp:TextBox><asp:RequiredFieldValidator ID="rvfstartVD" runat="server"
ControlToValidate="txtboxstarttimeVD" ErrorMessage="RequiredFieldValidator" Font-Size="X-Small"
ValidationGroup="ValidataGroup1">输入时间不能为空</asp:RequiredFieldValidator><br />
<asp:RegularExpressionValidator ID="revstartVD" runat="server" ControlToValidate="txtboxstarttimeVD"
ErrorMessage="RegularExpressionValidator" Font-Size="X-Small" ValidationExpression="\d{1,2}:\d{1,2}" ValidationGroup="ValidataGroup1">请输入正确的时间格式,如:08:30</asp:RegularExpressionValidator><br />
<asp:Label ID="lblendtimeVD" runat="server" Text="End Time" Font-Size="Small" Font-Bold="True" Font-Names="Calibri"></asp:Label>
<asp:TextBox ID="txtendtimeVD" runat="server" Width="64px" Font-Size="X-Small" ToolTip="时间格式为HH:MM"></asp:TextBox><asp:RequiredFieldValidator ID="rfvendVD"
runat="server" ControlToValidate="txtboxstarttimeVD" ErrorMessage="RequiredFieldValidator"
Font-Size="X-Small" ValidationGroup="ValidataGroup1">输入时间不能为空</asp:RequiredFieldValidator><br />
<asp:RegularExpressionValidator ID="revendVD" runat="server" ControlToValidate="txtendtimeVD"
ErrorMessage="RegularExpressionValidator" Font-Size="X-Small" ValidationExpression="\d{1,2}:\d{1,2}"
ValidationGroup="ValidataGroup1">请输入正确的时间格式,如:08:30</asp:RegularExpressionValidator><br />
<asp:Button ID="btnsubmitVD" runat="server" Text="Sumbit" OnClick ="btnsubmitVD_Click" Font-Size="X-Small" ValidationGroup="ValidataGroup1"/>
<asp:Button ID="btncancelVD" runat="server" Text="Cancel" Font-Size="X-Small" UseSubmitBehavior="False" />
<asp:Label ID="lblremainVd" runat="server" Text="Remain" Font-Size="X-Small" Visible="False"></asp:Label>
<asp:Label ID="lblremainsuntxt" runat="server" Text="Label" Font-Size="X-Small" ToolTip="该假期剩余天数" Visible="False"></asp:Label></td>
</tr>
</table>
</div>
<input id="btneditvacation" type="button" onclick="change1()" style="background-position: center center; width: 16px; background-repeat: no-repeat; height: 16px; position: static; font-size: 7px; background-image: url(images/books_edit.png); background-color: transparent;" size="20"/>
JS代码:
<script type="text/javascript">
function change1()
{
document.getElementById('div_vacation').style.visibility='visible';
}
</script>
页面的主要代码:
<div id="div_vacation" align="left" valign="top" style="position:static;top:100;left:100;background-color:#ffffff;visibility:hidden; ">
<table align="center" border="0" cellpadding="0" cellspacing="0" height="120" style="border-right: #c0cfb2 1px solid;
border-top: #c0cfb2 1px solid; left: 304px; border-left: #c0cfb2 1px solid; width: 304px;
border-bottom: #c0cfb2 1px solid; position: absolute; top: 168px; background-color: menu">
<tr>
<td bgcolor="#6666ff" style="padding-left: 30px; width: 236px; cursor: move; color: #ffffff;
border-bottom: #c0cfb2 1px solid; height: 26px; background-color: activeborder">
<strong style="font-size: small">Vacation Day</strong></td>
</tr>
<tr style="font-size: 12pt">
<td class="xiaoxi_bg" style="padding-right: 30px; padding-left: 30px; width: 236px;
padding-top: 5px; height: 100px; font-size: 12px;" valign="top">
<asp:Label ID="lblCNNameVD" runat="server" Font-Size="X-Small" Text="CNName" Font-Bold="True" Font-Names="Calibri"></asp:Label>
<asp:Label
ID="lblDateVD" runat="server" Font-Size="X-Small" Text="Date" Font-Names="Calibri"></asp:Label>
<asp:Label ID="lblEmployeeIDVD" runat="server" Font-Size="X-Small" Visible="False"></asp:Label><br />
<asp:Label ID="lblvacationsun" runat="server" Text="Vacation" Font-Size="Small" Font-Bold="True" Font-Names="Calibri"></asp:Label>
<asp:DropDownList ID="ddlvacationVD" runat="server" DataSourceID="SqlDataSourceVacation" DataTextField="VacationName"
DataValueField="VacationCode" Font-Size="X-Small">
</asp:DropDownList><br />
<asp:Label ID="lblvacationdaysVD" runat="server" Text="Hour" Font-Size="Small" Font-Bold="True" Font-Names="Calibri"></asp:Label>
<input type="text" id="txthourVD" style="width: 64px; font-size: 12px; height: 13px;" />
<input type="checkbox" onclick="show(this,1,'8')" title="oneday" />1天<br />
<asp:Label ID="lblstarttimeVD" runat="server" Text="Start Time" Font-Size="Small" Font-Bold="True" Font-Names="Calibri"></asp:Label>
<asp:TextBox ID="txtboxstarttimeVD" runat="server" Font-Size="X-Small" ToolTip="时间格式为:HH:MM"
Width="64px"></asp:TextBox><asp:RequiredFieldValidator ID="rvfstartVD" runat="server"
ControlToValidate="txtboxstarttimeVD" ErrorMessage="RequiredFieldValidator" Font-Size="X-Small"
ValidationGroup="ValidataGroup1">输入时间不能为空</asp:RequiredFieldValidator><br />
<asp:RegularExpressionValidator ID="revstartVD" runat="server" ControlToValidate="txtboxstarttimeVD"
ErrorMessage="RegularExpressionValidator" Font-Size="X-Small" ValidationExpression="\d{1,2}:\d{1,2}" ValidationGroup="ValidataGroup1">请输入正确的时间格式,如:08:30</asp:RegularExpressionValidator><br />
<asp:Label ID="lblendtimeVD" runat="server" Text="End Time" Font-Size="Small" Font-Bold="True" Font-Names="Calibri"></asp:Label>
<asp:TextBox ID="txtendtimeVD" runat="server" Width="64px" Font-Size="X-Small" ToolTip="时间格式为HH:MM"></asp:TextBox><asp:RequiredFieldValidator ID="rfvendVD"
runat="server" ControlToValidate="txtboxstarttimeVD" ErrorMessage="RequiredFieldValidator"
Font-Size="X-Small" ValidationGroup="ValidataGroup1">输入时间不能为空</asp:RequiredFieldValidator><br />
<asp:RegularExpressionValidator ID="revendVD" runat="server" ControlToValidate="txtendtimeVD"
ErrorMessage="RegularExpressionValidator" Font-Size="X-Small" ValidationExpression="\d{1,2}:\d{1,2}"
ValidationGroup="ValidataGroup1">请输入正确的时间格式,如:08:30</asp:RegularExpressionValidator><br />
<asp:Button ID="btnsubmitVD" runat="server" Text="Sumbit" OnClick ="btnsubmitVD_Click" Font-Size="X-Small" ValidationGroup="ValidataGroup1"/>
<asp:Button ID="btncancelVD" runat="server" Text="Cancel" Font-Size="X-Small" UseSubmitBehavior="False" />
<asp:Label ID="lblremainVd" runat="server" Text="Remain" Font-Size="X-Small" Visible="False"></asp:Label>
<asp:Label ID="lblremainsuntxt" runat="server" Text="Label" Font-Size="X-Small" ToolTip="该假期剩余天数" Visible="False"></asp:Label></td>
</tr>
</table>
</div>
<input id="btneditvacation" type="button" onclick="change1()" style="background-position: center center; width: 16px; background-repeat: no-repeat; height: 16px; position: static; font-size: 7px; background-image: url(images/books_edit.png); background-color: transparent;" size="20"/>
JS代码:
<script type="text/javascript">
function change1()
{
document.getElementById('div_vacation').style.visibility='visible';
}
</script>
解决方案 »
- 问一个脚本的问题~
- 关于论坛版块的最新贴的问题!!!!
- 能使用AJAX实现这样个效果吗?
- 怎么截取富文本框中的字符?
- 送分IIS问题,为什么无法打开http://localhost/testweb/Default.aspx
- 在asp.net中怎样取消起始页
- System.Web.UI.HtmlControls.HtmlForm 并不包含对Web的定义
- ::关于用户控件传--参数--的问题?::
- 关于crystal打印问题
- datagrid格式多列设置的问题
- 关于DropDownList的一个小问题,求高手解决
- 请问网页上能看到文字,但源代码中没有的,怎么用HttpWebRequest/HttpWebResponse来获取?
你onclick的时候就可以了或者在你控件加载的时候用个隐藏域来记录你的lable 的值
在你onclick 的时候去读取隐藏域的值,然后在赋值到你弹出的控件上JS代码:
<script type="text/javascript">
function change1(obj)
{
document.getElementById('div_vacation').style.visibility=obj;
}
</script>