I am using a Rad grid to display some information where the checkboxes mark items and using a rad drop down you can pick you action and press a button. One of the items is to send a email to all the checked rows.
In the button click call back I enumerate the checked rows from the grid and put their emails together in a string buffer and then add script to execute the email on postback.
The results in the line
to be put just in front of the all Telerik rad javascript code.
Somehow this innocent little line of javascript causes the master checkbox on the header line and the drop down to stop functioning. The parent.location is no where in the html except my email line.
I cannot figure out a solution to this problem, it feels like bug that Telerik objects would break so easily form a little self contained scripting. Perhaps another way to send email on a browser set on the server would get around the issue.
George
In the button click call back I enumerate the checked rows from the grid and put their emails together in a string buffer and then add script to execute the email on postback.
ClientScript.RegisterStartupScript(this.GetType(), "mailto",
"<
script
type
=
'text/javascript'
>parent.location='mailto:" + emailToBuffer.ToString() + "'</
script
>") ;
The results in the line
<
script
type
=
'text/javascript'
>parent.location='mailto:dana@here.com; '</
script
>
Somehow this innocent little line of javascript causes the master checkbox on the header line and the drop down to stop functioning. The parent.location is no where in the html except my email line.
I cannot figure out a solution to this problem, it feels like bug that Telerik objects would break so easily form a little self contained scripting. Perhaps another way to send email on a browser set on the server would get around the issue.
George
6 Answers, 1 is accepted
0
Hello George,
Have in mind that most of the controls use heavy client-side logic. In case there is a JavaScript error on the page the browser will prevent the script execution. Thus, causing the controls not to work as expected.
Would you check the browser console and see if there are any errors listed?
Regards,
Viktor Tachev
Telerik
Have in mind that most of the controls use heavy client-side logic. In case there is a JavaScript error on the page the browser will prevent the script execution. Thus, causing the controls not to work as expected.
Would you check the browser console and see if there are any errors listed?
Regards,
Viktor Tachev
Telerik
See What's Next in App Development. Register for TelerikNEXT.
0

George
Top achievements
Rank 2
answered on 03 Apr 2015, 08:18 PM
On the top checkbox this error happens
Uncaught TypeError: Cannot read property '_selectAllRows' of null - see bolded line
<
tr
>
<
th
scope
=
"col"
class
=
"rgHeader rgCheck"
><
input
id
=
"ctl00_MainContent_AdminGrid_ctl00_ctl02_ctl01_SelectColumnSelectCheckBox"
type
=
"checkbox"
name
=
"ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$SelectColumnSelectCheckBox"
onclick
=
"$find("ctl00_MainContent_AdminGrid")._selectAllRows("ctl00_MainContent_AdminGrid_ctl00", "", event);"
/></
th
><
th
scope
=
"col"
class
=
"rgHeader"
style
=
"display:none;"
><
a
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'ID'); return false;"
title
=
"Click here to sort"
href
=
"javascript:__doPostBack('ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl06','')"
>ID</
a
><
input
type
=
"submit"
name
=
"ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl07"
value
=
" "
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'ID'); return false;"
title
=
"Sorted asc"
class
=
"rgSortAsc"
id
=
"ctl00_MainContent_AdminGrid_ctl00__ID__SortAsc"
style
=
"display:none;"
/><
input
type
=
"submit"
name
=
"ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl08"
value
=
" "
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'ID'); return false;"
title
=
"Sorted desc"
class
=
"rgSortDesc"
id
=
"ctl00_MainContent_AdminGrid_ctl00__ID__SortDesc"
style
=
"display:none;"
/></
th
><
th
scope
=
"col"
class
=
"rgHeader"
><
a
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Field_1'); return false;"
title
=
"Click here to sort"
href
=
"javascript:__doPostBack('ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl09','')"
>Display Name</
a
><
input
type
=
"submit"
name
=
"ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl10"
value
=
" "
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Field_1'); return false;"
title
=
"Sorted asc"
class
=
"rgSortAsc"
id
=
"ctl00_MainContent_AdminGrid_ctl00__Field_1__SortAsc"
style
=
"display:none;"
/><
input
type
=
"submit"
name
=
"ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl11"
value
=
" "
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Field_1'); return false;"
title
=
"Sorted desc"
class
=
"rgSortDesc"
id
=
"ctl00_MainContent_AdminGrid_ctl00__Field_1__SortDesc"
style
=
"display:none;"
/></
th
><
th
scope
=
"col"
class
=
"rgHeader"
><
a
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Field_2'); return false;"
title
=
"Click here to sort"
href
=
"javascript:__doPostBack('ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl12','')"
>Full Name</
a
><
input
type
=
"submit"
name
=
"ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl13"
value
=
" "
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Field_2'); return false;"
title
=
"Sorted asc"
class
=
"rgSortAsc"
id
=
"ctl00_MainContent_AdminGrid_ctl00__Field_2__SortAsc"
style
=
"display:none;"
/><
input
type
=
"submit"
name
=
"ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl14"
value
=
" "
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Field_2'); return false;"
title
=
"Sorted desc"
class
=
"rgSortDesc"
id
=
"ctl00_MainContent_AdminGrid_ctl00__Field_2__SortDesc"
style
=
"display:none;"
/></
th
><
th
scope
=
"col"
class
=
"rgHeader"
><
a
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Email_0'); return false;"
title
=
"Click here to sort"
href
=
"javascript:__doPostBack('ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl15','')"
>Email</
a
><
input
type
=
"submit"
name
=
"ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl16"
value
=
" "
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Email_0'); return false;"
title
=
"Sorted asc"
class
=
"rgSortAsc"
id
=
"ctl00_MainContent_AdminGrid_ctl00__Email_0__SortAsc"
style
=
"display:none;"
/><
input
type
=
"submit"
name
=
"ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl17"
value
=
" "
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Email_0'); return false;"
title
=
"Sorted desc"
class
=
"rgSortDesc"
id
=
"ctl00_MainContent_AdminGrid_ctl00__Email_0__SortDesc"
style
=
"display:none;"
/></
th
><
th
scope
=
"col"
class
=
"rgHeader"
><
a
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Field_4'); return false;"
title
=
"Click here to sort"
href
=
"javascript:__doPostBack('ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl18','')"
>Home Phone</
a
><
input
type
=
"submit"
name
=
"ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl19"
value
=
" "
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Field_4'); return false;"
title
=
"Sorted asc"
class
=
"rgSortAsc"
id
=
"ctl00_MainContent_AdminGrid_ctl00__Field_4__SortAsc"
style
=
"display:none;"
/><
input
type
=
"submit"
name
=
"ctl00$MainContent$AdminGrid$ctl00$ctl02$ctl01$ctl20"
value
=
" "
onclick
=
"Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_AdminGrid_ctl00'), 'Field_4'); return false;"
title
=
"Sorted desc"
class
=
"rgSortDesc"
id
=
"ctl00_MainContent_AdminGrid_ctl00__Field_4__SortDesc"
style
=
"display:none;"
/></
th
>
</
tr
><
tr
class
=
"rgFilterRow"
>
On the non-working Rad dropdown no error is displayed in the log, it just does not click.
0

George
Top achievements
Rank 2
answered on 03 Apr 2015, 08:21 PM
Bad bold sorry, and there is no error on the email. The pages refreshes and the email comes up with no errors and the Telerik controls stop working.
0
Accepted
Hello George,
Without replicating the behavior locally all we can do is guess what is causing it. Would you submit a formal support ticket and attach a runnable sample where the problem is replicated?
This will enable us to investigate the issue locally and look for its cause.
Regards,
Viktor Tachev
Telerik
Without replicating the behavior locally all we can do is guess what is causing it. Would you submit a formal support ticket and attach a runnable sample where the problem is replicated?
This will enable us to investigate the issue locally and look for its cause.
Regards,
Viktor Tachev
Telerik
See What's Next in App Development. Register for TelerikNEXT.
0
Accepted

George
Top achievements
Rank 2
answered on 08 Apr 2015, 03:58 PM
With some help from Hristo on a ticket for this problem the following avoids using parent.location - parent.location in script seems to break Telerik controls.
In the asp:
<
a
id
=
"mailLink"
runat
=
"server"
style
=
"display:none;"
>Send Mail</
a
>
<asp:Button ID="AddVariable" Text="Email Somebody" OnClick="Email_Click" CssClass="btn btn-primary" runat="server" />
And on the server:
protected void Email_Click(object sender, System.EventArgs e)
{
mailLink.HRef = "mailto:somebody@telerik.com"; // substitute for emails coming for the checked rows
ClientScript.RegisterStartupScript(this.GetType(),"mailto", "<
script
type
=
'text/javascript'
>document.getElementById('MainContent_mailLink').click();</
script
>");
}
0
Hi George,
Thank you for sharing the solution with the community. Thus, someone facing similar issue would be able to resolve it quickly.
Regards,
Viktor Tachev
Telerik
Thank you for sharing the solution with the community. Thus, someone facing similar issue would be able to resolve it quickly.
Regards,
Viktor Tachev
Telerik
See What's Next in App Development. Register for TelerikNEXT.