I have a master page and a derived web content form using the specified master page. Any javascript I place in my Content1 and the body of the page goes in Content2. The issue is that I am calling a javacript but since the controls only exist in the Edit Mode of the RadGrid, when the page loads it is firing an error stating that the controls do not exist in the context.
Javascript
Aspx
Javascript
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"head"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function copyAmount() {
if (document.getElementById("<%=tbApprovedAmount.ClientID%>")) {
document.getElementById("<%=tbApprovedAmount.ClientID%>").value = document.getElementById("<%=tbRequestedAmount.ClientID%>").value;
}
}
</
script
>
</
asp:Content
>
Aspx
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"MainContent"
runat
=
"server"
>
.
.
.
<
EditFormSettings
EditFormType
=
"Template"
FormStyle-BackColor
=
"#DBE9FD"
>
<
EditColumn
UniqueName
=
"EditCommandColumn1"
>
</
EditColumn
>
<
FormStyle
BackColor
=
"#DBE9FD"
/>
<
FormTemplate
>
<
table
width
=
"800px"
border
=
"0"
>
<
tr
>
<
td
align
=
"left"
>
<
asp:TextBox
ID
=
"tbRequestedAmount"
runat
=
"server"
Text='<%# Bind("RequestedAmount", "{0:0.00}") %>' ></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"rfvRequestedAmount"
runat
=
"server"
ErrorMessage
=
"Requested amount is a required field"
Display
=
"None"
ControlToValidate
=
"tbRequestedAmount"
ValidationGroup
=
"Service"
></
asp:RequiredFieldValidator
>
<
asp:Button
ID
=
"tbCopy"
runat
=
"server"
Text="->" Height="20px"
OnClientClick="copyAmount" />
</
td
>
</
tr
>
</
table
>
</
FormTemplate
>
</
EditFormSettings
>
.
.
.
</
asp:Content
>