Hello,
I am writing a simple ASP.net user control that utilizes the RadTimePicker in order to calculate punch-in and punch-out times for a timesheet. I'm trying to use the <ClientEvents-OnBlur /> to fire some javascript that will sum the values of my 4 inputs and place the total in the textbox 'txtTimeTotal'. The problem I have is when using the <ClientEvents-OnBlur /> tag you must use an event handler function and I don't have anywhere that I can pass it arguments. I need the function that is called to know the client ID's of each one of the controls in the .ascx in order to properly make the calculation. I will also be using this same control multiple times on the same page so I wouldn't be able to just put the JS in <script></script> tags at the top of the page and use <%= rtpPunchInTime.ClientID %> to get the client ID's for the controls, I'll have to pass it into the function when it's called. Here is the code for my .ascx file:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="TimesheetCell.ascx.vb" Inherits="admin_controls_TimesheetCell" %> | |
<asp:Panel ID="FieldContainer" runat="server" > | |
<telerik:RadTimePicker ID="rtpPunchInTime" runat="server" | |
TimePopupButton-Visible="false" | |
Width="100%" > | |
<DateInput ClientEvents-OnValueChanged="SumTimeFields" /> | |
</telerik:RadTimePicker> | |
<telerik:RadTimePicker ID="rtpPunchOutTime" runat="server" | |
TimePopupButton-Visible="false" | |
Width="100%" > | |
<DateInput ClientEvents-OnBlur="SumTimeFields" /> | |
</telerik:RadTimePicker> | |
<asp:DropDownList ID="ddlLunchTime" runat="server" Width="100%"> | |
<asp:ListItem Text="" Value="0" /> | |
<asp:ListItem Text="30 mins" Value=".5" /> | |
<asp:ListItem Text="45 mins" Value=".75" /> | |
<asp:ListItem Text="1 hour" Value="1" /> | |
</asp:DropDownList><br /> | |
<asp:DropDownList ID="ddlDinnerTime" runat="server" Width="100%"> | |
<asp:ListItem Text="" Value="0" /> | |
<asp:ListItem Text="30 mins" Value=".5" /> | |
<asp:ListItem Text="45 mins" Value=".75" /> | |
<asp:ListItem Text="1 hour" Value="1" /> | |
</asp:DropDownList><br /> | |
<telerik:RadTextBox ID="txtTimeTotal" runat="server" Width="100%" Enabled="false" Text="0:00" /><br /> | |
</asp:Panel> |
Here is the signature for my event handler (pretty simple):
function SumTimeFields(sender, e) { | |
//Do some code to sum the fields | |
} |
So knowing all this, is it possible at all to somehow pass the relevant client ID's to e so that I can sum the fields via the client side? Any help is greatly appreciated.
Thanks