Welcome Guest Search | Active Topics | Sign In | Register

How to use DatePicker in Detailsview Options
Kashfia
Posted: Monday, June 3, 2013 6:59:32 AM
Rank: Newbie
Groups: Member

Joined: 6/3/2013
Posts: 3
Hi,

I am new with ASP.NET. I want to use DatePicker in a detailsview in Edit Template Field. This is my code:

<asp:TemplateField HeaderText="Payment Date">
<EditItemTemplate>
<eo:DatePicker ID="DatePicker2" runat="server"
DisabledDates="" SelectedDates="">
</eo:DatePicker>
</EditItemTemplate

<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("pfpaymentdate") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("pfpaymentdate") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

Please see the above Red marked code. I want to bind the field with "pfpaymentdate" which is a data field. But I cannot bind because there is no "Text" Attribute in DatePicker.

Please help me out.
eo_support
Posted: Monday, June 3, 2013 8:56:59 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

For DatePicker you can either bind to SelectedDate or SelectedDateString property. The difference is SelectedDate is a DateTime value, so it does not support null value, where as SelectedDateString is a string value, so it supports null value.

Thanks!
Kashfia
Posted: Monday, June 3, 2013 9:16:15 AM
Rank: Newbie
Groups: Member

Joined: 6/3/2013
Posts: 3
Hi,

What will be the update command? My code are below. Its not working.

Update Parameters:
<UpdateParameters>
<asp:QueryStringParameter Name="cid" QueryStringField="cid" DefaultValue="" ConvertEmptyStringToNull="True" />
<asp:Parameter Name="DatePicker2" Type="DateTime" />
</UpdateParameters>

Update Command:

UpdateCommand = "update pf_master set pfpaymentdate = @DatePicker2 where employeeid = @cid"

Help me out.
Kashfia
Posted: Monday, June 3, 2013 9:38:32 AM
Rank: Newbie
Groups: Member

Joined: 6/3/2013
Posts: 3
It worked as follows.

Update Parameters:
<UpdateParameters>
<asp:QueryStringParameter Name="cid" QueryStringField="cid" DefaultValue="" ConvertEmptyStringToNull="True" />
<asp:Parameter Name="pfpaymentdate" Type="DateTime" />
</UpdateParameters>

Update Command:

"update pf_master set pfpaymentdate = @pfpaymentdate where employeeid = @cid"







You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.