怪事年年有,今年特别多。小菜求帮助。gridview取值,显示的问题e.Row.Attributes.Add("ondblClick", "showlay('"
e.Row.Attributes.Add("ondblClick", "showlay('" + ((Label)e.Row.FindControl("lblTSNR")).Text + "');showlay1('" + ((Label)e.Row.FindControl("lblTSNR")).Text + "')"); 前面一个方法可以取到值,但后面一个取不到
javascript 代码
function showlay(id)
{
document.getElementById("<%=txt.ClientID %>").innerHTML=id;
document.getElementById("details").style.display="block";
}
function showlay1(id)
{
document.getElementById("<%=txt1.ClientID %>").innerHTML=id;
document.getElementById("details").style.display="block";
}
取这个的值显示在div
<asp:TemplateField HeaderText="1" Visible="false">
<ItemTemplate>
<asp:Label ID="lblDFNR" runat="server" Text='<%#Eval("DFNR") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" Visible="false">
<ItemTemplate>
<asp:Label ID="lblTSNR" runat="server" Text='<%#Eval("TSNR") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
div
<div style=" width:450px; height:200px; z-index:999; position:absolute; display:none; top:400px; background-color:#fff;" id="details">
<asp:TextBox ID="txt" runat="server" Text="" Height="90px" Rows="8"
TextMode="MultiLine" Width="400px"></asp:TextBox><br />
<asp:TextBox ID="txt1" runat="server" Text="" Height="90px" Rows="8"
TextMode="MultiLine" Width="400px"></asp:TextBox>
</div>
------解决方案--------------------
TSNR内容里面有引号、换行等特殊字符吗
------解决方案--------------------
TSNR内容里面有引号、换行等特殊字符吗