Click here to Skip to main content
14,733,542 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
datepicker in gridview boundfield column
Posted
Comments
Krunal Rohit 10-Mar-14 5:01am
   
OKAY.!!

-KR
DipsMak 10-Mar-14 8:43am
   
you are asking solution like Tea..:)

1 solution

Hi,
You need to add templete field in your grid view to do this. like
and include jquery liabrary:
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
 <script src="//code.jquery.com/jquery-1.9.1.js"></script>
 <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
 <link rel="stylesheet" href="/resources/demos/style.css">



<script type="text/javascript">
        $(document).ready(function () {
            $(".myDatePickerClass").datepicker({
                dateFormat: "dd/mm/yy",
                changeMonth: true,
                changeYear: true
            });
        }
    </script>


<asp:TemplateField HeaderText="Date" HeaderStyle-Width="10%" ControlStyle-Width="100%">
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtpaperdate1" runat="server" Text='<%#Bind("paperdate","{0:d}")%>'
                                         ToolTip="DD/MM/YYYY" DataFormatString="{0:d}" CssClass="myDatePickerClass input-sm"
                                        placeholder="DD/MM/YYYY"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RFVtxtpaperdate1" runat="server" ValidationGroup="updatevalidate"
                                        ControlToValidate="txtpaperdate1" Display="Dynamic" ForeColor="Red" ErrorMessage="Required"></asp:RequiredFieldValidator>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblpaperdate" runat="server" Text='<%#Bind("paperdate","{0:d}")%>'
                                        ToolTip="DD/MM/YYYY" DataFormatString="{0:d}"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
   
v4

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