Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CustomerMaster.aspx.cs" Inherits="Admin_CustomerMaster" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .auto-style1 {
            text-align: left;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
          <div align ="right">
           <asp:Image ID="Image1" runat="server" Height="39px" ImageUrl="~/gnome-logout-icone-3872-128.png" />
           <asp:Image ID="Back" runat="server" Height="38px" ImageUrl="~/back.png" />
       </div>
       <div id="header" style="background-color: #000000">
     <h1 style="color: #3399FF" align="center">MNT
         <i style="color: #CC3300">Express Cargo</i></h1>
     <h4 style="color: #3399FF" align="center">( A Division Of MNT Transport India Pvt. LTD)
     </div>

    <div align="center" style="font-size: 30px; background-color: #3399FF">
    Customer Master
    </div>
    <div>
    <table align="center" bgcolor="#FF6600">
    <tr align="center">
    <td bgcolor="#999999">Branch Name</td>
    <td class="auto-style1">
        <asp:TextBox ID="BranchName" runat="server" AutoPostBack="True" BorderColor="Black" Width="120px"></asp:TextBox>
        </td>
    <td bgcolor="#999999">BranchCode</td>
    <td>
        <asp:TextBox ID="BranchCode" runat="server" AutoPostBack="True" BorderColor="Black" Width="120px"></asp:TextBox>
        </td>
    <td>
        &nbsp;</td>
    </tr>
    <tr align="center">
    <td bgcolor="#999999">Customer Code</td>
    <td class="auto-style1"><asp:TextBox ID="Customer_Code" runat="server" BorderColor="Black" Height="16px" style="text-align: left" Width="120px" AutoPostBack="True"></asp:TextBox></td>
    <td bgcolor="#999999">Service Tax</td>
    <td><asp:TextBox ID="Service_Tax" runat="server" BorderColor="Black" MaxLength="15" AutoPostBack="True" Width="120px"></asp:TextBox></td>
    <td>
        &nbsp;</td>
    </tr>
    <tr>
    <td bgcolor="#999999">Customer Name</td>
    <td class="auto-style1"><asp:TextBox ID="Customer_Name" runat="server" BorderColor="Black" Width="120px" AutoPostBack="True"></asp:TextBox></td>
    <td bgcolor="#999999">Pan No</td>
    <td><asp:TextBox ID="Pan_No" runat="server" BorderColor="Black" MaxLength="10" AutoPostBack="True" Width="120px"></asp:TextBox></td>
    <td>
        &nbsp;</td>
    </tr>
    <tr>
    <td bgcolor="#999999">Address</td>
    <td class="auto-style1"><asp:TextBox ID="Address" runat="server" BorderColor="Black" Width="120px" AutoPostBack="True"></asp:TextBox></td>
    <td bgcolor="#999999">TIN No</td>
    <td><asp:TextBox ID="TIN_No" runat="server" BorderColor="Black" MaxLength="11" AutoPostBack="True" Width="120px"></asp:TextBox></td>
    <td>
        &nbsp;</td>
    </tr>
    <tr>
    <td bgcolor="#999999">City</td>
    <td class="auto-style1"><asp:TextBox ID="City" runat="server" BorderColor="Black" AutoPostBack="True" Width="120px"></asp:TextBox></td>
    <td bgcolor="#999999">CST No</td>
    <td><asp:TextBox ID="CST_No" runat="server" BorderColor="Black" AutoPostBack="True" Width="120px"></asp:TextBox></td>
    <td>
        &nbsp;</td>
    </tr>
    <tr>
    <td bgcolor="#999999">State</td>
    <td class="auto-style1"><asp:DropDownList ID="State" runat="server" BackColor="#99CCFF" Height="43px"
            Width="149px">
        <asp:ListItem Value="1">Andaman and Nicobar Island</asp:ListItem>
        <asp:ListItem Value="2">Andhra Pradesh</asp:ListItem>
        <asp:ListItem Value="3">Arunachal Pradesh</asp:ListItem>
        <asp:ListItem Value="4">Assam</asp:ListItem>
        <asp:ListItem Value="5">Bihar</asp:ListItem>
        <asp:ListItem Value="6">Chandigarh</asp:ListItem>
        <asp:ListItem Value="7">Chhattishgarh</asp:ListItem>
        <asp:ListItem Value="8">Dadra and Nagar Haveli</asp:ListItem>
        <asp:ListItem Value="9">Daman and Diu</asp:ListItem>
        <asp:ListItem Value="10">Delhi</asp:ListItem>
        <asp:ListItem Value="11">Goa</asp:ListItem>
        <asp:ListItem Value="12">Gujarat</asp:ListItem>
        <asp:ListItem Value="13">Haryana</asp:ListItem>
        <asp:ListItem Value="14">Himanchal Pradesh</asp:ListItem>
        <asp:ListItem Value="15">Jammu and Kashmir</asp:ListItem>
        <asp:ListItem Value="16">Jharkhand</asp:ListItem>
        <asp:ListItem Value="17">Karnataka</asp:ListItem>
        <asp:ListItem Value="18">Kerala</asp:ListItem>
        <asp:ListItem Value="19">Lakshdweep</asp:ListItem>
        <asp:ListItem Value="20">Madhya Pradesh</asp:ListItem>
        <asp:ListItem Value="21">maharashtra</asp:ListItem>
        <asp:ListItem Value="22">Manipur</asp:ListItem>
        <asp:ListItem Value="23">Mizoram</asp:ListItem>
        <asp:ListItem Value="24">Nagaland</asp:ListItem>
        <asp:ListItem Value="25">Odisha</asp:ListItem>
        <asp:ListItem Value="26">Pundicherry</asp:ListItem>
        <asp:ListItem Value="27">Punjab</asp:ListItem>
        <asp:ListItem Value="28">Rajasthan</asp:ListItem>
        <asp:ListItem Value="29">Sikkim</asp:ListItem>
        <asp:ListItem Value="30">Tamil Nadu</asp:ListItem>
        <asp:ListItem Value="31">Telangana</asp:ListItem>
        <asp:ListItem Value="32">Tripura</asp:ListItem>
        <asp:ListItem Value="33">Uttar Pradesh</asp:ListItem>
        <asp:ListItem Value="33">Uttarakhand</asp:ListItem>
        <asp:ListItem Value="35">West Bengal</asp:ListItem>
        </asp:DropDownList></td>
    <td bgcolor="#999999">Country</td>
    <td><asp:TextBox ID="Country" runat="server" BorderColor="Black" AutoPostBack="True" Width="120px">India</asp:TextBox></td>
    <td>
        &nbsp;</td>
    </tr>
    <tr>
    <td bgcolor="#999999">Phone No</td>
    <td class="auto-style1">
        <asp:TextBox ID="Phone_No" runat="server" BorderColor="Black" MaxLength="10" AutoPostBack="True" Width="120px"></asp:TextBox>
        </td>
    <td bgcolor="#999999">Mobile</td>
    <td>
        <asp:TextBox ID="Mobile" runat="server" BorderColor="Black" MaxLength="10" AutoPostBack="True" Width="120px"></asp:TextBox>
        </td>
    <td>
        &nbsp;</td>
    </tr>
    <tr>
    <td bgcolor="#999999">Pin Code</td>
    <td class="auto-style1"><asp:TextBox ID="Pin_Code" runat="server" BorderColor="Black" MaxLength="6" AutoPostBack="True" Width="120px"></asp:TextBox></td>
    <td bgcolor="#999999">Emil-id</td>
    <td><asp:TextBox ID="Emil_id" runat="server" BorderColor="Black" Width="120px" AutoPostBack="True"></asp:TextBox></td>
    <td>
        &nbsp;</td>
    </tr>
    </table>
    </div;asp:Button ID="Button1" runat="server" BackColor="#3399FF" BorderColor="Black"
                   Text="Submit" Width="102px" OnClick="Button1_Click" style="text-align: center" />
           </p>
    </form>

</body>
</html>



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class Admin_CustomerMaster : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["amitpandeyConnectionString"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
con.Open();
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("insert into Customer_Master values('" + BranchName.Text + "','" + BranchCode.Text + "','" + Customer_Code.Text + "','" + Customer_Name.Text + "','" + Address.Text + "','" + City.Text + "','" + State.SelectedItem + "','" + Phone_No.Text + "','" + Pin_Code.Text + "','" + Service_Tax.Text + "','" + Pan_No.Text + "','" + TIN_No.Text + "','" + CST_No.Text + "','" + Country.Text + "','" + Mobile.Text + "','" + Emil_id.Text + "')", con);
cmd.ExecuteNonQuery();
con.Close();
}
}
The problem is that it is working fine when I am trying it on my local machine but when I put it on FTP then it is reloading every time when I click in A text boxes and when I click Submit then It shows me web config error.
Posted
Updated 11-Dec-14 20:05pm
v2
Comments
Member 11111143 12-Dec-14 4:58am    
If Any one can tell me why it is showing me this error

1 solution

Hi,
If u avoid the postback while clicking in text box means u set false an autopostback.then Check the Submit Buttton and Closing Div,It was not properly closed and Opened.please check ur code
 
Share this answer
 
Comments
Member 11111143 12-Dec-14 2:35am    
Now only one problem is there that is when I submit it is showing me wEB Config error. Inside this folder I have may pages but when I submit in any page it is showing me runtime error on all the pages of the folder. The login is sucessfull and the home pages details are working fine .but when I try to save Data on any page it is showing me runtime error
Praveen Kumar Upadhyay 12-Dec-14 2:59am    
Can you mention your error?
Member 11111143 12-Dec-14 3:54am    
Server Error in '/' Application.

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customerrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customerrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customerrors mode="Off">



Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customerrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customerrors mode="RemoteOnly" defaultredirect="mycustompage.htm">


Is there that If I create A folder then There has to be A web config for every folder That I have.
Praveen Kumar Upadhyay 12-Dec-14 5:22am    
set CustomError Off and Write Exception log in Global.ascx->Application_Error
Member 11111143 12-Dec-14 5:56am    
praveen , I have only one line in global.ascx i.e.
<%@ Application Codebehind="Global.asax.cs" Inherits="mnt.Global" Language="C#" %>
where to place customError please do help me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900