|
Rank: Advanced Member Groups: Member
Joined: 8/25/2007 Posts: 34
|
I'm trying to trigger an event inside a repeater for the maskededit control ontextchanged property, but it is not firing. Can you help? (The OnTextChanged property isn't firing, but the insert command on my footer row does)
Code: HTML/ASPX
<asp:Repeater ID="timecard_rpt" runat="server" onitemcommand="pay_view_ItemCommand">
<HeaderTemplate>
<table style="border: 1px solid #000000;">
<tr style="font-size: larger; font-style: oblique; text-align: center; border-bottom: solid 1px #000000;">
<td> <asp:Label ID="h1" runat="server" Text="Day of Week"></asp:Label> </td>
<td> <asp:Label ID="h2" runat="server" Text="Date"></asp:Label> </td>
<td> <asp:Label ID="h3" runat="server" Text="Time In"></asp:Label> </td>
<td> <asp:Label ID="h4" runat="server" Text="Time Out"></asp:Label> </td>
<td> <asp:Label ID="h5" runat="server" Text="Lunch"></asp:Label> </td>
<td> <asp:Label ID="h6" runat="server" Text="Time In"></asp:Label> </td>
<td> <asp:Label ID="h7" runat="server" Text="Time Out"></asp:Label> </td>
<td> <asp:Label ID="h8" runat="server" Text="Total Hours"></asp:Label> </td>
<td> <asp:Label ID="h9" runat="server" Text="Time Type"></asp:Label></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="text-align: center;">
<td style="background-color: #CCCCCC;"> <asp:Label ID="d1" runat="server" Text='<%# Bind("dayofweek") %>'></asp:Label> </td>
<td style="background-color: #CCCCCC;"> <asp:Label ID="date1" runat="server" Text='<%# Bind("pay_date") %>'></asp:Label> </td>
<td style="border: 1px solid #000000;">
<eo:MaskedEdit ID="bltimein" runat="server" Width="75px" OnTextChanged="calculate_hours" Text='<%# Bind("timein") %>'>
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment MaxValue="12" MinValue="1" SegmentType="Number" />
<eo:MaskedEditSegment Text=":" />
<eo:MaskedEditSegment MaxValue="59" SegmentType="Number" />
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment Choices="AM|PM" SegmentType="Choice" />
</eo:MaskedEdit>
</td>
<td style="border: 1px solid #000000;">
<eo:MaskedEdit ID="bltimeout" runat="server" Width="75px" OnTextChanged="calculate_hours" >
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment MaxValue="12" MinValue="1" SegmentType="Number" />
<eo:MaskedEditSegment Text=":" />
<eo:MaskedEditSegment MaxValue="59" SegmentType="Number" />
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment Choices="AM|PM" SegmentType="Choice" />
</eo:MaskedEdit>
</td>
<td style="border: 1px solid #000000;"> <asp:Label ID="lunch1" runat="server"></asp:Label> </td>
<td style="border: 1px solid #000000;">
<eo:MaskedEdit ID="altimein" runat="server" Width="75px" OnTextChanged="calculate_hours" >
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment MaxValue="12" MinValue="1" SegmentType="Number" />
<eo:MaskedEditSegment Text=":" />
<eo:MaskedEditSegment MaxValue="59" SegmentType="Number" />
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment Choices="AM|PM" SegmentType="Choice" />
</eo:MaskedEdit>
</td>
<td style="border: 1px solid #000000;">
<eo:MaskedEdit ID="altimeout" runat="server" Width="75px" OnTextChanged="calculate_hours" Text='<%# Bind("timeout") %>'>
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment MaxValue="12" MinValue="1" SegmentType="Number" />
<eo:MaskedEditSegment Text=":" />
<eo:MaskedEditSegment MaxValue="59" SegmentType="Number" />
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment Choices="AM|PM" SegmentType="Choice" />
</eo:MaskedEdit>
</td>
<td style="border: 1px solid #000000;"> <asp:Label ID="totalhrs1" runat="server"></asp:Label> </td>
<td> <asp:DropDownList ID="time_type1" runat="server">
<asp:ListItem Value="P" Text="Piece Rate" Selected="True" />
<asp:ListItem Value="T" Text="Training Rate" />
<asp:ListItem Value="G" Text="GlassWave" />
<asp:ListItem Value="D" Text="DriveTime" />
</asp:DropDownList>
</tr> </td>
</ItemTemplate>
<%-- tr style="text-align: center; background-color: Gray;">
<td> <asp:Label ID="d1" runat="server" Text='<%# Bind("dayofweek") %>'></asp:Label> </td>
<td> <asp:Label ID="date1" runat="server" Text='<%# Bind("pay_date") %>'></asp:Label> </td>
<td> <asp:TextBox ID="bltimein1" runat="server" Text='<%# Bind("timein") %>' Width="50px"></asp:TextBox> </td>
<td> <asp:Textbox ID="bltimeout1" runat="server" Width="50px"></asp:Textbox> </td>
<td> <asp:Label ID="lunch1" runat="server"></asp:Label> </td>
<td> <asp:TextBox ID="altimein1" runat="server" Width="50px"></asp:TextBox> </td>
<td> <asp:TextBox ID="altimeout1" runat="server" Text='<%# Bind("timeout") %>' Width="50px"></asp:TextBox> </td>
<td> <asp:Label ID="totalhrs1" runat="server"></asp:Label> </td>
<td> <asp:DropDownList ID="time_type1" runat="server">
<asp:ListItem Value="P" Text="Piece Rate" Selected="True" />
<asp:ListItem Value="T" Text="Training Rate" />
<asp:ListItem Value="G" Text="GlassWave" />
<asp:ListItem Value="D" Text="DriveTime" />
</asp:DropDownList> </td>
</tr>
</AlternatingItemTemplate>--%>
<FooterTemplate>
<tr style="text-align: center; border: 1px solid #000000;">
<td> <asp:LinkButton ID="insert_btn" runat="server" Text="Insert" CommandName="insert"></asp:LinkButton></td>
<td> <%-- DatePicker for Insert--%>
<eo:DatePicker ID="insert_datepicker" runat="server" ControlSkinID="None"
DayCellHeight="16" DayCellWidth="19" DayHeaderFormat="FirstLetter"
DisabledDates="" OtherMonthDayVisible="True" SelectedDates=""
TitleLeftArrowImageUrl="DefaultSubMenuIconRTL"
TitleRightArrowImageUrl="DefaultSubMenuIcon" VisibleDate="2009-02-01">
<TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
<SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<PickerStyle CssText="font-family:Courier New; padding-left:5px; padding-right: 5px;" />
<CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
<TitleArrowStyle CssText="cursor:hand" />
<DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
<MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px" />
<TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
<OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
<DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid" />
<DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
</eo:DatePicker>
</td>
<td>
<eo:MaskedEdit ID="insert_timein1" runat="server" Width="75px" >
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment MaxValue="12" MinValue="1" SegmentType="Number" />
<eo:MaskedEditSegment Text=":" />
<eo:MaskedEditSegment MaxValue="59" SegmentType="Number" />
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment Choices="AM|PM" SegmentType="Choice" />
</eo:MaskedEdit>
</td>
<td>
<eo:MaskedEdit ID="insert_timeout1" runat="server" Width="75px" >
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment MaxValue="12" MinValue="1" SegmentType="Number" />
<eo:MaskedEditSegment Text=":" />
<eo:MaskedEditSegment MaxValue="59" SegmentType="Number" />
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment Choices="AM|PM" SegmentType="Choice" />
</eo:MaskedEdit>
</td>
<td></td>
<td>
<eo:MaskedEdit ID="insert_timein2" runat="server" Width="75px" >
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment MaxValue="12" MinValue="1" SegmentType="Number" />
<eo:MaskedEditSegment Text=":" />
<eo:MaskedEditSegment MaxValue="59" SegmentType="Number" />
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment Choices="AM|PM" SegmentType="Choice" />
</eo:MaskedEdit>
</td>
<td>
<eo:MaskedEdit ID="insert_timeout2" runat="server" Width="75px" >
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment MaxValue="12" MinValue="1" SegmentType="Number" />
<eo:MaskedEditSegment Text=":" />
<eo:MaskedEditSegment MaxValue="59" SegmentType="Number" />
<eo:MaskedEditSegment Text=" " />
<eo:MaskedEditSegment Choices="AM|PM" SegmentType="Choice" />
</eo:MaskedEdit>
</td>
<td></td>
<td>
<asp:DropDownList ID="insert_time_type" runat="server">
<asp:ListItem Value="P" Text="Piece Rate" Selected="True" />
<asp:ListItem Value="T" Text="Training Rate" />
<asp:ListItem Value="G" Text="GlassWave" />
<asp:ListItem Value="D" Text="DriveTime" />
</asp:DropDownList>
</td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
Code: C#
protected void pay_view_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName.ToLower() == "insert")
{
DateTime insert_date = (e.Item.FindControl("insert_datepicker") as EO.Web.DatePicker).SelectedDate;
string insert_timein1 = (e.Item.FindControl("insert_timein1") as EO.Web.MaskedEdit).Text;
string insert_timeout1 = (e.Item.FindControl("insert_timeout1") as EO.Web.MaskedEdit).Text;
string insert_timein2 = (e.Item.FindControl("insert_timein2") as EO.Web.MaskedEdit).Text;
string insert_timeout2 = (e.Item.FindControl("insert_timeout2") as EO.Web.MaskedEdit).Text;
string insert_time_type = (e.Item.FindControl("insert_time_type") as DropDownList).SelectedItem.Text;
}
}
protected void calculate_hours(object sender, EventArgs e)
{
foreach (RepeaterItem item in timecard_rpt.Items)
{
string x = item.GetType().ToString();
}
}
|
|
Rank: Advanced Member Groups: Member
Joined: 8/25/2007 Posts: 34
|
One additional question as well. On the masked edit it displays time as 12:3_ PM when it's 12:03 and 2_:30 PM when it's 2:30 PM is there anyway to ensure it has leading 0's if it's a single digit number?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
The first issue appears to be a bug. We will get that fixed as soon as possible. As for the second issue, unfortunately I am not aware of any way to do it. The reason that it displays as 12:3 is because all the number segments are always aligned to left. It might make sense to add an "alignment" to the number segment though. We will look into it and see if if we will be able to do that.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/25/2007 Posts: 34
|
I think it will be better to use the datepicker control and exercise the timepicker options. One problem I am having with that control is the ability to databind to it, I can't get it to work. I saw a similar post but no ending reply.
Code: HTML/ASPX
<eo:DatePicker ID="bltimein" runat="server" ControlSkinID="None"
DayCellHeight="16" DayCellWidth="19" DayHeaderFormat="FirstLetter"
DisabledDates="" OtherMonthDayVisible="True" PickerFormat="hh:mm tt"
PopupImageVisible="False" SelectedDates="" SelectedDate='<%# Bind("timein") %>'>
</eo:DatePicker>
Any help you can provide would be appreciated, I've tried binding to selecteddatestring (does nothing) selecteddates (returns error that system.datetime cannot be bound to eo.web.datecollection). The selecteddate loads the timevalues when I open the page, but before the page is done loading it erases them. (I see them flicker)
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I believe you would bind to SelectedDateString instead of SelectedDate. The problem with DatePicker is that it is a rather heavy control. So the performance will suffer if you have a lot of rows. One way to workaround this is to change your logic so that you will only have one "edit row" and all other rows are read only.
You can also take a look of our Grid and see if that fits your need, the Grid has DateTimeColumn built in.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/25/2007 Posts: 34
|
Well it's maximum 7-10 rows, as it's a timesheet and I would really like to use the datepicker control rather than buy another control (besides the fact I love the EO datepicker control). That being said I still cannot get it to work, the binding values flicker but dissapear.
Code: HTML/ASPX
<eo:DatePicker ID="bltimein" runat="server" SelectedDateString='<%# Bind("timein") %>' AllowMultiSelect="false"
PickerFormat="hh:mm tt" PopupImageVisible="false" OnSelectionChanged="calculate_hours" />
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, We verified the following code works fine. So you may want to comparing this with yours:
Code: HTML/ASPX
<asp:Repeater ID="timecard_rpt" runat="server">
<ItemTemplate>
<eo:DatePicker ID="bltimein" runat="server"
SelectedDateString='<%# Bind("Test") %>'
AllowMultiSelect="false"
PickerFormat="hh:mm tt"
PopupImageVisible="false" />
</ItemTemplate>
</asp:Repeater>
Code: C#
protected void Page_Load(object sender, EventArgs e)
{
timecard_rpt.DataSource = new object[] { this };
timecard_rpt.DataBind();
}
public DateTime Test
{
get
{
return DateTime.Now;
}
}
Hope this helps. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/25/2007 Posts: 34
|
Ok, I started a new page and used that exact code and still returns the same result. (I can see it filling in the time, but then it blanks it out before the page is done loading) Any suggestions?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Check your version first. If you already have the latest version, you can post the page online and we will be happy to take a look.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/25/2007 Posts: 34
|
the Version fixed the display bug but introduced another feature. Now instead of a blank datepicker when the time is empty - they always have a value (i.e. default to 12:00 AM) even if the binding syntax shows null. Is there any way to start the datepicker with a blank textbox?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I believe it always does that for the time part. We will look into it and see if there is any particular reason for it to do so, and obviously if there is not, to fix it.
Thanks!
|
|