|
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.
|
|
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!
|
|
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.
|
|
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"
|
|