how to remov mention error..
Dear Sir,
please help to remove mention error..
Server Error in '/' Application.
Error converting data type varchar to numeric.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Error converting data type varchar to numeric.
Source Error:
Line 59: //DateTime dt_of_prchs = DateTime.ParseExact(txt_dt_of_prchs.Text, "MM/dd/yyyy", null);
Line 60: con.Open();
Line 61: cmd.ExecuteNonQuery();
Line 62:
Line 63: con.Close();
|
Source File: d:\NewIntranet-ATSPL\cni\cni\hm.aspx.cs Line: 61
Stack Trace:
[SqlException (0x80131904): Error converting data type varchar to numeric.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +2585494
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6038654
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +297
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4477
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) +262
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +2698
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +1611
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +390
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +297
cni.hm.btn_save_Click(Object sender, EventArgs e) in d:\NewIntranet-ATSPL\cni\cni\hm.aspx.cs:61
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9796650
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +211
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1696
|
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4494.0
.aspx
<%@ Page Language="C#" AutoEventWireup="true" Codefile="hm.aspx.cs" Inherits="cni.hm" %>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="js/jquery-ui.min.js"></script>
<link href="js/jquery-ui.min.css" rel="stylesheet" />
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 94%;
height: 23px;
}
.auto-style2 {
}
.auto-style3 {
}
.auto-style4 {
}
.auto-style5 {
width: 177px;
text-align: left;
}
.auto-style6 {
width: 290px;
}
.auto-style7 {
text-align: center;
}
body {
font-family: Arial, Helvetica, sans-serif;
}
form {
border: 3px solid #f1f1f1;
}
input[type=text], input[type=password] {
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
text-align: left;
font-weight: 700;
}
button:hover {
opacity: 0.8;
}
.cnbtn {
border-style: none;
border-color: inherit;
border-width: medium;
background-color: #ec3f3f;
color: white;
padding: 14px 20px;
margin: 8px 0;
cursor: pointer;
text-align: center;
}
.lgnbtn {
border-style: none;
border-color: inherit;
border-width: medium;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
cursor: pointer;
text-align: center;
}
.Update {
border-style: none;
border-color: inherit;
border-width: medium;
background-color:gray;
color: white;
padding: 14px 20px;
margin: 8px 0;
cursor: pointer;
text-align: center;
}
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
}
img.avatar {
width: 40%;
border-radius: 50%;
}
.container {
padding: 16px;
}
span.psw {
float: right;
padding-top: 16px;
}
/* Change styles for span and cancel button on extra small screens */
@media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
.cnbtn {
width: 100%;
}
}
.frmalg {
margin: auto;
width: 40%;
}
.auto-style1 {
width: 214px;
font-weight: 700;
}
.auto-style2 {
}
.auto-style3 {
text-align: center;
}
.auto-style8 {
text-align: left;
}
.auto-style62 {
font-weight: 700;
}
.auto-style63 {
color: rgb(0, 102, 153);
}
.auto-style64 {
text-align: left;
color: rgb(0, 102, 153);
}
.auto-style66 {
color: rgb(0, 102, 153);
font-size: small;
}
.auto-style67 {
font-weight: normal;
}
.auto-style68 {
color: rgb(0, 102, 153);
font-size: small;
font-weight: normal;
}
.auto-style69 {
font-weight: bold;
}
.auto-style70 {
text-align: right;
width: 903px;
}
.auto-style71 {
text-align: center;
color: #003366;
text-decoration: underline;
}
.form-control-primary {
font-weight: 700;
}
.auto-style72 {
font-size: small;
}
.auto-style73 {
font-weight: bold;
font-size: small;
}
.auto-style75 {
text-align: left;
font-size: small;
}
</style>
</head>
<body style="height: 671px; width: 1243px; text-align: center;">
<form id="form1" runat="server">
<div>
<table class="auto-style1" border="1">
<tr>
<td class="auto-style2" colspan="10">
<table cellpadding="0" cellspacing="0" style="box-sizing: inherit; margin: 0px auto 0px 0px; padding: 0px; width: 1234px; max-width: 1260px; color: rgb(0, 0, 0); font-family: Roboto; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; height: 28px;">
<tbody style="box-sizing: inherit; margin: 0px; padding: 0px;">
<tr style="box-sizing: inherit; margin: 0px; padding: 0px;">
<td class="auto-style6" style="box-sizing: inherit; margin: 0px; padding: 0px 10px; vertical-align: top;"><a href="http://10.1.246.41/intranet/Default.aspx" style="box-sizing: inherit; margin: 0px; padding: 0px; display: inline-block; text-decoration: none; transition: all 0.3s ease 0s;">
<img alt="munpl-logo" class="auto-style1" src="http://10.1.246.41/intranet/images/munpl-logo.jpg" style="box-sizing: inherit; margin: 0px; padding: 0px; max-width: 100%; width: 87px; height: 89px;" /></a></td>
<td class="auto-style1" style="box-sizing: inherit; margin: 0px; padding: 10px 0px 0px; vertical-align: top; width: 630px; "><span class="project" style="box-sizing: inherit; margin: 0px; padding: 0px 0px 10px; font-weight: 700; font-size: 28px; line-height: 40px; background-repeat: no-repeat; background-size: 100%; background-position: center bottom; display: inline-block; color: rgb(21, 101, 178);">
<div class="auto-style7" style="width: 586px; margin-left: 0px; height: 34px;">
<span id="WCTopBar_lblProjectName" style="box-sizing: inherit; margin: 0px; padding: 0px;">Meja Thermal Power Plant</span></div>
</span>
<div class="auto-style7" style="box-sizing: inherit; margin: 0px 0px 0px 49px; padding: 5px 0px 20px; font-weight: 500; color: rgb(0, 0, 0); font-style: italic; font-size: 15px; min-height: 35px; width: 506px; height: 4px;">
<span id="WCTopBar_lblProjectDescription" style="box-sizing: inherit; margin: 0px; padding: 0px;">A Joint Venture of NTPC Ltd & UPRVUNL</span></div>
<div class="auto-style70">
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" OnClick="LinkButton1_Click">LogOut</asp:LinkButton>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="auto-style64" colspan="3"> </td>
<td class="auto-style71" colspan="4">Material Receipt Register C&I Lab</td>
<td class="auto-style8"> </td>
<td class="auto-style8" colspan="2"> </td>
</tr>
<tr>
<td class="auto-style64" colspan="3"><span id="ContentPlaceHolder1_Label8" style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" class="auto-style63">Emp Code</span><span style="font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none; background-color: rgb(255, 255, 255)" class="auto-style63"> </span><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; " class="auto-style63">: </span>
<span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; " class="auto-style63"> <asp:Label ID="Label1" runat="server" Text="" CssClass="auto-style62"></asp:Label></span></td>
<td class="auto-style8" colspan="2"><span id="ContentPlaceHolder1_Label9" style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" class="auto-style63">Emp Name</span><span style="font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none; background-color: rgb(255, 255, 255)" class="auto-style63"> </span><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; " class="auto-style63">:
<asp:Label ID="Label2" runat="server" CssClass="auto-style42" style="font-size: medium"></asp:Label></span></td>
<td class="auto-style5" colspan="2"><span id="ContentPlaceHolder1_Label11" style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" class="auto-style63">Department</span><span style="font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none; background-color: rgb(255, 255, 255)" class="auto-style63"> </span><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; " class="auto-style63">: </span>
<span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; " class="auto-style63"> <asp:Label ID="Label3" runat="server" Text="" CssClass="auto-style62"></asp:Label></span></td>
<td class="auto-style8"><span id="ContentPlaceHolder1_Label12" style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" class="auto-style63">Designation</span><span style="font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none; background-color: rgb(255, 255, 255)" class="auto-style63"> </span><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; " class="auto-style63">: </span>
<span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; " class="auto-style63"> <asp:Label ID="Label4" runat="server" Text="" CssClass="auto-style62"></asp:Label></span></td>
<td class="auto-style8"><span class="auto-style68"><strong>Grade: </strong></span><span class="auto-style67"><strong><asp:Label ID="Label5" runat="server" Text="" CssClass="auto-style66"></asp:Label></strong></span> :</td>
<td class="auto-style8">Id: <asp:Label ID="Label6" runat="server" Text="" CssClass="auto-style66"></asp:Label></td>
</tr>
<tr>
<td class="auto-style8"><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; color: rgb(255, 0, 0);">
<span id="ContentPlaceHolder1_Label13" style="box-sizing: border-box; color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Material code</span><span style="color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none; background-color: rgb(255, 255, 255)"> </span></span><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; color: rgb(255, 0, 0);"><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; color: rgb(255, 0, 0);">:</span></span></td>
<td class="auto-style3" colspan="3">
<asp:TextBox ID="txt_Mtrl_cd" runat="server" Height="19px" Width="299px" CssClass="auto-style69"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txt_Mtrl_cd" ErrorMessage="!!" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td class="auto-style8" colspan="3"><span id="ContentPlaceHolder1_Label3" style="box-sizing: border-box; color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Description</span><span style="color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none; background-color: rgb(255, 255, 255)"> </span><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; color: rgb(255, 0, 0);">:</span></td>
<td class="auto-style4" colspan="3">
<asp:TextBox ID="txt_dsc" runat="server" Height="19px" Width="299px" CssClass="auto-style69"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txt_dsc" ErrorMessage="!!" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style8"><span id="ContentPlaceHolder1_Label2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Area</span><span style="color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none; background-color: rgb(255, 255, 255)"> </span><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; color: rgb(255, 0, 0);">:</span></td>
<td class="auto-style3" colspan="3">
<asp:DropDownList ID="txt_area" runat="server" Height="25px" Width="299px" CssClass="auto-style69">
<asp:ListItem>TG</asp:ListItem>
<asp:ListItem>SG</asp:ListItem>
<asp:ListItem>Off site</asp:ListItem>
<asp:ListItem>AHP</asp:ListItem>
<asp:ListItem>CCTV</asp:ListItem>
<asp:ListItem>CHP</asp:ListItem>
<asp:ListItem>LAB</asp:ListItem>
<asp:ListItem>Common</asp:ListItem>
<asp:ListItem>FGD</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txt_area" ErrorMessage="!!" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td class="auto-style8" colspan="3"><span id="ContentPlaceHolder1_Label14" style="box-sizing: border-box; color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Type of material<span> </span></span><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; color: rgb(255, 0, 0);">:</span></td>
<td class="auto-style4" colspan="3">
<asp:DropDownList ID="txt_mtrl_typ" runat="server" Height="25px" Width="299px" CssClass="auto-style69">
<asp:ListItem>Spare</asp:ListItem>
<asp:ListItem>Tool</asp:ListItem>
<asp:ListItem>Consumable site</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txt_mtrl_typ" ErrorMessage="!!" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style8" colspan="5"><span id="ContentPlaceHolder1_Label15" style="box-sizing: border-box; color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong>Type of procurement </strong></span><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; color: rgb(255, 0, 0);">:
<asp:DropDownList ID="txt_typ_of_prcrmnt_in_cs_of_deptt_prchs" runat="server"
CssClass="form-control pro-edt-select form-control-primary"
AutoPostBack="true" OnSelectedIndexChanged="DropDownList_Changed" Height="25px" Width="299px">
<asp:ListItem Text="--Select Procurement type--" Value="C" />
<asp:ListItem Text="store" Value="store" />
<asp:ListItem Text="gem" Value="gem" />
<asp:ListItem Text="imprest site" Value="imprest site" />
<asp:ListItem Text="cash" Value="cash" />
<asp:ListItem Text="from site" Value="from site" />
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txt_typ_of_prcrmnt_in_cs_of_deptt_prchs" ErrorMessage="!!" ForeColor="Red" style="font-weight: 700"></asp:RequiredFieldValidator>
</span></td>
<td class="auto-style8" colspan="5"> </td>
</tr>
<tr>
<td class="auto-style75" colspan="2"><span style="color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">
<asp:Label ID="Label7" runat="server" Text="Departmental reg. S.no. & page No." CssClass="auto-style72"></asp:Label></span></td>
<td class="auto-style2" colspan="2">
<asp:TextBox ID="txt_dprtmntl_rg_s_no_page_n" runat="server" Height="19px" Width="299px" CssClass="auto-style73"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txt_dprtmntl_rg_s_no_page_n" ErrorMessage="!!" ForeColor="Red" CssClass="auto-style72"></asp:RequiredFieldValidator>
</td>
<td class="auto-style8" colspan="2"><span id="ContentPlaceHolder1_Label16" style="box-sizing: border-box; color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<asp:Label ID="Label8" runat="server" Text="Vendor name :" CssClass="auto-style72"></asp:Label>
</span></td>
<td class="auto-style3" colspan="4">
<asp:TextBox ID="txt_vndr_nm" runat="server" Height="19px" Width="299px" CssClass="auto-style73"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txt_vndr_nm" ErrorMessage="!!" ForeColor="Red" CssClass="auto-style72"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style75" colspan="2"><span id="Span1" style="box-sizing: border-box; color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<asp:Label ID="Label9" runat="server" Text="Vendor Mob. No. :" CssClass="auto-style72"></asp:Label>
</span></td>
<td class="auto-style2" colspan="2">
<asp:TextBox ID="txt_Vndr_mob_no" runat="server" Height="19px" Width="299px" CssClass="auto-style73"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="txt_Vndr_mob_no" ErrorMessage="!!" ForeColor="Red" CssClass="auto-style72"></asp:RequiredFieldValidator>
</td>
<td class="auto-style8" colspan="2">
<span id="Span2" style="box-sizing: border-box; color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
<asp:Label ID="Label10" runat="server" Text="Amount :" CssClass="auto-style72"></asp:Label> </td>
<td class="auto-style3" colspan="3">
<asp:TextBox ID="txt_amt" runat="server" Height="19px" Width="299px" CssClass="auto-style73"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="txt_amt" ErrorMessage="!!" ForeColor="Red" CssClass="auto-style72"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style8" colspan="2"><asp:Label ID="Label11" runat="server" Text="Purchase By:" CssClass="auto-style72"></asp:Label>
</td>
<td class="auto-style2" colspan="2">
<asp:TextBox ID="txt_purchs_by" runat="server" Height="19px" Width="299px" CssClass="auto-style73"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="txt_purchs_by" ErrorMessage="!!" ForeColor="Red" CssClass="auto-style72"></asp:RequiredFieldValidator>
</td>
<td class="auto-style8" colspan="2"><asp:Label ID="Label12" runat="server" Text="Date of purchase:" CssClass="auto-style72"></asp:Label>
</td>
<td class="auto-style3" colspan="4">
<asp:TextBox ID="txt_dt_of_prchs" runat="server" Height="19px" Width="299px" CssClass="auto-style73"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="txt_dt_of_prchs" ErrorMessage="!!" ForeColor="Red" CssClass="auto-style72"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style8" colspan="10"><span id="ContentPlaceHolder1_Label4" style="box-sizing: border-box; color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong>Remark</strong></span><span style="color: rgb(0, 0, 0); font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none; background-color: rgb(255, 255, 255)"><strong> </strong></span><span style="box-sizing: border-box; font-family: sourcesanspro-regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; color: rgb(255, 0, 0);">:</span>
<asp:TextBox ID="txt_rmk_one" runat="server" Height="16px" Width="702px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="txt_rmk_one" ErrorMessage="!!" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="10">
<asp:Button runat="server" ID="btn_save" CssClass="lgnbtn" Text="Save" OnClick="btn_save_Click" Width="156px" />
<asp:Button runat="server" ID="btn_cancel" Text="Cancel" class="cnbtn" OnClick="btn_cancel_Click" Width="156px" />
<asp:Button runat="server" ID="btn_update" Text="Update" class="Update" OnClick="btn_Update_Click" Width="156px" OnClientClick="Confirm()" />
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr> <td colspan="10">
<asp:GridView ID="GridView1"
HeaderStyle-BackColor="#99ccff"
HeaderStyle-ForeColor="black"
DataKeyNames="Id"
runat="server" Font-Size="Medium" AutoGenerateColumns="False"
HeaderStyle-Font-Size="17px"
OnRowCommand="GridView1_RowCommand"
EmptyDataText="There Is No Records In Database!"
Height="122px" Width="1257px"
OnRowDataBound="GridView1_RowDataBound"
CssClass="auto-style7" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" />
<asp:BoundField DataField="Mtrl_cd" HeaderText="Material code" />
<asp:BoundField DataField="dsc" HeaderText="Description" />
<asp:BoundField DataField="area" HeaderText="Area" />
<asp:BoundField DataField="mtrl_typ" HeaderText="Type of material" />
<asp:BoundField DataField="typ_of_prcrmnt_in_cs_of_deptt_prchs" HeaderText="Type of procurement in case of departmental purchase" />
<asp:BoundField DataField="dprtmntl_rg_s_no_page_n" HeaderText="Departmental reg. S.no. & page No." />
<asp:BoundField DataField="vndr_nm" HeaderText="Vendor name" />
<asp:BoundField DataField="Vndr_mob_no" HeaderText="Vendor Mob. No." />
<asp:BoundField DataField="amt" HeaderText="Amount" />
<asp:BoundField DataField="purchs_by" HeaderText="Purchase By" />
<asp:BoundField DataField="dt_of_prchs" HeaderText="Date of purchase" />
<asp:BoundField DataField="rmk_one" HeaderText="Remark" ItemStyle-Width="50px" >
<ItemStyle Width="50px"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<asp:Button ID="Button1" Text="Edit" runat="server" CausesValidation="false" OnClick="View" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<asp:Button ID="Button2" Text="Send" runat="server" CausesValidation="false" CommandName="Mark" OnClientClick="return confirm('Are you sure you want to Send this event?');" OnClick="Mark" CommandArgument="<%# Container.DataItemIndex %>" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="White" ForeColor="#000066" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView>
</td> </tr>
</table>
</div>
</form>
</body>
</html>
<script src="js/jquery-3.4.1.min.js"></script>
<script src="jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
<script>
$(document).ready(function () {
$('#txt_dt_of_prchs').datepicker({
dateFormat: "dd-mm-yy",
changeMonth: true,
changeYear: true,
yearRange: '1950:2050'
});
})
</script>
<script type = "text/javascript">
function Confirm() {
var confirm_value = document.createElement("INPUT");
confirm_value.type = "hidden";
confirm_value.name = "confirm_value";
if (confirm("Do you want to Update data in Material Receipt Register C&I Lab ?")) {
confirm_value.value = "Yes";
} else {
confirm_value.value = "No";
}
document.forms[0].appendChild(confirm_value);
}
</script>
.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace cni
{
public partial class hm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.BindGrid();
}
String EmplooyeId = Session["emp_id"].ToString();
Label1.Text = " " + EmplooyeId + "";
String emp_nm = Session["emp_nm"].ToString();
Label2.Text = "" + emp_nm + " ";
String dept = Session["dept"].ToString();
Label3.Text = "" + dept + " ";
String designation_code = Session["designation_code"].ToString();
Label4.Text = "" + designation_code + " ";
String grd = Session["grd"].ToString();
Label5.Text = "" + grd + " ";
}
protected void btn_cancel_Click(object sender, EventArgs e)
{
txt_Mtrl_cd.Text = "";
txt_dsc.Text = "";
txt_area.Text = "";
txt_mtrl_typ.Text = "";
//txt_typ_of_prcrmnt_in_cs_of_deptt_prchs.Text = "";
txt_dprtmntl_rg_s_no_page_n.Text = "";
txt_vndr_nm.Text = "";
txt_Vndr_mob_no.Text = "";
txt_amt.Text = "";
txt_purchs_by.Text = "";
txt_dt_of_prchs.Text = "";
txt_rmk_one.Text = "";
}
protected void btn_save_Click(object sender, EventArgs e)
{
string cs = System.Configuration.ConfigurationManager.ConnectionStrings["IntranetConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(cs);
SqlCommand cmd = new SqlCommand("INSERT INTO Mtrl_rcpt_rgster_cni_lab (emp_id,Mtrl_cd,dsc,area,mtrl_typ,typ_of_prcrmnt_in_cs_of_deptt_prchs,dprtmntl_rg_s_no_page_n,vndr_nm,Vndr_mob_no,amt,purchs_by,dt_of_prchs,rmk_one)VALUES('" + Label1.Text + "','" + txt_Mtrl_cd.Text + "','" + txt_dsc.Text + "','" + txt_area.Text + "','" + txt_mtrl_typ.Text + "','" + txt_typ_of_prcrmnt_in_cs_of_deptt_prchs.Text + "','" + txt_dprtmntl_rg_s_no_page_n.Text + "','" + txt_vndr_nm.Text + "','" + txt_Vndr_mob_no.Text + "','" + txt_amt.Text + "','" + txt_purchs_by.Text + "','" + txt_dt_of_prchs.Text + "','" + txt_rmk_one.Text + "')", con);
cmd.Parameters.Add("@id", SqlDbType.Int).Direction = ParameterDirection.Output;
//DateTime dt_of_prchs = DateTime.ParseExact(txt_dt_of_prchs.Text, "MM/dd/yyyy", null);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
string message = " Material receipt details have been saved successfully.";
string script = "window.onload = function(){ alert('";
script += message;
script += "');";
script += "window.location = '";
script += Request.Url.AbsoluteUri;
script += "'; }";
ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);
}
private void BindGrid()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IntranetConnectionString"].ConnectionString);
SqlDataAdapter sda = new SqlDataAdapter("SELECT Id, Mtrl_cd, dsc,area,mtrl_typ,typ_of_prcrmnt_in_cs_of_deptt_prchs,dprtmntl_rg_s_no_page_n,vndr_nm,Vndr_mob_no,amt,purchs_by,dt_of_prchs,rmk_one FROM Mtrl_rcpt_rgster_cni_lab WHERE Issbmted='No' ORDER BY Id DESC", con);
DataTable dt = new DataTable();
sda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
for (int i = 0; i > e.Row.Cells.Count; i++)
{
e.Row.Cells[i].CssClass = "columnscss";
}
}
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
// if (e.CommandName == "EditButton")
//{
// int index = Convert.ToInt32(e.CommandArgument);
// GridViewRow row = GridView1.Rows[index];
// Response.Redirect("cgp.aspx?Id=" + row.Cells[0].Text);
//}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("lgn.aspx");
}
protected void View(object sender, EventArgs e)
{
Button btn = (Button)sender;
GridViewRow row = (GridViewRow)btn.NamingContainer;
Label6.Text = row.Cells[0].Text;
txt_Mtrl_cd.Text = row.Cells[1].Text;
txt_dsc.Text = row.Cells[2].Text;
txt_area.Text = row.Cells[3].Text;
txt_mtrl_typ.Text = row.Cells[4].Text;
txt_typ_of_prcrmnt_in_cs_of_deptt_prchs.Text = row.Cells[5].Text;
txt_dprtmntl_rg_s_no_page_n.Text = row.Cells[6].Text;
txt_vndr_nm.Text = row.Cells[7].Text;
txt_Vndr_mob_no.Text = row.Cells[8].Text;
txt_amt.Text = row.Cells[9].Text;
txt_purchs_by.Text = row.Cells[10].Text;
txt_dt_of_prchs.Text = row.Cells[11].Text;
txt_rmk_one.Text = row.Cells[12].Text;
}
protected void btn_Update_Click(object sender, EventArgs e)
{
string constr = ConfigurationManager.ConnectionStrings["IntranetConnectionString"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("UPDATE Mtrl_rcpt_rgster_cni_lab SET Mtrl_cd=@Mtrl_cd,dsc = @dsc,area=@area,mtrl_typ =@mtrl_typ ,typ_of_prcrmnt_in_cs_of_deptt_prchs=@typ_of_prcrmnt_in_cs_of_deptt_prchs,dprtmntl_rg_s_no_page_n=@dprtmntl_rg_s_no_page_n,vndr_nm=@vndr_nm,Vndr_mob_no=@Vndr_mob_no,amt=@amt,purchs_by=@purchs_by,dt_of_prchs=@dt_of_prchs,rmk_one=@rmk_one WHERE Id = @Id"))
{
cmd.Parameters.AddWithValue("@Id", Label6.Text);
cmd.Parameters.AddWithValue("@Mtrl_cd", txt_Mtrl_cd.Text);
cmd.Parameters.AddWithValue("@dsc", txt_dsc.Text);
cmd.Parameters.AddWithValue("@area", txt_area.Text);
cmd.Parameters.AddWithValue("@mtrl_typ", txt_mtrl_typ.Text);
cmd.Parameters.AddWithValue("@typ_of_prcrmnt_in_cs_of_deptt_prchs", txt_typ_of_prcrmnt_in_cs_of_deptt_prchs.Text);
cmd.Parameters.AddWithValue("@dprtmntl_rg_s_no_page_n", txt_dprtmntl_rg_s_no_page_n.Text);
cmd.Parameters.AddWithValue("@vndr_nm", txt_vndr_nm.Text);
cmd.Parameters.AddWithValue("@Vndr_mob_no", txt_Vndr_mob_no.Text);
cmd.Parameters.AddWithValue("@amt", txt_amt.Text);
cmd.Parameters.AddWithValue("@purchs_by", txt_purchs_by.Text);
cmd.Parameters.AddWithValue("@dt_of_prchs", txt_dt_of_prchs.Text);
cmd.Parameters.AddWithValue("@rmk_one", txt_rmk_one.Text);
con.Close();
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
txt_Mtrl_cd.Text = "";
txt_dsc.Text = "";
txt_area.Text = "";
txt_mtrl_typ.Text = "";
// txt_typ_of_prcrmnt_in_cs_of_deptt_prchs.Text = "";
txt_dprtmntl_rg_s_no_page_n.Text = "";
txt_vndr_nm.Text = "";
txt_Vndr_mob_no.Text = "";
txt_amt.Text = "";
txt_purchs_by.Text = "";
txt_dt_of_prchs.Text = "";
Label6.Text = "";
txt_rmk_one.Text = "";
string message = " Material receipt details have been Update successfully.";
string script = "window.onload = function(){ alert('";
script += message;
script += "');";
script += "window.location = '";
script += Request.Url.AbsoluteUri;
script += "'; }";
ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);
}
}
}
protected void Mark(object sender, EventArgs e)
{
GridViewRow row = (sender as Button).NamingContainer as GridViewRow;
int Id = Convert.ToInt32(GridView1.DataKeys[Convert.ToInt32((sender as Button).CommandArgument)].Values[0]);
string Issend = "YES";
string constr = ConfigurationManager.ConnectionStrings["IntranetConnectionString"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("UPDATE Mtrl_rcpt_rgster_cni_lab SET Issend = @Issend WHERE Id = @Id"))
{
cmd.Parameters.AddWithValue("@Id", Id);
cmd.Parameters.AddWithValue("@Issend", Issend);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
GridView1.EditIndex = -1;
row.Visible = false;
}
}
}
protected void DropDownList_Changed(object sender, EventArgs e)
{
if (txt_typ_of_prcrmnt_in_cs_of_deptt_prchs.SelectedItem.Value == "store")
{
txt_dprtmntl_rg_s_no_page_n.Visible = false;
txt_vndr_nm.Visible = false;
txt_Vndr_mob_no.Visible = false;
txt_amt.Visible = false;
txt_purchs_by.Visible = false;
txt_dt_of_prchs.Visible = false;
// txt_rmk_one.Visible = false;
Label7.Visible = false;
Label8.Visible = false;
Label9.Visible = false;
Label10.Visible = false;
Label11.Visible = false;
Label12.Visible = false;
}
else
{
txt_dprtmntl_rg_s_no_page_n.Visible = true;
txt_vndr_nm.Visible = true;
txt_Vndr_mob_no.Visible = true;
txt_amt.Visible = true;
txt_purchs_by.Visible = true;
txt_dt_of_prchs.Visible = true;
// txt_rmk_one.Visible = true;
Label7.Visible = true;
Label8.Visible = true;
Label9.Visible = true;
Label10.Visible = true;
Label11.Visible = true;
Label12.Visible = true;
}
}
}
}
CREATE TABLE [dbo].[Mtrl_rcpt_rgster_cni_lab] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[emp_id] NVARCHAR (10) NULL,
[Mtrl_cd] NCHAR (100) NULL,
[dsc] VARCHAR (500) NULL,
[area] VARCHAR (10) NULL,
[mtrl_typ ] VARCHAR (100) NULL,
[lcn_in_lb] VARCHAR (500) DEFAULT ('na') NULL,
[typ_of_prcrmnt_in_cs_of_deptt_prchs] VARCHAR (500) NULL,
[dprtmntl_rg_s_no_page_n] NCHAR (100) DEFAULT ('na') NULL,
[vndr_nm] VARCHAR (500) DEFAULT ('na') NULL,
[Vndr_mob_no] NCHAR (10) DEFAULT ('na') NULL,
[amt] NUMERIC (18) DEFAULT ('na') NULL,
[purchs_by] VARCHAR (500) DEFAULT ('na') NULL,
[dt_of_prchs] VARCHAR (50) DEFAULT ('na') NULL,
[dt_of_rcpt_in_lb] VARCHAR (50) DEFAULT ('na') NULL,
[qunty] VARCHAR (50) DEFAULT ('na') NULL,
[dpstd_by] VARCHAR (500) DEFAULT ('na') NULL,
[rcvd_by] VARCHAR (500) DEFAULT ('na') NULL,
[rmk_one] VARCHAR (500) DEFAULT ('na') NULL,
[rmk_two] VARCHAR (500) DEFAULT ('na') NULL,
[Issbmted] VARCHAR (3) DEFAULT ('NO') NULL,
[Issend] VARCHAR (3) DEFAULT ('NO') NULL,
[emp_id_tw] NVARCHAR (10) DEFAULT ('na') NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);