客戶提出需求要點擊文本框的時候彈出框
代碼如下:(這段代碼不管怎麼樣改都不能彈出框,而且還報腳本錯誤:Object expected。最後上網搜到說javascript腳本不能放在head裏,要放在body裏。這樣才解決了問題。至於原因到現在都沒弄明白。)
<html>
<head runat="server">
//放在body中
<script language="javascript" type="text/javascript">
function aa()
{
window.showModalDialog("aa.aspx");
}
</script>
</head>
<body>
<asp:GridView ID="gvXGJL" runat="server" AutoGenerateColumns="False" PageSize="10"
Width="98%" AllowPaging="True" AllowSorting="True" DataKeyNames="ID" OnRowCancelingEdit="gvXGJL_RowCancelingEdit" OnRowDeleting="gvXGJL_RowDeleting" OnRowEditing="gvXGJL_RowEditing" OnRowUpdating="gvXGJL_RowUpdating"OnRowDataBound="gvXGJL_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="維修項目">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text=' <%# DataBinder.Eval(Container.DataItem, "Name")%>'Width="95%" ReadOnly="true" οnclick="aa()"> </asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text=' <%# Bind("Name") %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</body>