Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates 无法单击Detailview页脚模板按钮_Templates_Footer - Fatal编程技术网

Templates 无法单击Detailview页脚模板按钮

Templates 无法单击Detailview页脚模板按钮,templates,footer,Templates,Footer,我有detailsview代码,用于更新单个字段的值。更新按钮,我保留在页脚模板。如果我发布到服务器并通过Url访问,那么页脚模板更新按钮是不可单击的 请建议 霉菌代码: 受保护的void b更新\u单击(对象发送方,事件参数e) { Label lblstatus=(Label)DetailsView1.FindControl(“lblUpdateStatus”); 字符串Vname=DetailsView1.Rows[0]。单元格[1]。文本; TextBox NewQADNo=(T

我有detailsview代码,用于更新单个字段的值。更新按钮,我保留在页脚模板。如果我发布到服务器并通过Url访问,那么页脚模板更新按钮是不可单击的

请建议

霉菌代码:


受保护的void b更新\u单击(对象发送方,事件参数e)
{  
Label lblstatus=(Label)DetailsView1.FindControl(“lblUpdateStatus”);
字符串Vname=DetailsView1.Rows[0]。单元格[1]。文本;
TextBox NewQADNo=(TextBox)DetailsView1.FindControl(“txtbxQADno”);
if(NewQADNo!=null)
{
System.Data.SqlClient.SqlConnection myConnection;
System.Data.SqlClient.SqlCommand myCommand;
使用(myConnection=new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionString[“MaterialsConnectionString”].ConnectionString))
{
string strUpdate=“UPDATE tblvendorMasterRegistration SET qadvendono=“+NewQADNo.Text.Trim()+”其中VendorName=”“+Vname+”;
myCommand=new System.Data.SqlClient.SqlCommand(strUpdate,myConnection);
myConnection.Open();
myCommand.ExecuteOnQuery();
myConnection.Close();
lblstatus.Text=“已成功更新。”;
}
}
}



供应商主管





经过深思熟虑后,我发现风格定位带来了问题。 Detailsview Style=“位置:相对;to Style=“位置:中心

<script runat="server">

protected void BtnUpdate_Click(object sender, EventArgs e)
{  
    Label lblstatus = (Label)DetailsView1.FindControl("lblUpdateStatus");
    string Vname = DetailsView1.Rows[0].Cells[1].Text;
    TextBox NewQADNo = (TextBox)DetailsView1.FindControl("txtbxQADno");

    if (NewQADNo != null)
    {
      System.Data.SqlClient.SqlConnection myConnection;
      System.Data.SqlClient.SqlCommand myCommand;
       using (myConnection = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["MaterialsConnectionString"].ConnectionString))
       {
        string strUpdate = "UPDATE tblVendorMasterRegisteration SET QADVendorNo=" + NewQADNo.Text.Trim() + " Where VendorName ='" + Vname + "'";
        myCommand = new System.Data.SqlClient.SqlCommand(strUpdate, myConnection);
        myConnection.Open();
        myCommand.ExecuteNonQuery();
        myConnection.Close();

        lblstatus.Text ="Updated Successfully.";

        }
    }
    }
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div style="margin-top: 17px">
    &nbsp;<table border="0" cellpadding="0" cellspacing="0" style="width: 98%; position: relative;
        height: 100%">
        <tr>
            <td style="width: 287px; text-align: center">
                <br />
                <span style="font-size: x-large; background-color: activeborder">
                <span style="font-family: 'Cooper Black'">
                <span style="color: #666666; background-color: #FFFFFF">Vendor Master </span>
                <br style="color: #666666; background-color: #FFFFFF" />
                <span style="color: #666666; background-color: #FFFFFF">Display
                    Page</span></span><br style="color: #666666; background-color: #FFFFFF" />
                </span>
                <br />
                <br />
            </td>
            <td>
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
        CellPadding="4" DataKeyNames="Vendorregno" DataSourceID="SqlDataSource1" ForeColor="#333333"
        GridLines="None" Height="50px" Style="position:relative; text-align: left; top: -41px; left: 14px;" 
                    Width="337px" AllowPaging="True"  >
        <FooterStyle BackColor="#D0D0D0" Font-Bold="True" ForeColor="White" />
        <CommandRowStyle BackColor="#C5BBAF" Font-Bold="True" />
        <RowStyle BackColor="#E3EAEB" />
        <FieldHeaderStyle BackColor="#D0D0D0" Font-Bold="True" />
        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <Fields>
            <asp:BoundField DataField="VendorName" HeaderText="VendorName" SortExpression="VendorName" />
            <asp:BoundField DataField="VendorAddress" HeaderText="VendorAddress" SortExpression="VendorAddress" />
            <asp:BoundField DataField="State" HeaderText="State" SortExpression="State" />
            <asp:BoundField DataField="OfficePhone1" HeaderText="OfficePhone1" SortExpression="OfficePhone1" />
            <asp:BoundField DataField="OfficePhone2" HeaderText="OfficePhone2" SortExpression="OfficePhone2" />
            <asp:BoundField DataField="CellNo" HeaderText="CellNo" SortExpression="CellNo" />
            <asp:BoundField DataField="FaxNo" HeaderText="FaxNo" SortExpression="FaxNo" />
            <asp:BoundField DataField="TempVendor" HeaderText="TempVendor" SortExpression="TempVendor" />
            <asp:BoundField DataField="OperatingDiv" HeaderText="OperatingDiv" SortExpression="OperatingDiv" />
            <asp:BoundField DataField="ContactPersonName" HeaderText="ContactPersonName" SortExpression="ContactPersonName" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:BoundField DataField="Currency" HeaderText="Currency" SortExpression="Currency" />
            <asp:BoundField DataField="Freight" HeaderText="Freight" SortExpression="Freight" />
            <asp:BoundField DataField="PANNo" HeaderText="PANNo" SortExpression="PANNo" />
            <asp:BoundField DataField="ServiceTaxNo" HeaderText="ServiceTaxNo" SortExpression="ServiceTaxNo" />
            <asp:BoundField DataField="CSTNo" HeaderText="CSTNo" SortExpression="CSTNo" />
            <asp:BoundField DataField="TinNo" HeaderText="TinNo" SortExpression="TinNo" />
            <asp:BoundField DataField="ApplierID" HeaderText="ApplierID" SortExpression="ApplierID" />
            <asp:BoundField DataField="ApplierName" HeaderText="ApplierName" SortExpression="ApplierName" />
            <asp:BoundField DataField="Vendorregno" HeaderText="Vendorregno" InsertVisible="False"
                ReadOnly="True" SortExpression="Vendorregno" />
            <asp:TemplateField HeaderText="QADVendorNo">
                <ItemTemplate>

                    <asp:TextBox ID="txtbxQADno" Text='<%# Bind("QADVendorNo") %>' runat="server"></asp:TextBox>

                </ItemTemplate>
            </asp:TemplateField>
        </Fields>
        <FooterTemplate>
            <asp:Button ID="BtnUpdate" runat="server" OnClick="BtnUpdate_Click" Text="Update" ViewStateMode="Enabled" />
             <asp:Label ID="lblUpdateStatus" runat="server" ForeColor="#663300" BackColor="#FFFFCC"></asp:Label>
        </FooterTemplate>
        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#7C6F57" />
        <AlternatingRowStyle BackColor="White" />
    </asp:DetailsView>
            </td>
        </tr>
    </table>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MaterialsConnectionString %>"
        SelectCommand="SELECT * FROM [tblVendorMasterRegisteration] WHERE  (MaterialsMgrApprovedDate BETWEEN GETDATE() - 30 AND GETDATE())"></asp:SqlDataSource>
    <br />
    <br />
    <br />
    </div>
</asp:Content>