Get from database
<div runat="server" id="medical_govt_date" visible="false">
<b>4 (b). Date of issue of medical certificate (MM/DD/YYYY)</b><br />
<asp:Label runat="server" ID="lblMedicalCertificateDate" />
</div>
<div>
<br />
<b>9. Number Of Award(s)
</b>
</div>
<div>
<asp:Label runat="server" ID="lblNumberOfAwards"></asp:Label>
</div>
asp.cs
lblNumberOfAwards.Text = dt.Rows[0]["NumberOfAwards"].ToString();
lblMedicalCertificateDate.Text = DateTime.Parse(dt.Rows[0]["MedicalCertificateDate"].ToString()).ToShortDateString();
Update to database
new SqlParameter("MedicalCertificateDate",txtDOIMC.Text == String.Empty?Convert.DBNull:txtDOIMC.Text),
new SqlParameter("NumberOfAwards",txtNumberOfAwards.Text),
new DataAccess().Write("proc_transfer_request", param);
Response.Redirect("transfer_request_preview.aspx?FMSID=" + FMSID);
aspx
<div>
<ajaxToolkit:NumericUpDownExtender runat="server" Maximum="10" Minimum="1" TargetControlID="txtNumberOfAwards" Width="200" />
<asp:TextBox ID="txtNumberOfAwards" runat="server" CssClass="form-control" MaxLength="2" Text="0"></asp:TextBox>
<asp:RangeValidator runat="server" ControlToValidate="txtNumberOfAwards" ErrorMessage="Enter number between 0 to 10" Type="Integer" MinimumValue="0" MaximumValue="10" ForeColor="Red" ValidationGroup="transfer_request" SetFocusOnError="true"></asp:RangeValidator>
</div>
<div runat="server" id="medical_govt_date" visible="false">
<div>
<span class="h4">4. (b)</span> <span class="text-danger h3">*</span>
<b>Date of Issue of Medical Certificate (MM/DD/YYYY)</b></div>
<div>
   <asp:TextBox runat="server" ID="txtDOIMC" ClientIDMode="Static" MaxLength="10" CssClass="form-control"
placeholder="eg. 02/30/1978"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtDOIMC"
CssClass="text-danger" Display="Dynamic" ErrorMessage="Can't leave blank." SetFocusOnError="True"
ValidationGroup="transfer_request"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regcheckdate" runat="server" ControlToValidate="txtDOIMC"
Display="Dynamic" ErrorMessage="Invalid Date Format" SetFocusOnError="True" ValidationGroup="transfer_request"
CssClass="text-danger" ValidationExpression="^(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$"></asp:RegularExpressionValidator>
</div>
</div>
No comments:
Post a Comment