Hi Amitabha,
Check this example. Now please take its reference and correct your code.
HTML
<asp:DataGrid ID="gridPOD" runat="server" AutoGenerateColumns="false"
class="table table-striped table-bordered" Width="100%">
<Columns>
<asp:TemplateColumn HeaderText="Delivery Date & Time">
<ItemTemplate>
<asp:TextBox ID="txtDlyDate" runat="server" CssClass="form-control"
Text='<%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem,"DLY_DATE")).ToString("dd-MMM-yyyy")%>'>
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" media="screen" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.css" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$.each($('[id*=txtDlyDate]'), function () {
var dlyDate = $(this).val();
$(this).datepicker({
autoclose: true,
format: "dd-M-yyyy",
endDate: "today",
startDate: dlyDate,
todayBtn: true,
inline: true,
todayHighlight: 1
});
});
});
</script>
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
System.Data.DataTable dt = new System.Data.DataTable();
dt.Columns.Add(new System.Data.DataColumn("DLY_DATE", typeof(DateTime)));
dt.Rows.Add(DateTime.Now);
dt.Rows.Add(DateTime.Now.AddDays(-1));
dt.Rows.Add(DateTime.Now.AddMonths(-1).AddDays(2));
gridPOD.DataSource = dt;
gridPOD.DataBind();
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim dt As Data.DataTable = New Data.DataTable()
dt.Columns.Add(New Data.DataColumn("DLY_DATE", GetType(DateTime)))
dt.Rows.Add(DateTime.Now)
dt.Rows.Add(DateTime.Now.AddDays(-1))
dt.Rows.Add(DateTime.Now.AddMonths(-1).AddDays(2))
gridPOD.DataSource = dt
gridPOD.DataBind()
End If
End Sub
Screenshot