0

更新的问题:

我将一些页面转换为使用母版页,它们运行良好。

在子页面上执行 request.form 时(表单声明在母版页中)我得到一个空值(只是做 Request.Form("field") 返回 NULL 但在母版页之前它工作

注意:在实现母版页之前,所有代码都运行良好!!

按钮代码为:

<asp:Button ID="btnPACheck" runat="server"  Text="<%$Resources:share,btnPACheck %>" onclick="btnPACheck_Click" /> 

该按钮的 html 页面上的视图来源是:

<input type="submit" name="ctl00$ContentPlaceHolder1$btnPACheck" value="Continue" id="ctl00_ContentPlaceHolder1_btnPACheck" />

onclick 代码很长,但它是这样声明的(第一行有调试行,但它没有到达它):

protected void btnPACheck_Click(object sender, EventArgs e)
    {
        bool validPA = false;

母版页如下:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPageSiteWide.master.cs" Inherits="MasterPageSiteWide" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register src="~/ucBanner.ascx" TagName="Banner" TagPrefix="ucBanner"  %>

<!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></title>

    <style type="text/css">
        body {
            background: url(page-bg.gif) repeat-x top left #5997C8;  
            CLIP: rect(19px 65px 50px 10px);
            margin-top: 10px;
            margin-bottom:30px;
            margin-right: 40px;
            margin-left: 60px;
            width:80%;
        }


        TD.bluerow {
            height: .10pc;
            background-color: #000066;
        }

        TD.medbluerow {
            height: .0005pc;
            background-color: #6699CC;
        }   

        .panel_with_padding {
             padding-top:10px;
             padding-left:10px;
             padding-right:10px;
             padding-bottom:10px; 
         }

    </style>

    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>

<body>

    <form id="form1" runat="server" method="post">

        <asp:ScriptManager ID="ScriptManager1" EnableScriptGlobalization="true" EnableScriptLocalization="true" runat="server"></asp:ScriptManager>


        <asp:RoundedCornersExtender Corners="All" TargetControlID="MainPanel" BorderColor="Black" ID="RoundedCornersExtender1" runat="server"></asp:RoundedCornersExtender>

        <asp:Panel BackColor="White" runat="server" ID="MainPanel" CssClass="panel_with_padding">

            <div>            
                <br />
                <div>
                    <asp:Label ID="lblTopHeading" runat="server" Font-Bold="true" Font-Size="X-Large" Text=""></asp:Label>
                </div>


                <br />
                <ucBanner:Banner ID="bannerStrip" runat="server"></ucBanner:Banner>
                <br />

                <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">        
                </asp:ContentPlaceHolder>

            </div>

            <br /><br />
            <hr />    
            <div>
                © Copyright 20xx-2012, Ford Motor Company. All rights reserved.
            </div>

        </asp:Panel>



    </form>





</body>
</html>

内容页面(部分不能太长发布整个内容),其中按钮为:

<%@ Page Language="C#" MasterPageFile="~/MasterPageSiteWide.master" AutoEventWireup="true" CodeFile="initial.aspx.cs" ValidateRequest="false" Inherits="initial"  UICulture="auto"%>
<%@ MasterType  virtualPath="~/MasterPageSiteWide.master"%>

<%@ Register src="~/ucBanner.ascx" TagName="Banner" TagPrefix="ucBanner"  %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <title>Hotline - Dealer Prior Approval - Begin</title>   
    <link href="Styles/dpaStyles.css" rel="stylesheet" type="text/css"/>
     <script type="text/javascript">

         function OpenPopUp() {
             window.open("collectvin.aspx", "List", "scrollbars=no,resizable=no,width=400,height=350");

         }


         function InvokePop(vin) {
             val = document.getElementById(vin).value;
             // to handle in IE 7.0           
             if (window.showModalDialog) {
                 retVal = window.showModalDialog("collectvin.aspx?Control1=" + vin + "&ControlVal=" + val, 'Show Popup Window', "dialogHeight:90px,dialogWidth:250px,resizable:yes,center:yes,");
                 document.getElementById(vin).value = retVal;
             }

         }


         function checkChoice() {
             var hasFound = false
             for (i = 0; i < document.secpaform.SecPACode.length; i++) {
                 if (document.secpaform.SecPACode[i].checked == true) {
                     hasFound = true
                     break;
                 }
             }

             if (!hasFound) {
                 alert("Please select one...")
                 document.secpaform.SecPACode[0].focus();
                 return false
             }
             else
                 return true
         }


         function checkOldVin() {
             //alert('inside checkOldVin');
             if (frmInitial.txtOldVin.value == '') {
                 alert('Please enter the VIN for an older vehicle!!!');
                 frmInitial.txtOldVin.focus();
                 return false;

             }
             var alphanumeric = /^[0-9a-zA-Z]+$/;
             if (!frmInitial.txtOldVin.value.match(alphanumeric)) {
                 alert('VIN must be numbers and letters only!');
                 frmInitial.txtOldVin.focus();
                 return false;
             }
             return true;
         }


         function checkPartChoice() {
             //alert('in checkPartsChoice');
         }

     </script> 
      <style type="text/css">
        body {
        background: url(page-bg.gif) repeat-x top left #5997C8;  
        CLIP: rect(19px 65px 50px 10px);
        margin-top: 10px;
        margin-bottom:30px;
        margin-right: 40px;
        margin-left: 60px;
        width:80%;
        }

        TD.bluerow {
        height: .10pc;
        background-color: #000066;
        }

        TD.medbluerow {
        height: .0005pc;
        background-color: #6699CC;
        }   


    p.MsoNormal
    {margin-top:0in;
    margin-right:0in;
    margin-bottom:10.0pt;
    margin-left:0in;
    line-height:115%;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    }


    </style>  

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">


        <!-- -------------------------->
        <!-- start outer table, rounded corners --> 
        <!-- -------------------------->
        <table style="width: 95%;" align="center" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td width="8" height="11" bgcolor="#ffffff"><img src="images/ccbackground/HLEFT.jpg" alt=""/></td>
            <td bgcolor="#ffffff" background="images/ccbackground/TOPbg.jpg"><img src="images/ccbackground/TOPbg.jpg" alt=""/></td>
            <td width="8" height="11" bgcolor="#ffffff"><img src="images/ccbackground/HRIGHT.jpg" alt=""/></td>
        </tr>
        <tr>
            <td width="8" background="images/ccbackground/LEFTbg.jpg"><img src="images/ccbackground/LEFTbg.jpg" alt=""/></td>        
            <td align="center" height="800" valign="top" bgcolor="white" >
            <div>
                <asp:Label ID="lblTopHeading" runat="server" Font-Bold="true"  Font-Size="X-Large" Text="<%$Resources:share,lblTopHeading %>" EnableViewState="false"></asp:Label>
            </div>
            <!-- -------------------------->
            <!-- begin main page content --> 
            <!-- -------------------------->
            <asp:UpdatePanel ID="tryUP" runat="server">
                <ContentTemplate>
                    <table width="100%" align="center" style="font-size:14px; font-family:Verdana,Arial;">
                        <tr align="center">
                            <td align="center" >
                                <br />
                                <ucBanner:Banner ID="bannerStrip" runat="server"></ucBanner:Banner>
                                <asp:LinkButton ID="LinkButton1" Text="English" Visible="false" runat="server" onclick="LinkButton1_Click"></asp:LinkButton><br />
                                <asp:Label ID="Label22" runat="server" Font-Size="Small" Text="<%$Resources:share,lblpartstatement %>" EnableViewState="false"></asp:Label>
                                <br />           
                                <asp:LinkButton ID="LinkButton2" Text="<%$Resources:share,lblPartsList %>" Visible="true" runat="server" ></asp:LinkButton>  
                                <br />
                            </td>
                        </tr>
                        <tr>
                            <td style="font-size:10px; padding-left:130px;">
                                <asp:Label ID="lblInitialHeading" runat="server" Font-Bold="true" Text="" EnableViewState="false"></asp:Label>
                            </td>
                            <td align="center" valign="top">
                                <asp:Label ID="Label1" runat="server" Font-Bold="true" Font-Size="Large" Text=""></asp:Label>
                            </td>
                        </tr>

                        <tr align="center">
                            <td align="center">
                                <div id="Div1" class="example1" runat="server" visible="true" >
                                    <a href="javascript:window.close();" style="color:Red; float:right">
                                        <span>
                                            <asp:Label ID="lblClose" Font-Names="Verdana" Font-Size="Medium" runat="server" Text="<%$ Resources:share,lblClose %>"></asp:Label>
                                        </span>
                                    </a>
                                </div>
                            </td>
                         </tr>

                        <tr align="center">
                            <td align="center" valign="top" style="font-size:16px; font-family:Verdana,Tahoma; font-weight:bold">
                                <div id="divButtons" runat="server" visible="true" >
                                    <asp:Label ID="lblPAtypeheading" runat="server"  Font-Names="Verdana" Text="<%$ Resources:share,lblPAtypeheading %>"></asp:Label>&nbsp;<asp:Label ID="lblPAtype" Font-Names="Verdana"  runat="server" Font-Underline="true" Text=""></asp:Label>
                                </div>
                            </td>
                        </tr>                    
                    </table>


                   <br />
                   <div id="divPAnotrequired" runat="server" visible="false">
                        <asp:Label ID="lblNotRequired" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblPANotRequired %>" EnableViewState="false"></asp:Label>
                        <br />
                   </div>

                <div id="divRADnotrequired" runat="server" visible="false">
                    <asp:Label ID="Label5" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblRADNotRequired %>" EnableViewState="false"></asp:Label>
                    <br />
                </div>

                <div id="divCHMSLnotrequired" runat="server" visible="false">
                    <asp:Label ID="Label7" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblCHMSLNotRequired %>" EnableViewState="false"></asp:Label>
                    <br />
                </div>

                <div id="divTaurusRearLampNotRequired" runat="server" visible="false">
                    <asp:Label ID="Label11" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblTaurusRearLampNotRequired %>" EnableViewState="false"></asp:Label>
                    <br />
                </div>

                <div id="divRangerChatterNotRequired" runat="server" visible="false">
                    <asp:Label ID="Label15" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblRangerChatterNotRequired %>" EnableViewState="false"></asp:Label>
                    <br />
                </div>

           <div id="divFlexSqueakNotRequired" runat="server" visible="false">
                <asp:Label ID="Label16" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblFlexSqueakNotRequired %>" EnableViewState="false"></asp:Label>
                <br />
           </div>
           <div id="divEscapeNoiseNotRequired" runat="server" visible="false">
                <asp:Label ID="Label17" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblEscapeNoiseNotRequired %>" EnableViewState="false"></asp:Label>
                <br />
            </div>
           <div id="divFiestaGlassNotRequired" runat="server" visible="false">
                <asp:Label ID="Label18" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblFiestaGlassNotRequired %>" EnableViewState="false"></asp:Label>
                <br />
           </div>
            <div id="divScratchesNotRequired" runat="server" visible="false">
                <asp:Label ID="Label20" runat="server" Font-Names="Verdana" Text="<%$Resources:share,lblScratchesNotRequired %>" EnableViewState="false"></asp:Label>
                <br />
           </div>
           <div id="divCostCap" runat="server" visible="false">
                <asp:Label ID="lblCostCap" runat="server" Font-Size="Medium" Font-Names="Verdana"  ForeColor="IndianRed" Font-Bold="true" Text="<%$Resources:share,lblCostCap %>" EnableViewState="false"></asp:Label>

                 <div id="closeButtonDiv" class="closeButton" runat="server" visible="true" >
                 </div>
           </div>

            <div id="divRadMileage" runat="server" visible="false">

                <div class="medBlueRow" style="width:700px; height:2px;"></div>

                <table width="90%" align="center" style="font-size:14px; font-family:Verdana,Arial;">
                    <tr>
                        <td style="font-size:16px; font-family:Verdana,Tahoma; font-weight:bold">
                            <asp:Label ID="Label4" runat="server" Font-Names="Verdana"  Text="<%$Resources:share,lblRadMileage %>" EnableViewState="false"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" style="font-size:12px; font-family:Verdana,Tahoma; font-weight:bold" height="125" valign="middle">                        
                            <asp:RadioButtonList ID="RadioButtonList1" runat="server" OnSelectedIndexChanged="btnIndexchange_Click" AutoPostBack="True">
                                <asp:ListItem Text="<%$Resources:share,lblYes %>" Value="yes"></asp:ListItem>
                                <asp:ListItem Text="<%$Resources:share,lblNo %>" Value="no"></asp:ListItem>
                            </asp:RadioButtonList>             
                            <br />                       
                            &nbsp;<asp:Button ID="Button1" runat="server" Visible="false" Text="<%$Resources:share,btnDslParts %>" />
                            <br /><br />
                        </td>
                    </tr>
                </table>

            </div>

            <div id="divCHMSL" runat="server" visible="false">

                <table width="90%" align="center" style="font-size:14px; font-family:Verdana,Arial;">
                    <tr>
                        <td style="font-size:16px; font-family:Verdana,Tahoma; font-weight:bold">
                            <asp:Label ID="Label6" runat="server" Font-Names="Verdana"  Text="<%$Resources:share,lblCHMSL %>" EnableViewState="false"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" style="font-size:12px; font-family:Verdana,Tahoma; font-weight:bold" valign="middle">

                            <asp:RadioButtonList ID="RadioButtonList2" runat="server"  OnSelectedIndexChanged="btnIndexchangeCHMSL_Click" AutoPostBack="True">
                                <asp:ListItem Text="<%$Resources:share,lblCHMSLYes %>" Value="yes"></asp:ListItem>
                                <asp:ListItem Text="<%$Resources:share,lblCHMSLNo %>" Value="no"></asp:ListItem>
                            </asp:RadioButtonList>             
4

1 回答 1

0

找到解决方案:找到问题。

表单正在执行请求。表单,并且所有值都返回 NULL。

我只是把它改成formfield.valuerequest.form("FormField")

这解决了这个问题。

对于最初的问题是什么,我们很抱歉。

于 2012-08-22T12:32:40.787 回答