Reputation: 103
I am having a problem with sending more than one control to a javascript function.
Here's My Code:
<telerik:GridTemplateColumn DataField="ExpirationPeriod" SortExpression="ExpirationPeriod"
GroupByExpression="ExpirationPeriod Group By ExpirationPeriod" AutoPostBackOnFilter="true"
FilterControlWidth="40px" HeaderText="Expiration Period" UniqueName="ExpirationPeriod">
<ItemTemplate>
<%# Eval("ExpirationPeriod")%>
</ItemTemplate>
<EditItemTemplate>
<font color="red"><strong>*</strong></font>
<telerik:RadNumericTextBox ID="TxtExpirationPeriod" Width="40px" onblur="doSomeWork(this, document.getElementById("<%=RfvExpirationPeriod.ClientID %>"));"
runat="server" MinValue="1">
<NumberFormat DecimalDigits="0" GroupSeparator="" />
</telerik:RadNumericTextBox>
<asp:RequiredFieldValidator ID="RfvExpirationPeriod" runat="server" ValidationGroup="save"
ErrorMessage="Required" ForeColor="Red" ControlToValidate="TxtExpirationPeriod"></asp:RequiredFieldValidator>
</EditItemTemplate>
</telerik:GridTemplateColumn>
so as it Explained i want to fire a javascript function called doSomeWork
at the TxtExpirationPeriod onblur
event with two controls (TxtExpirationPeriod
, RfvExpirationPeriod
).
Actuall i received the TxtExpirationPeriod
control successfully but i didn't receive the RfvExpirationPeriod
control and i have its value to be null
Here is My javascript Function:
<telerik:RadScriptBlock ID="RSBlock" runat="server">
<script type="text/javascript" language="javascript">
function doSomeWork(ctrl1, ctrl2) {
//Do Some Work with the two controls
//ctrl1 is fine, I can get it
//ctrl2 comes with null
}
</script>
Please be notified that i can't find those controls directly in doSomeWork
Function because i am in the edit mode of radgrid view and these controls are not visible.
Upvotes: 0
Views: 321
Reputation: 146
check <%=RfvExpirationPeriod.ClientID %> this value whether you get this value not null
if correct value then
check document.getElementById("<%=RfvExpirationPeriod.ClientID %>")
one of the result may be null.
Upvotes: 1