I have a datepicker in grid edit form for passport issue date and expiry date.If database has null date feilds then grid is displaying the mindate. but we can't give min date for passport because it is not mandatory. Grid should not display any value if the value in database is null. please help me.
I have attached Screenshot and pasting my code here. there is no .cs code.. its only in aspx.
Thankyou.
<%@ Page Language="C#" MasterPageFile="~/sample.Master" AutoEventWireup="true" CodeBehind="EmployeeList.aspx.cs" Inherits="MenloHRMS.Views.EmployeeList" %> <%--<%@ Register Assembly="BasicFrame.WebControls.BasicDatePicker" Namespace="BasicFrame.WebControls" TagPrefix="BDP" %>--%> <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> <asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentPlaceHolder1"> <br /> <br /> <style type="text/css"> .MyImageButton { cursor: hand; } .EditFormHeader td { font-size: 14px; padding: 4px !important; color: #0066cc; } </style> <script type="text/javascript" language="javascript"> function AllowNumeric() { // Get the ASCII value of the key that the user entered var key =window.event.keyCode; // Verify if the key entered was a numeric character (0-9) or a decimal (.) if ( (key > 47 && key < 58) || key == 46 ) // If it was, then allow the entry to continue return; else // If it was not, then dispose the key and continue with entry window.event.returnValue = null; } </script> <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="rgEmployeeLst"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="rgEmployeeLst" /> <telerik:AjaxUpdatedControl ControlID="RadInputManager1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadGrid ID="rgEmployeeLst" runat="server" GridLines="None" Skin="Black" DataSourceID="dsEmployees" AllowAutomaticDeletes="True" AllowSorting="false" AllowAutomaticUpdates="True" AutoGenerateColumns="False"> <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"> </HeaderContextMenu> <MasterTableView DataSourceID="dsEmployees" AllowPaging="true" PageSize="10" DataKeyNames="EmpId"> <EditFormSettings EditFormType="Template"> <EditColumn UniqueName="EditCommandColumn1"> </EditColumn> <FormTemplate> <table cellspacing="2" cellpadding="1" width="100%" border="0"> <tr> <td class="lblCaption" align="right"> FirstName<span class="MandatoryField">*</span>: </td> <td> <asp:TextBox Width="200px" ID="txtFName" runat="server" Text='<%# Bind("FName") %>'></asp:TextBox> </td> <td class="lblCaption" align="right"> Last Name<span class="MandatoryField">*</span>: </td> <td> <asp:TextBox ID="txtLName" runat="server" Width="200px" MaxLength="30" Text='<%# Bind("LName") %>'></asp:TextBox> </td> </tr> <tr> <td align="right" class="lblCaption"> Role<span class="MandatoryField">*</span>: </td> <td> <telerik:RadComboBox ID="cmbRole" Width="205px" runat="server" DataSourceID="DsRoles" SelectedValue='<%# Bind("RoleID") %>' DataTextField="Role" DataValueField="RoleId"> </telerik:RadComboBox> </td> <td align="right" class="lblCaption"> Department<span class="MandatoryField">*</span>: </td> <td> <telerik:RadComboBox ID="cmbDept" Width="205px" runat="server" DataSourceID="DSDepts" DataTextField="DeptName" DataValueField="DeptID" SelectedValue='<%# Bind("DeptID") %>'> </telerik:RadComboBox> </td> </tr> <tr> <td align="right" class="lblCaption"> Date Of Birth<span class="MandatoryField">*</span>: </td> <td> <%--<BDP:BasicDatePicker ID="dtpkrDOB" runat="server" Width="200px" SelectedDate='<%# Bind("DOB") %>'> </BDP:BasicDatePicker>--%> <telerik:RadDatePicker ID="dtpkrDOB" runat="server" Width="230px" ValidationGroup="Validate" ShowPopupOnFocus="True" SelectedDate='<%# Bind("DOB") %>'> <Calendar ID="Calendar1" UseColumnHeadersAsSelectors="False" runat="server" UseRowHeadersAsSelectors="False" ViewSelectorText="x"> </Calendar> <DatePopupButton HoverImageUrl="" ImageUrl="" /> <DateInput ID="DateInput1" DateFormat="M/d/yyyy" runat="server"> </DateInput> </telerik:RadDatePicker> <asp:RequiredFieldValidator ID="RFVDOB" runat="server" ControlToValidate="dtpkrDOB" ErrorMessage="*" ToolTip="Enter DateOfBirth"></asp:RequiredFieldValidator> </td> <td align="right" class="lblCaption"> Date Of Joining<span class="MandatoryField">*</span>: </td> <td> <%--<BDP:BasicDatePicker ID="dtpkrDOJ" runat="server" Width="200px" SelectedDate='<%# Bind("DOJ") %>'> </BDP:BasicDatePicker>--%> <telerik:RadDatePicker ID="dtpkrDOJ" runat="server" Width="230px" ValidationGroup="Validate" ShowPopupOnFocus="True" SelectedDate='<%# Bind("DOJ") %>'> <Calendar ID="Calendar2" UseColumnHeadersAsSelectors="False" runat="server" UseRowHeadersAsSelectors="False" ViewSelectorText="x"> </Calendar> <DatePopupButton HoverImageUrl="" ImageUrl="" /> <DateInput ID="DateInput2" DateFormat="M/d/yyyy" runat="server" DisplayDateFormat="M/d/yyyy"> </DateInput> </telerik:RadDatePicker> <asp:RequiredFieldValidator ID="RFVDOJ" runat="server" ControlToValidate="dtpkrDOJ" ErrorMessage="*" ToolTip="Enter DateOfJoining"></asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right" class="lblCaption"> Address<span class="MandatoryField">*</span>: </td> <td> <asp:TextBox ID="txtAddress" runat="server" Width="200px" TextMode="MultiLine" Text='<%# Bind("Address") %>'></asp:TextBox> </td> <td align="right" class="lblCaption"> Phone(Res): </td> <td> <asp:TextBox ID="txtResi" runat="server" Width="200px" MaxLength="10" Text='<%# Bind("Phone_Resi") %>' onkeypress="AllowNumeric()"> </asp:TextBox> </td> </tr> <tr> <td align="right" class="lblCaption"> Phone(Mobile)<span class="MandatoryField">*</span>: </td> <td> <asp:TextBox ID="txtMobile" runat="server" Width="200px" MaxLength="10" Text='<%# Bind("Phone_Mobile") %>' onkeypress="AllowNumeric()"> </asp:TextBox> </td> <td align="right" class="lblCaption"> PANCard: </td> <td> <telerik:RadTextBox ID="txtPanCard" runat="server" Width="200px" Text='<%# Bind("PAN") %>'> </telerik:RadTextBox> </td> </tr> <tr> <td align="right" class="lblCaption"> PassportNo: </td> <td> <telerik:RadTextBox ID="txtPassport" runat="server" Width="200px" Text='<%# Bind("PassportNo") %>'> </telerik:RadTextBox> </td> <td class="lblCaption" align="right"> Passport Issue Date: </td> <td> <%--<BDP:BasicDatePicker ID="dtpkrPasprtIssue" runat="server" Width="200px" SelectedDate='<%# Bind("Passport_IssuedOn") %>'> </BDP:BasicDatePicker>--%> <telerik:RadDatePicker ID="dtpkrPasprtIssue" runat="server" Width="230px" ShowPopupOnFocus="True" SelectedDate='<%#DataBinder.Eval(Container.DataItem,"Passport_IssuedOn") %>'> <Calendar ID="Calendar3" UseColumnHeadersAsSelectors="False" runat="server" UseRowHeadersAsSelectors="False" ViewSelectorText="x"> </Calendar> <DatePopupButton HoverImageUrl="" ImageUrl="" /> <DateInput ID="DateInput3" DateFormat="M/d/yyyy" runat="server" DisplayDateFormat="M/d/yyyy"> </DateInput> </telerik:RadDatePicker> </td> </tr> <tr> <td class="lblCaption" align="right"> Passport Expiry Date: </td> <td> <%--<BDP:BasicDatePicker ID="dtpkrPasprtExp" runat="server" Width="200px" SelectedDate='<%# Bind("Passport_Exp") %>'> </BDP:BasicDatePicker>--%> <telerik:RadDatePicker ID="dtpkrPasprtExp" runat="server" Width="230px" ShowPopupOnFocus="True" SelectedDate='<%#DataBinder.Eval(Container.DataItem,"Passport_Exp") %>'> <Calendar ID="Calendar4" UseColumnHeadersAsSelectors="False" runat="server" UseRowHeadersAsSelectors="False" ViewSelectorText="x"> </Calendar> <DatePopupButton HoverImageUrl="" ImageUrl="" /> <DateInput ID="DateInput4" DateFormat="M/d/yyyy" runat="server" DisplayDateFormat="M/d/yyyy"> </DateInput> </telerik:RadDatePicker> </td> <td class="lblCaption" align="right"> Email: </td> <td> <telerik:RadTextBox ID="txtEmail" runat="server" Width="200px" Text='<%# Bind("EmailId") %>'> </telerik:RadTextBox> </td> </tr> <tr> <td align="right" colspan="4"> <table> <tr> <td> <telerik:RadButton ID="btnUpdate" Text="Update" ValidationGroup="Validate" runat="server" Skin="Black" CommandName="Update" OnClientClicked=""> </telerik:RadButton> <telerik:RadButton ID="btnCancel" Text="Cancel" runat="server" Skin="Black" CommandName="Cancel"> </telerik:RadButton> </td> </tr> </table> </td> </tr> </table> </FormTemplate> </EditFormSettings> <CommandItemSettings ShowExportToExcelButton="true" /> <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../../Images/Edit_Icon.jpeg" UniqueName="EditCommandColumn"> </telerik:GridEditCommandColumn> <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> </telerik:GridButtonColumn> <telerik:GridBoundColumn DataField="EmpId" FilterControlAltText="Filter EmpId column" HeaderText="EmpId" SortExpression="EmpId" UniqueName="EmpId" Visible="false" ReadOnly="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="FName" FilterControlAltText="Filter FName column" HeaderText="First Name" SortExpression="FName" UniqueName="FName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="LName" FilterControlAltText="Filter LName column" HeaderText="Last Name" SortExpression="LName" UniqueName="LName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Role" FilterControlAltText="Filter Role column" HeaderText="Role" SortExpression="Role" UniqueName="Role"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Department" FilterControlAltText="Filter Department column" HeaderText="Department" SortExpression="Department" UniqueName="Department"> </telerik:GridBoundColumn> <telerik:GridDateTimeColumn DataField="DOB" DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy}" FilterControlAltText="Filter DOB column" HeaderText="DOB" SortExpression="DOB" UniqueName="DOB"> </telerik:GridDateTimeColumn> <telerik:GridDateTimeColumn DataField="DOJ" FilterControlAltText="Filter DOJ column" DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy}" HeaderText="DOJ" SortExpression="DOJ" UniqueName="DOJ"> </telerik:GridDateTimeColumn> <telerik:GridBoundColumn DataField="Address" FilterControlAltText="Filter Address column" HeaderText="Address" SortExpression="Address" UniqueName="Address"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="EmailId" FilterControlAltText="Filter EmailId column" HeaderText="EmailId" SortExpression="EmailId" UniqueName="EmailId"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Phone_Resi" FilterControlAltText="Filter Phone_Resi column" HeaderText="Residence" SortExpression="Phone_Resi" UniqueName="Phone_Resi"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Phone_Mobile" FilterControlAltText="Filter Phone_Mobile column" HeaderText="Mobile" SortExpression="Phone_Mobile" UniqueName="Phone_Mobile"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="PAN" FilterControlAltText="Filter PAN column" HeaderText="PAN" SortExpression="PAN" UniqueName="PAN"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="PassportNo" FilterControlAltText="Filter PassportNo column" HeaderText="PassportNo" SortExpression="PassportNo" UniqueName="PassportNo"> </telerik:GridBoundColumn> <telerik:GridDateTimeColumn DataField="Passport_IssuedOn" DataType="System.DateTime" HtmlEncode="false" DataFormatString="{0:MM/dd/yyyy}" FilterControlAltText="Filter Passport_IssuedOn column" HeaderText="Passport IssuedOn" SortExpression="Passport_IssuedOn" UniqueName="Passport_IssuedOn"> </telerik:GridDateTimeColumn> <telerik:GridDateTimeColumn DataField="Passport_Exp" DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy}" FilterControlAltText="Filter Passport_Exp column" HeaderText="Passport Expiry" SortExpression="Passport_Exp" UniqueName="Passport_Exp" HtmlEncode="false"> </telerik:GridDateTimeColumn> </Columns> </MasterTableView> <ClientSettings EnableRowHoverStyle="true"> <Selecting AllowRowSelect="True" /> </ClientSettings> <FilterMenu EnableImageSprites="False"> </FilterMenu> <PagerStyle Mode="NumericPages" /> </telerik:RadGrid> <telerik:RadInputManager runat="server" ID="RadInputManager1" Enabled="true"> <telerik:TextBoxSetting BehaviorID="TextBoxSetting1" Validation-IsRequired="true" EmptyMessage="Enter Value" ErrorMessage="Enter FirstName"> <TargetControls> <telerik:TargetInput ControlID="txtFName" Enabled="true" /> </TargetControls> </telerik:TextBoxSetting> <telerik:TextBoxSetting BehaviorID="TextBoxSetting2" Validation-IsRequired="true" EmptyMessage="Enter Value" ErrorMessage="Enter LastName" Validation-ValidationGroup="Validate"> <TargetControls> <telerik:TargetInput ControlID="txtLName" Enabled="true" /> </TargetControls> </telerik:TextBoxSetting> <telerik:TextBoxSetting BehaviorID="TextBoxSetting3" Validation-IsRequired="true" EmptyMessage="Enter Value" ErrorMessage="Enter Role"> <TargetControls> <telerik:TargetInput ControlID="cmbRole" Enabled="true" /> </TargetControls> </telerik:TextBoxSetting> <telerik:TextBoxSetting BehaviorID="TextBoxSetting6" Validation-IsRequired="true" EmptyMessage="Enter Value" ErrorMessage="Enter Department"> <TargetControls> <telerik:TargetInput ControlID="cmbDept" Enabled="true" /> </TargetControls> </telerik:TextBoxSetting> <telerik:DateInputSetting BehaviorID="datePkrSettings1" DisplayDateFormat="M/d/yyyy" MinDate="1950-01-01" MaxDate="01-01-1999" Validation-IsRequired="true" ErrorMessage="Enter Valid Date"> <TargetControls> <telerik:TargetInput ControlID="dtpkrDOB" Enabled="true" /> </TargetControls> </telerik:DateInputSetting> <telerik:DateInputSetting BehaviorID="datePkrSettings2" DisplayDateFormat="M/d/yyyy" MinDate="1998-01-01" Validation-IsRequired="true" ErrorMessage="Enter Valid Date"> <TargetControls> <telerik:TargetInput ControlID="dtpkrDOJ" Enabled="true" /> </TargetControls> </telerik:DateInputSetting> <telerik:TextBoxSetting BehaviorID="TextBoxSetting4" Validation-IsRequired="true" ErrorMessage="Enter Address"> <TargetControls> <telerik:TargetInput ControlID="txtAddress" Enabled="true" /> </TargetControls> </telerik:TextBoxSetting> <telerik:TextBoxSetting BehaviorID="TextBoxSetting5" Validation-IsRequired="true" ErrorMessage="Enter MobileNo"> <TargetControls> <telerik:TargetInput ControlID="txtMobile" Enabled="true" /> </TargetControls> </telerik:TextBoxSetting> </telerik:RadInputManager> <asp:SqlDataSource ID="test" runat="server" ConnectionString="<%$ ConnectionStrings:MenloConnection %>" SelectCommand="select * from Employees emp join roles r on emp.role=r.roleid join departments d on emp.department=d.deptId" UpdateCommand="UPDATE [Employees] SET [FName] = @FName, [LName] = @LName, [Role] = @RoleID, [Department] = @DeptID,[DOB]=@DOB, [DOJ] = @DOJ, [Address] = @Address, [EmailId] = @EmailId,[Phone_Resi] = @Phone_Resi, [Phone_Mobile] = @Phone_Mobile,[PAN]=@PAN,[PassportNo]=@PassportNo,[Passport_Exp]=@Passport_Exp,[Passport_IssuedOn]=@Passport_IssuedOn WHERE [EmpId] = @EmpId"> <UpdateParameters> <asp:Parameter Name="FName" Type="String" /> <asp:Parameter Name="LName" Type="String" /> <asp:Parameter Name="RoleID" Type="Int32" /> <asp:Parameter Name="DeptID" Type="Int32" /> <asp:Parameter Name="DOB" Type="DateTime" /> <asp:Parameter Name="DOJ" Type="DateTime" /> <asp:Parameter Name="Address" Type="String" /> <asp:Parameter Name="EmailId" Type="String" /> <asp:Parameter Name="Phone_Resi" Type="String" /> <asp:Parameter Name="Phone_Mobile" Type="String" /> <asp:Parameter Name="PAN" Type="String" /> <asp:Parameter Name="PassportNo" Type="String" /> <asp:Parameter Name="Passport_Exp" Type="DateTime" /> <asp:Parameter Name="Passport_IssuedOn" Type="DateTime" /> <asp:Parameter Name="EmpId" Type="Int32" /> </UpdateParameters> </asp:SqlDataSource> <asp:ObjectDataSource ID="dsEmployees" runat="server" SelectMethod="GetEmployees1" TypeName="MenloHRMS.Core.BLL.PageData.Employee.clsEmployee" UpdateMethod="UpdateEmployeeDetails" DeleteMethod="DeleteEmployee"> <UpdateParameters> <asp:Parameter Name="EmpId" Type="Int32" /> <asp:Parameter Name="FName" Type="String" /> <asp:Parameter Name="LName" Type="String" /> <asp:Parameter Name="RoleID" Type="Int32" /> <asp:Parameter Name="DeptID" Type="Int32" /> <asp:Parameter Name="DOB" Type="DateTime" /> <asp:Parameter Name="DOJ" Type="DateTime" /> <asp:Parameter Name="Address" Type="String" /> <asp:Parameter Name="EmailId" Type="String" /> <asp:Parameter Name="Phone_Resi" Type="String" /> <asp:Parameter Name="Phone_Mobile" Type="String" /> <asp:Parameter Name="PAN" Type="String" /> <asp:Parameter Name="PassportNo" Type="String" /> <asp:Parameter Name="Passport_Exp" Type="DateTime" /> <asp:Parameter Name="Passport_IssuedOn" Type="DateTime" /> </UpdateParameters> <DeleteParameters> <asp:Parameter Name="EmpId" Type="Int32" /> </DeleteParameters> </asp:ObjectDataSource> <asp:ObjectDataSource ID="DSDepts" runat="server" SelectMethod="GetDepts" TypeName="MenloHRMS.Core.BLL.PageData.Employee.clsEmployee"> </asp:ObjectDataSource> <asp:ObjectDataSource ID="DsRoles" runat="server" SelectMethod="GetRoles" TypeName="MenloHRMS.Core.BLL.PageData.Employee.clsEmployee"> </asp:ObjectDataSource> </asp:Content>