Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failing to update my Grid using template field

I use EntityDataSource.

When I want to insert into the "ShiftDetails" table with the following data: (3,1,04:00:00)

It is inserted fine if I use:

   <telerik:GridBoundColumn DataField="startTime" HeaderText="startTime" SortExpression="startTime"
                        UniqueName="startTime" DataType="System.TimeSpan"  EmptyDataText="00:00:00" >

When I try this with templatefield, the startTime is 00:00:00 instead of 04:00:00

 <telerik:GridTemplateColumn  HeaderText="startTime" >
                            <ItemTemplate> 
                                <asp:Label runat="server" ID="lblstartTime" Text='<%# Eval("startTime")%>'></asp:Label>
                            </ItemTemplate>
                            <InsertItemTemplate>
                              <telerik:RadDateInput ID="txt_startTime" runat="server" DbSelectedDate='<%# Eval("startTime","{0:hh\\:mm\\:ss}") %>' DateFormat="HH:mm:ss" DisplayDateFormat="HH:mm:ss"
                                    Culture="English (United States)"  LabelWidth="64px"
                                    Width="160px" Height="20px" EmptyMessage="!">
                                    <EmptyMessageStyle ForeColor="Red" />
                                </telerik:RadDateInput>
                            </InsertItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadDateInput ID="txt_startTime" runat="server" DateFormat="HH:mm:ss" DisplayDateFormat="HH:mm:ss"
                                    Culture="English (United States)" LabelWidth="64px"
                                    Width="160px" Height="20px" EmptyMessage="!">
                                    <EmptyMessageStyle ForeColor="Red" />
                                </telerik:RadDateInput>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>

My rad grid is master-details

the source of the details :

  <ef:EntityDataSource ID="GetSourceDetail" runat="server" ContextTypeName="ResidenceShift.RShiftEntities" EntitySetName="ShiftDetails" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" ConnectionString="name=RShiftEntities" DefaultContainerName="RShiftEntities" AutoGenerateWhereClause="True"  Include="ResidenceShift,ShiftType" AutoPage="False" AutoSort="False" EntityTypeFilter="" Select="" Where="" >
        <WhereParameters>

            <asp:SessionParameter DefaultValue="0" Name="shiftId" SessionField="shiftId" DbType="Int32" />
        </WhereParameters>
    </ef:EntityDataSource>

Why does it work fine with the bound field and then fails with the template field?!

like image 579
Anyname Donotcare Avatar asked May 13 '15 17:05

Anyname Donotcare


1 Answers

Try using RadDateTimePicker instead, as it should also submit the time.

like image 153
rdmptn Avatar answered Oct 25 '22 09:10

rdmptn