本文介绍了'GridView'类型的控件'ctl00_AlertPM_gvInstallationPM'必须放在带有runat = server的表单标签内。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
PmAlert.ascx
PmAlert.ascx
<table align="center" runat="server">
<tr>
<td align="center">
<asp:ImageButton ID="btnExportPDF" runat="server" ImageUrl="~/images/adobe.PNG" ToolTip="Export to PDF"
OnClick="btnExportPDF_Click" />
<asp:ImageButton ID="btnExportExcel" runat="server" ImageUrl="~/images/excel.PNG"
ToolTip="Export to Excel" OnClick="btnExportExcel_Click" />
<asp:ImageButton ID="btnExportWord" runat="server" ImageUrl="~/images/word.PNG" ToolTip="Export to Word"
OnClick="btnExportWord_Click" />
</td>
</tr>
<tr>
<td align="center">
<asp:Label ID="lblSubTitle" runat="server" CssClass="subheading">
</td>
</tr>
<div runat="server" id="PDFReport">
<table>
<tr>
<td align="center">
<asp:GridView ID="gvInstallationPM" runat="server" AutoGenerateColumns="False" BorderColor="#DEBA84"
BackColor="#DEBA84" BorderStyle="Solid" BorderWidth="2px" CellPadding="3" CellSpacing="2"
Font-Names="Verdana" Font-Size="11px">
<footerstyle backcolor="#E4B550" forecolor="#8C4510" borderstyle="None" />
<rowstyle backcolor="White" height="20px" forecolor="#8C4510" horizontalalign="Left" />
<columns>
<asp:BoundField DataField="InstallationNo" HeaderText="Installation No.">
<HeaderStyle HorizontalAlign="Center" Width="100px" />
<itemstyle horizontalalign="Center" width="100px" />
<asp:BoundField DataField="InstallationDate" HeaderText="Installation Date">
<HeaderStyle HorizontalAlign="Center" Width="100px" />
<itemstyle horizontalalign="Center" width="100px" />
<asp:BoundField DataField="ClientName" HeaderText="Customer">
<HeaderStyle HorizontalAlign="Center" Width="150px" />
<itemstyle horizontalalign="Left" width="150px" />
<asp:BoundField DataField="MaterialName" HeaderText="Equipment">
<HeaderStyle HorizontalAlign="Center" Width="150px" />
<itemstyle horizontalalign="Left" width="150px" />
<asp:BoundField DataField="PMCallDate" HeaderText="PM CallDate">
<HeaderStyle HorizontalAlign="Center" Width="80px" />
<itemstyle horizontalalign="Center" width="80px" verticalalign="Top" />
</columns>
<pagerstyle forecolor="#8C4510" horizontalalign="Center" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#D98C2A" Font-Bold="True" ForeColor="White" Height="20px"
HorizontalAlign="Center" />
</td>
</tr>
<%-- <tr>
<td align="center" style="padding-removed 20px">
<asp:GridView ID="gvContractPM" runat="server" AutoGenerateColumns="False" BorderColor="#DEBA84"
BackColor="#DEBA84" BorderStyle="Solid" BorderWidth="2px" CellPadding="3" CellSpacing="2"
Font-Names="Verdana" Font-Size="11px">
<footerstyle backcolor="#E4B550" forecolor="#8C4510" borderstyle="None" />
<rowstyle backcolor="White" height="20px" forecolor="#8C4510" horizontalalign="Left" />
<columns>
<asp:BoundField DataField="MaintenanceContractNo" HeaderText="Contract No.">
<HeaderStyle HorizontalAlign="Center" Width="100px" />
<itemstyle horizontalalign="Center" width="100px" />
<asp:BoundField DataField="ContractStartDate" HeaderText="Start Date">
<HeaderStyle HorizontalAlign="Center" Width="100px" />
<itemstyle horizontalalign="Center" width="100px" />
<asp:BoundField DataField="ContractEndDate" HeaderText="End Date">
<HeaderStyle HorizontalAlign="Center" Width="100px" />
<itemstyle horizontalalign="Center" width="100px" />
<asp:BoundField DataField="ClientName" HeaderText="Customer">
<HeaderStyle HorizontalAlign="Center" Width="150px" />
<itemstyle horizontalalign="Left" width="150px" />
<asp:BoundField DataField="MaterialName" HeaderText="Equipment">
<HeaderStyle HorizontalAlign="Center" Width="150px" />
<itemstyle horizontalalign="Left" width="150px" />
<asp:BoundField DataField="PMCallDate" HeaderText="PM CallDate">
<HeaderStyle HorizontalAlign="Center" Width="80px" />
<itemstyle horizontalalign="Center" width="80px" verticalalign="Top" />
</columns>
<pagerstyle forecolor="#8C4510" horizontalalign="Center" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#D98C2A" Font-Bold="True" ForeColor="White" Height="20px"
HorizontalAlign="Center" />
</td>
</tr>--%>
</table> ->
this page have 3 image button export to PDF,EXCEL & WORD
I have on master page
HomePage.Master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="HomePage.master.cs" Inherits="CMMaintenance.UI._Master.HomePage" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/_UserControl/PMAlerts.ascx" TagName="PM" TagPrefix="Alert" %>
<%@ Register Src="~/_UserControl/WarrantyExpiry.ascx" TagName="Warranty" TagPrefix="Expiry" %>
<%@ Register Src="~/_UserControl/ContractExpiry.ascx" TagName="Contract" TagPrefix="Expiry" %>
<%@ Register Src="~/_UserControl/DebitNoteAlter.ascx" TagName="DebitNote" TagPrefix="Alert" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Care Mediquip - Medical Equipment Dealers</title>
<link href="../_CSS/style.css" rel="stylesheet" type="text/css" />
<link href="../_CSS/Comman.css" rel="stylesheet" type="text/css" />
<script src="../_JS/CommonFunction.js" type="text/javascript"></script>
<%--<link href="../css/CMMaintenance.css" rel="stylesheet" type="text/css" />--%>
<script type="text/javascript" language="javascript">
function closeDOB() {
var y = document.getElementById('divDOB');
// alert(y);
y.style.display = 'none';
var x = document.getElementById('ctl00_ModalPopupExtender1_backgroundElement');
// alert(x);
x.style.display = 'none';
// $find('divDOB').hide();
}
function closeAMC() {
var z = document.getElementById('divAMC');
z.style.display = 'none';
var w = document.getElementById('ctl00_ModalPopupExtender2_backgroundElement');
w.style.display = 'none';
}
function closeWarranty() {
var a = document.getElementById('divWarranty');
a.style.display = 'none';
var b = document.getElementById('ctl00_ModalPopupExtender3_backgroundElement');
b.style.display = 'none';
}
function closeContract() {
var a = document.getElementById('divContract');
a.style.display = 'none';
var b = document.getElementById('ctl00_ModalPopupExtender1_backgroundElement');
b.style.display = 'none';
}
function closeDebit(){
var a = document.getElementById('divDebit');
a.style.display = 'none';
var b = document.getElementById('ctl00_ModalPopupExtender4_backgroundElement');
b.style.display = 'none';
}
function ShowPopUP(){
$find('ModalPopupExtender4').show();
}
</script>
<style type="text/css">
.RadWModalImage
{
filter: Alpha(Opacity=80);
-moz-opacity: 0.4;
opacity: 0.4;
background-color: #666699;
}
.TitlebarRight
{
background: transparent url(../images/cross_icon_normal.png) no-repeat scroll right center;
cursor: pointer; /* float: right;*/
height: 15px;
width: 20px; /* margin-top: 5px;
margin-right: 5px;*/
}
.popup_Titlebar
{
background: transparent url(../images/titlebar_bg.jpg) repeat scroll 0 0;
height: 29px;
}
.TitlebarLeft
{
float: left;
color: #FFFFFF;
font-family: verdana;
font-size: 12px;
font-weight: bold;
padding-left: 10px; /* width: 990px; /* margin-top: 5px;*/
}
.popup_Container
{
background-color: white;
border: 2px solid #000000;
padding: 0;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<div id="wrapper">
<div id="header">
<h1>
CARE MEDIQUIP</h1>
<div align="right" style="height: 100%; padding-removed 0px; padding-removed 8px">
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/CareMediquipMain.gif" Width="70"
Height="65" />
</div>
</div>
<div id="menu">
<%-- <ul>
<li><a id="InstallationLink" href="<%= Page.ResolveUrl(">
INSTALLATION</a></li>
<li><a id="PMLink" href="<%= Page.ResolveUrl(">PM Details</a></li>
<li><a id="ComplaintLink" href="#">COMPLAINTS</a></li>
<li><a id="ReportsLink" href="#">REPORTS</a></li>
<li><a href="#">ABOUT</a></li>
</ul>--%>
<ul>
<li>
<asp:LinkButton ID="AMC" runat="server" Style="color: White">PM ALERTS</li>
<li>
<asp:LinkButton ID="Warranty" runat="server" Style="color: White">WARRANTY EXPIRY</li>
<li>
<asp:LinkButton ID="Contract" runat="server" Style="color: White">CONTRACT EXPIRY</li>
<li>
<asp:LinkButton ID="DebitNote" runat="server" Style="color: White">Debit Note Reminder</li>
</ul>
</div>
<div align="right" style="vertical-align: top; font-size: 11px; font-weight: bold;<br mode=" hold=" /> padding-right: 15px;">
<%-- <asp:LinkButton ID="AMC" runat="server" Style="color: Maroon">PM Alerts
<asp:LinkButton ID="Warranty" runat="server" Style="color: Maroon">Warranty Expiry--%>
<asp:Label ID="lblWelcomeUser" runat="server" Text="">
<a href="../Default.aspx">LOG OUT</a>
</div>
<table align="left">
<tr>
<td align="left" valign="top">
<div id="left">
<ul style="line-height: 50px">
<li><a href="../ClientUI/Installation.aspx">INSTALLATION</a></li>
<li><a href="../ClientUI/InstallationOtherReoorts.aspx">INSTALLATION PRINTS</a></li>
<li><a href="../ClientUI/MaintenanceContractForm.aspx">MAINTENANCE CONTRACT</a></li>
<li><a href="../ClientUI/InstallationMaterialEdit.aspx">EQUIPMENT EDIT</a></li>
<li><a href="../ClientUI/PMCallForm.aspx">PM CALL FORM</a></li>
<li><a href="../ClientUI/DebitNote.aspx">DEBIT NOTE</a></li>
<li><a href="../ClientUI/PMDebitNote.aspx">PM DEBIT NOTE</a></li>
<li><a href="../ClientUI/ComplaintForm.aspx">REGISTER COMPLAINT </a></li>
<li><a href="../ClientUI/ExpiryACK.aspx">EXPIRY ACKNOWLEDGEMENT</a></li>
<li><a href="../ClientUI/Reports.aspx">REPORTS</a></li>
</ul>
</div>
</td>
<td align="left" valign="top" width="100%" height="400px">
<div id="content" align="left">
<div id="right" style="vertical-align: top;">
<%-- <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<contenttemplate>--%>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
<%-- </contenttemplate>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<progresstemplate>
<div style="removed: fixed; height: 10%; removed 40%; removed 50%;">
<img src="../images/ajax-loader.gif" alt="Please Wait ..." /><br />
<span style="color: #763333; font-weight: bold; font-size: 12px">Please Wait...</span>
</div>
</progresstemplate>
--%>
</div>
</div>
</td>
</tr>
</table>
<div id="footer">
<p class="copyright">
© Care Mediquip 2011
</p>
<p class="poweredby">
Powered by <a href="http://www.banyantreesoft.com/" title="BanyanTree Software Solutions">
<img src="../images/banyantreelogo.gif" alt="Banyan Tree Software Solutions" align="middle"
style="border-width: 0px; text-decoration: none;" />
</a>
</p>
</div>
</div>
<div style="height: 400px; text-align: left" id="divAMC" align="center">
<table class="popup_Container">
<tr>
<td colspan="2" id="Td1" class="popup_Titlebar">
<table>
<tr>
<td class="TitlebarLeft" width="720px">
PM Alerts
</td>
<td align="right" class="TitlebarRight" önclick="closeAMC();" valign="middle">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Panel ID="Panel1" runat="server" ScrollBars="Auto" Height="400px">
<Alert:PM runat="server" ID="AlertPM" />
</td>
</tr>
</table>
</div>
<div style="height: 400px; text-align: left" id="divWarranty" align="center">
<table class="popup_Container">
<tr>
<td colspan="2" id="Td2" class="popup_Titlebar">
<table>
<tr>
<td class="TitlebarLeft" width="700px">
Alerts for Warranty Expiry
</td>
<td class="TitlebarRight" önclick="closeWarranty();" valign="middle" style="padding-removed 5px;">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Panel ID="Panel3" runat="server" ScrollBars="Auto" Height="400px">
<Expiry:Warranty ID="Warranty1" runat="server" />
</td>
</tr>
</table>
</div>
<div style="height: 400px; text-align: left" id="divContract" align="center">
<table class="popup_Container">
<tr>
<td colspan="2" id="Td3" class="popup_Titlebar">
<table>
<tr>
<td class="TitlebarLeft" width="700px">
Alerts for Contract Expiry
</td>
<td class="TitlebarRight" önclick="closeContract();" valign="middle" style="padding-removed 5px;">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Panel ID="Panel2" runat="server" ScrollBars="Auto" Height="400px">
<Expiry:Contract ID="Expiry1" runat="server" />
</td>
</tr>
</table>
</div>
<div style="height: 400px; text-align: left" id="divDebit" align="center">
<table class="popup_Container">
<tr>
<td colspan="2" id="Td4" class="popup_Titlebar">
<table>
<tr>
<td class="TitlebarLeft" width="700px">
Debit Note Reminders
</td>
<td class="TitlebarRight" önclick="closeDebit();" valign="middle" style="padding-removed 5px;">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Panel ID="Panel4" runat="server" ScrollBars="Auto" Height="400px">
<Alert:DebitNote ID="DBNote" runat="server" Visible="true" />
</td>
</tr>
</table>
</div>
<cc1:ModalPopupExtender ID="ModalPopupExtender2" runat="server" DropShadow="false"
Drag="True" Enabled="true" TargetControlID="AMC" PopupControlID="divAMC" BackgroundCssClass="RadWModalImage">
<cc1:ModalPopupExtender ID="ModalPopupExtender3" runat="server" DropShadow="false"
Drag="True" Enabled="true" TargetControlID="Warranty" PopupControlID="divWarranty"
BackgroundCssClass="RadWModalImage">
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" DropShadow="false"
Drag="True" Enabled="true" TargetControlID="Contract" PopupControlID="divContract"
BackgroundCssClass="RadWModalImage">
<cc1:ModalPopupExtender ID="ModalPopupExtender4" runat="server" DropShadow="false"
önOkScript="ShowPopUP()" Drag="True" Enabled="true" TargetControlID="DebitNote"
PopupControlID="divDebit" BackgroundCssClass="RadWModalImage">
</form>
<script type="text/javascript">
function toggleVisibility(controlId) {
// alert(controlId);
// alert('hello');
var ctrl = document.getElementById(controlId);
var divM = document.getElementById('divMaster');
var divC = document.getElementById('divComplaint');
var divR = document.getElementById('divReport');
var divI = document.getElementById('divInstallation');
// divM.style.display = 'block';
// divC.style.display = 'none';
// divR.style.display = 'none';
if (ctrl.id == 'MasterLink') {
//alert('hi');
divM.style.display = 'block';
divC.style.display = 'none';
divR.style.display = 'none';
divI.style.display = 'none';
}
else if (ctrl.id == 'ComplaintLink') {
//alert('hi2');
divC.style.display = 'block';
divM.style.display = 'none';
divR.style.display = 'none';
divI.style.display = 'none';
}
else if (ctrl.id == 'ReportsLink') {
//alert('hi3');
divR.style.display = 'block';
divC.style.display = 'none';
divM.style.display = 'none';
divI.style.display = 'none';
}
else if (ctrl.id == 'InstallationLink') {
divI.style.display = 'block';
divR.style.display = 'none';
divC.style.display = 'none';
divM.style.display = 'none';
}
}
</script>
</body>
</html>
I have referenced that PmAlert.ascx page called in master page popUp control. while m click on export to pdf button it give error like "Control 'ctl00_AlertPM_gvInstallationPM' of type 'GridView' must be placed inside a form tag with runat=server."
Please help to solve this probl
em.
推荐答案
I have referenced that PmAlert.ascx page called in master page popUp control. while m click on export to pdf button it give error like "Control 'ctl00_AlertPM_gvInstallationPM' of type 'GridView' must be placed inside a form tag with runat=server."
Please help to solve this probl
em.
这篇关于'GridView'类型的控件'ctl00_AlertPM_gvInstallationPM'必须放在带有runat = server的表单标签内。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!