I am using dynamically loaded user controls into a MultiPageView control. I have a button event in the dynamic user control to update a control in the user control. I get an error "Microsoft JScript runtime error: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'PV4_userControl_ReportViewer1_ReportViewer'. If it is being updated dynamically then it must be inside another update panel.
I have not found demo code that matched my requirements. I need the tab strip and RadMultiPage controls to be loaded at run time. The only dynamic user controls I have found is loaded into the parent page via a panel control The code is using the SQL server reporting services web report viewer control. .
The user control button event does post back and the code executes. The report viewer is in the user control markup. I have tried using the radajaxmanagerproxy in the user control. I still got the same error. I have also tried the below code in the parent page. I still get the same error. Do you have any suggestions?
SSRSReportUserControl controlR = (SSRSReportUserControl)Page.LoadControl("~/SSRSREportUserControl.ascx");
controlR.ID = e.PageView.ID + "_userControl";
e.PageView.Controls.Add(controlR);
Button myButton = (Button)controlR.FindControl("Button1");
ReportViewer myRpt = (ReportViewer)controlR.FindControl("ReportViewer1");
RadAjaxManager1.AjaxSettings.AddAjaxSetting(MyButton, myRpt);
I have not found demo code that matched my requirements. I need the tab strip and RadMultiPage controls to be loaded at run time. The only dynamic user controls I have found is loaded into the parent page via a panel control The code is using the SQL server reporting services web report viewer control. .
The user control button event does post back and the code executes. The report viewer is in the user control markup. I have tried using the radajaxmanagerproxy in the user control. I still got the same error. I have also tried the below code in the parent page. I still get the same error. Do you have any suggestions?
SSRSReportUserControl controlR = (SSRSReportUserControl)Page.LoadControl("~/SSRSREportUserControl.ascx");
controlR.ID = e.PageView.ID + "_userControl";
e.PageView.Controls.Add(controlR);
Button myButton = (Button)controlR.FindControl("Button1");
ReportViewer myRpt = (ReportViewer)controlR.FindControl("ReportViewer1");
RadAjaxManager1.AjaxSettings.AddAjaxSetting(MyButton, myRpt);
11 Answers, 1 is accepted
0
Hi Phillip,
The presented error most commonly appear in case nested UpdatePanel elements render on the page, which is caused by adding nested AjaxSettings in the applictaion. In this case it will be best if you can share your code (the main content page the user control and all related code behind) so that we can further investigate this issue and advise you for possible solution.
Regards,
Maria Ilieva
Telerik
The presented error most commonly appear in case nested UpdatePanel elements render on the page, which is caused by adding nested AjaxSettings in the applictaion. In this case it will be best if you can share your code (the main content page the user control and all related code behind) so that we can further investigate this issue and advise you for possible solution.
Regards,
Maria Ilieva
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

Phillip
Top achievements
Rank 1
answered on 30 Jan 2015, 04:41 PM
I cannot do a cut and paste info this forum. I cannot attach text files. How can I get you my code?
0
Hello Phillip,
You can use the Format Code Block option (When expand the Formatting Option link) you have in the editor where the text is typed when forum post is submitted and paste the code there.
See the image attached.
Regards,
Maria Ilieva
Telerik
You can use the Format Code Block option (When expand the Formatting Option link) you have in the editor where the text is typed when forum post is submitted and paste the code there.
See the image attached.
Regards,
Maria Ilieva
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

Phillip
Top achievements
Rank 1
answered on 09 Feb 2015, 10:18 PM
Below is the main content page markup.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register src="HomeUserControl.ascx" tagname="Home" tagprefix="uc1" %>
<%@ Register src="UsersUserControl.ascx" tagname="Users" tagprefix="uc2" %>
<%@ Register src="StudySetupUserControl.ascx" tagname="StudySetup" tagprefix="uc3" %>
<%@ Register src="SSRSReportUserControl.ascx" tagname="SSRSReport" tagprefix="uc4" %>
<%@ Register src="QualityControlUserControl.ascx" tagname="QualityControl" tagprefix="uc5" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
link
rel
=
"stylesheet"
href
=
"Styles/main.css"
type
=
"text/css"
media
=
"screen"
/>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
<
title
></
title
>
<
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager1"
runat
=
"server"
/>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
<
asp:ScriptReference
Path
=
"~/cachable_scripts.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
telerik:RadSkinManager
ID
=
"QsfSkinManager"
runat
=
"server"
ShowChooser
=
"true"
PersistenceMode
=
"Session"
/>
<
telerik:RadFormDecorator
ID
=
"QsfFromDecorator"
runat
=
"server"
DecoratedControls
=
"All"
EnableRoundedCorners
=
"false"
/>
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
></
telerik:RadWindowManager
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadSponsorComboBox"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadProtocolComboBox"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
UpdatePanelCssClass
=
""
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadProtocolComboBox"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"lblWelcomeUser"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadProtocolComboBox"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"lnkYes"
></
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"Panel1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadProtocolComboBox"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"lnkNo"
></
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"Panel1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadProtocolComboBox"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadMultiPage1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadProtocolComboBox"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadTabStrip1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadSponsorComboBox"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"lnkYes"
></
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"Panel1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadSponsorComboBox"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"lnkNo"
></
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"Panel1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadTabStrip1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadTabStrip1"
></
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadMultiPage1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadMultiPage1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadMultiPage1"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
></
telerik:RadAjaxLoadingPanel
>
<
h1
>
<
asp:Literal
runat
=
"server"
ID
=
"LogoLiteral"
Text
=
"Imaging Table Editor"
></
asp:Literal
>
</
h1
>
<
asp:Panel
ID
=
"headerPanel"
runat
=
"server"
>
<
asp:Label
CssClass
=
"welcomeUser"
runat
=
"server"
ID
=
"lblWelcomeUser"
Text
=
""
></
asp:Label
>
<
div
class
=
"headerToolBox"
>
<
telerik:RadToolBar
ID
=
"HeaderToolBar"
runat
=
"server"
AutoPostBack
=
"True"
OnButtonClick
=
"HeaderToolBar_ButtonClick"
SingleClick
=
"None"
>
<
Items
>
<%--<
telerik:RadToolBarButton
Text
=
"Change Password"
Group
=
"NavigateButtons"
CommandName
=
"ChangePassword"
EnableTheming
=
"True"
/>--%>
<
telerik:RadToolBarButton
Text
=
"Logout"
Group
=
"NavigateButtons"
CommandName
=
"Logout"
/>
<
telerik:RadToolBarButton
Text
=
"About"
Group
=
"NavigateButtons"
CommandName
=
"About"
/>
</
Items
>
</
telerik:RadToolBar
>
</
div
>
<
div
>
<
table
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
>
<
telerik:RadComboBox
ID
=
"RadSponsorComboBox"
Runat
=
"server"
Height
=
"200px"
Width
=
"184px"
DropDownWidth
=
"310"
EmptyMessage
=
"Choose a Sponsor"
HighlightTemplatedItems
=
"true"
EnableLoadOnDemand
=
"true"
autopostback
=
"True"
OnItemsRequested
=
"RadComboBox_Sponsor_ItemsRequested"
onselectedindexchanged
=
"RadSponsorComboBox_SelectedIndexChanged"
Label
=
"Sponsor "
LoadingMessage
=
"Loading Sponsors..."
>
<
HeaderTemplate
>
<
table
style
=
"width: 275px"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
style
=
"width: 200px;"
> Sponsor Name</
td
>
<
td
style
=
"width: 60px;"
> # of Studies </
td
>
</
tr
>
</
table
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
table
style
=
"width: 275px"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
style
=
"width: 175px;"
> <%# DataBinder.Eval(Container, "Text")%> </
td
>
<
td
style
=
"width: 60px;"
> <%# DataBinder.Eval(Container, "Attributes['Studies']")%> </
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"RadProtocolComboBox"
Runat
=
"server"
Height
=
"200px"
Width
=
"184px"
DropDownWidth
=
"310"
EmptyMessage
=
"Choose a Sponsor"
HighlightTemplatedItems
=
"true"
onselectedindexchanged
=
"RadProtocolComboBox_SelectedIndexChanged"
autopostback
=
"true"
EnableLoadOnDemand
=
"true"
Filter
=
"StartsWith"
Label
=
" Protocol "
>
<
HeaderTemplate
>
<
table
style
=
"width: 275px"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
style
=
"width: 200px;"
> Protocol Name</
td
>
<
td
style
=
"width: 60px;"
> # of Records </
td
>
<
td
style
=
"width: 60px;"
> # of Modifications </
td
>
</
tr
>
</
table
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
table
style
=
"width: 275px"
cellspacing
=
"0"
cellpadding
=
"0"
>
<
tr
>
<
td
style
=
"width: 175px;"
> <%# DataBinder.Eval(Container, "Text")%> </
td
>
<
td
style
=
"width: 60px;"
> <%# DataBinder.Eval(Container, "Attributes['Records']")%> </
td
>
<
td
style
=
"width: 60px;"
> <%# DataBinder.Eval(Container, "Attributes['Modificaitions']")%> </
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
><
td
>
<
asp:Panel
ID
=
"Panel1"
runat
=
"server"
><
table
><
tr
><
td
><
asp:Label
ID
=
"lblError"
runat
=
"server"
></
asp:Label
><
br
/></
td
></
tr
>
<
tr
><
td
>
<
asp:RadioButtonList
ID
=
"radbtnlist"
runat
=
"server"
RepeatDirection
=
"Horizontal"
AutoPostBack
=
"true"
OnSelectedIndexChanged
=
"Index_Changed"
>
</
asp:RadioButtonList
>
</
td
></
tr
></
table
>
</
asp:Panel
>
</
td
>
</
tr
>
</
table
>
</
div
>
<
br
/>
</
asp:Panel
>
<
asp:Label
runat
=
"server"
ID
=
"lblNoAccess"
Text
=
""
></
asp:Label
>
<
telerik:RadTabStrip
ID
=
"RadTabStrip1"
MultiPageID
=
"RadMultiPage1"
runat
=
"server"
SelectedIndex
=
"0"
OnTabClick
=
"RadTabStrip1_TabClick"
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
id
=
"RadMultiPage1"
runat
=
"server"
SelectedIndex
=
"0"
RenderSelectedPageOnly
=
"true"
OnPageViewCreated
=
"RadMultiPage1_PageViewCreated"
>
</
telerik:RadMultiPage
>
</
form
>
</
body
>
</
html
>
0

Phillip
Top achievements
Rank 1
answered on 09 Feb 2015, 10:20 PM
Below is the code behind from the main page.
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
Telerik.Web.UI;
using
System.Data;
using
System.Diagnostics;
using
System.Configuration;
using
System.DirectoryServices;
using
System.Web.Security;
using
System.Collections;
using
Microsoft.Reporting.WebForms;
public
partial
class
_Default : System.Web.UI.Page
{
public
readonly
int
HOME_PAGE = 0;
public
readonly
int
USERS_PAGE = 1;
public
readonly
int
SS_PAGE = 2;
public
readonly
int
REPORTS_PAGE = 3;
public
readonly
int
QC_PAGE = 4;
public
readonly
int
TODO_PAGE = 5;
public
readonly
int
SPLASH_PAGE = 6;
public
readonly
int
CHANGEPASSWORD_PAGE = 7;
public
readonly
int
PASS_RECOVER_PAGE = 8;
public
readonly
int
REGISTER_PAGE = 9;
public
string
Sponsor
{
get
{
return
Session[
"sponsor"
].ToString();
}
set
{
Session[
"sponsor"
] = value;
}
}
public
string
Protocol
{
get
{
return
Session[
"protocol"
].ToString();
}
set
{
Session[
"protocol"
] = value;
}
}
public
string
StudyFieldsTable
{
get
{
return
Session[
"studyFieldsTable"
].ToString();
}
set
{
Session[
"studyFieldsTable"
] = value;
}
}
public
Int64 StudyID
{
get
{
return
(Int64) Session[
"studyID"
];
}
set
{
Session[
"studyID"
] = value;
}
}
public
int
QcPercentage
{
get
{
return
(
int
)Session[
"qcPercentage"
];
}
set
{
Session[
"qcPercentage"
] = value;
}
}
public
int
UserID
{
get
{
return
(
int
) Session[
"userID"
];
}
set
{
Session[
"userID"
] = value;
}
}
public
bool
IsUserAnAdmin
{
get
{
return
(
bool
)Session[
"isUserAnAdmin"
];
}
set
{
Session[
"isUserAnAdmin"
] = value;
}
}
public
bool
UseReport
{
get
{
return
(
bool
) Session[
"useReport"
];
}
set
{
Session[
"useReport"
] = value;
}
}
public
bool
ProgrammingError
{
get
{
return
(
bool
)Session[
"programmingError"
];
}
set
{
Session[
"programmingError"
] = value;
}
}
public
string
UserStudyRole
{
get
{
return
Session[
"userStudyRole"
].ToString();
}
set
{
Session[
"userStudyRole"
] = value;
}
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
string
study = RadSponsorComboBox.Text;
if
(
string
.IsNullOrEmpty(study))
RadProtocolComboBox.Enabled =
false
;
if
(RadSponsorComboBox !=
null
&& Session[
"uid"
] ==
null
)
{
string
page =
this
.Page.ToString();
Telerik.Web.UI.RadSkinManager.GetCurrent(
this
.Page).ApplySkin(form1);
}
if
(!Page.IsPostBack)
{
//ActiveDirectoryUsers.Users ADuser = ActiveDirectoryUsers.GetCurrentUser();
//Core.Entities.User myUser = new Core.Entities.User(ADuser.UserName);
Core.Entities.User myUser =
new
Core.Entities.User(User.Identity.Name.Substring(7));
if
(myUser.UserID == 0)
//new user no access yet.
{
lblNoAccess.Text =
"You have not been granted access to the application. Please contact the Imaging dept head."
;
lblNoAccess.ForeColor = System.Drawing.Color.Red;
lblNoAccess.Font.Size = (FontUnit)16.0;
headerPanel.Visible =
false
;
}
if
(Core.Data.Users.IsUserLockedOut(User.Identity.Name.Substring(7)))
// User is locked out
{
lblNoAccess.Text =
"You have been locked out. Please contact the Imaging dept head."
;
lblNoAccess.ForeColor = System.Drawing.Color.Red;
lblNoAccess.Font.Size = (FontUnit)16.0;
headerPanel.Visible =
false
;
}
//Session["UserName"] = HttpContext.Current.User.Identity.Name.Substring(7);
UserID = Core.Data.Users.GetUserIDFromUserName(HttpContext.Current.User.Identity.Name.Substring(7));
}
}
#region RadHeaderBar
protected
void
HeaderToolBar_ButtonClick(
object
sender, Telerik.Web.UI.RadToolBarEventArgs e)
{
RadToolBarButton btn = e.Item
as
RadToolBarButton;
switch
(btn.CommandName.ToString())
{
case
"About"
:
string
version =
"Version - "
+ ConfigurationManager.AppSettings[
"version"
].ToString();
RadWindowManager1.RadAlert(version, 200, 100,
"About"
,
null
,
""
);
break
;
case
"Logout"
:
Session.RemoveAll();
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
break
;
//case "ChangePassword":
// RadMultiPage1.SelectedIndex = CHANGEPASSWORD_PAGE;
// RadTabStrip1.Tabs[CHANGEPASSWORD_PAGE].Selected = true;
// break;
}
}
#endregion
#region ComboBoxes
protected
void
RadComboBox_Sponsor_ItemsRequested(
object
sender, RadComboBoxItemsRequestedEventArgs e)
{
string
sql;
IsUserAnAdmin = Core.Data.Users.IsUserAnAdmin(UserID);
if
(IsUserAnAdmin)
sql = @
"select Distinct Study.Sponsor from Study Study"
;
else
sql = @"select Distinct Study.Sponsor from Study Study
Inner Join User_Accounts_Study UserStudy on Study.StudyID=UserStudy.StudyID
Inner Join User_Accounts Users on UserStudy.UserID=Users.UserID
where Users.UserID=" + UserID;
DataTable dataTable =
new
DataTable();
dataTable = Core.Data.Data.SQLRetrieve(sql);
foreach
(DataRow dataRow
in
dataTable.Rows)
{
RadComboBoxItem item =
new
RadComboBoxItem();
//Debug.Print(dataRow.ItemArray[0].ToString());
item.Text = dataRow.ItemArray[0].ToString();
item.Value = dataRow.ItemArray[0].ToString();
string
sqlStudiesNumber =
"select COUNT(*) from Study where Sponsor = '"
+ dataRow.ItemArray[0].ToString() +
"'"
;
DataTable dtStudies =
new
DataTable();
dtStudies = Core.Data.Data.SQLRetrieve(sqlStudiesNumber);
item.Attributes.Add(
"Studies"
, dtStudies.Rows[0][0].ToString());
RadSponsorComboBox.Items.Add(item);
}
RadSponsorComboBox.DataBind();
}
//Loads the Protocol Combobox
protected
void
RadSponsorComboBox_SelectedIndexChanged(
object
sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
ResetErrorMessage();
ReloadProtocolList();
}
protected
void
ReloadProtocolList()
{
Sponsor = RadSponsorComboBox.Text;
//Debug.Print(sponsor);
RadProtocolComboBox.Text =
""
;
RadProtocolComboBox.Items.Clear();
string
sql;
if
(IsUserAnAdmin)
sql = @"select Distinct Stdy.Protocol, Stdy.ProgrammingError, Stdy.TableNamePrefix, Stdy.UseReport, Stdy.StudyID, Stdy.QcPercentage from Study Stdy
where Stdy.Sponsor=
'" + Sponsor + "'
";
else
sql = @"select Distinct Stdy.Protocol, Stdy.ProgrammingError, Stdy.TableNamePrefix, Stdy.UseReport, Stdy.StudyID, Stdy.QcPercentage from Study Stdy
Inner Join User_Accounts_Study UserStudy on Stdy.StudyID=UserStudy.StudyID
Inner Join User_Accounts Users on UserStudy.UserID=Users.UserID
where Users.UserID=
" + UserID + "
and Stdy.Sponsor=
'" + Sponsor + "'
";
DataTable dataTable =
new
DataTable();
dataTable = Core.Data.Data.SQLRetrieve(sql);
foreach
(DataRow dataRow
in
dataTable.Rows)
{
RadComboBoxItem item =
new
RadComboBoxItem();
Debug.Print(dataRow.ItemArray[0].ToString());
item.Text = dataRow.ItemArray[0].ToString();
item.Value = dataRow.ItemArray[0].ToString();
item.Attributes[
"ProgrammingError"
] = dataRow.ItemArray[1].ToString();
item.Attributes[
"TableNamePrefix"
] = dataRow.ItemArray[2].ToString();
item.Attributes[
"UseReport"
] = dataRow.ItemArray[3].ToString();
item.Attributes[
"StudyID"
] = dataRow.ItemArray[4].ToString();
item.Attributes[
"QcPercentage"
] = dataRow.ItemArray[5].ToString();
DataTable dtTableName =
new
DataTable();
string
sqlStudiesNumber =
"select COUNT(*) from Sponsor_Study_Master_Parent Where StudyID = "
+ item.Attributes[
"StudyID"
];
DataTable dtStudies =
new
DataTable();
dtStudies = Core.Data.Data.SQLRetrieve(sqlStudiesNumber);
Debug.Print(sqlStudiesNumber);
item.Attributes.Add(
"Records"
, dtStudies.Rows[0][0].ToString());
DataTable dtAuditData =
new
DataTable();
dtAuditData = Core.Data.Data.SQLRetrieve(
"exec GetAllAuditDataViaSponsorAndProtocolNew "
+ item.Attributes[
"StudyID"
]);
item.Attributes.Add(
"Modificaitions"
, dtAuditData.Rows.Count.ToString());
RadProtocolComboBox.Items.Add(item);
item.DataBind();
}
RadProtocolComboBox.Enabled =
true
;
}
//set Session vars from which stored proc's will be called
protected
void
RadProtocolComboBox_SelectedIndexChanged(
object
sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
ResetErrorMessage();
Sponsor = RadSponsorComboBox.Text;
Protocol = RadProtocolComboBox.Text;
StudyFieldsTable = RadProtocolComboBox.SelectedItem.Attributes[
"TableNamePrefix"
] +
"_Elements_Attribute"
;
StudyID = Convert.ToInt32(RadProtocolComboBox.SelectedItem.Attributes[
"StudyID"
]);
UseReport = Convert.ToBoolean(RadProtocolComboBox.SelectedItem.Attributes[
"UseReport"
]);
ProgrammingError = Convert.ToBoolean(RadProtocolComboBox.SelectedItem.Attributes[
"ProgrammingError"
]);
QcPercentage = Convert.ToInt32(RadProtocolComboBox.SelectedItem.Attributes[
"QcPercentage"
]);
string
projectRole;
RadMultiPage1.PageViews.Clear();
if
(IsUserAnAdmin)
{
UserStudyRole = Core.TableEditorTypes.UserStudyRoles.MIS.ToString();
projectRole =
"MIS"
;
RadTabStrip1.DataSource = getDataAdmin();
}
else
{
UserStudyRole = Core.Data.Users.GetUserStudyRoleFromUserIdAndStudyId(UserID, Convert.ToInt32(StudyID)).ToString();
projectRole = Core.Data.Users.GetStudyRoleNameFromStudyRoleId(Convert.ToInt32(UserStudyRole));
if
(projectRole ==
"PM"
)
RadTabStrip1.DataSource = getDataPM();
else
RadTabStrip1.DataSource = getDataQC();
}
RadTabStrip1.DataTextField =
"TABNAME"
;
RadTabStrip1.DataValueField =
"TABID"
;
RadTabStrip1.DataBind();
for
(
int
i = 0; i < RadTabStrip1.Tabs.Count; i++)
{
AddPageView(RadTabStrip1.Tabs[i]);
}
//display Admin instead of MIS
if
(projectRole ==
"MIS"
)
lblWelcomeUser.Text =
"Welcome <b>"
+ HttpContext.Current.User.Identity.Name.Substring(7) +
"</b>! [Admin] "
;
else
lblWelcomeUser.Text =
"Welcome <b>"
+ HttpContext.Current.User.Identity.Name.Substring(7) +
"</b>! ["
+ projectRole +
"] "
;
if
(ProgrammingError)
{
lblError.Text =
"A Programming Error occurred for this study. Do you 100% QC for this study?"
;
lblError.ForeColor = System.Drawing.Color.Red;
Hashtable myitem =
new
Hashtable();
myitem.Add(
"No"
,
"No"
);
myitem.Add(
"Yes"
,
"Yes"
);
radbtnlist.DataSource = myitem;
radbtnlist.DataValueField =
"Key"
;
radbtnlist.DataTextField =
"Value"
;
radbtnlist.DataBind();
}
else
{
ResetErrorMessage();
}
}
protected
DataTable getDataAdmin()
{
//AddTab("Home");
//AddTab("Users");
//AddTab("Study Setup");
//AddTab("Reports");
//AddTab("Quality Control");
DataTable table =
new
DataTable();
table.Columns.Add(
"TABID"
);
table.Columns.Add(
"TABNAME"
);
table.Rows.Add(
new
string
[] {
"1"
,
"Home"
});
table.Rows.Add(
new
string
[] {
"2"
,
"Users"
});
table.Rows.Add(
new
string
[] {
"3"
,
"Study Setup"
});
table.Rows.Add(
new
string
[] {
"4"
,
"Reports"
});
table.Rows.Add(
new
string
[] {
"5"
,
"Quality Control"
});
return
table;
}
protected
DataTable getDataPM()
{
//AddTab("Home");
//AddTab("Study Setup");
//AddTab("Reports");
//AddTab("Quality Control");
DataTable table =
new
DataTable();
table.Columns.Add(
"TABID"
);
table.Columns.Add(
"TABNAME"
);
table.Rows.Add(
new
string
[] {
"1"
,
"Home"
});
table.Rows.Add(
new
string
[] {
"3"
,
"Study Setup"
});
table.Rows.Add(
new
string
[] {
"4"
,
"Reports"
});
table.Rows.Add(
new
string
[] {
"5"
,
"Quality Control"
});
return
table;
}
protected
DataTable getDataQC()
{
//AddTab("Home");
//AddTab("Reports");
//AddTab("Quality Control");
DataTable table =
new
DataTable();
table.Columns.Add(
"TABID"
);
table.Columns.Add(
"TABNAME"
);
table.Rows.Add(
new
string
[] {
"1"
,
"Home"
});
table.Rows.Add(
new
string
[] {
"4"
,
"Reports"
});
table.Rows.Add(
new
string
[] {
"5"
,
"Quality Control"
});
return
table;
}
private
void
AddTab(
string
tabName)
{
RadTab tab =
new
RadTab();
tab.Text = tabName;
RadTabStrip1.Tabs.Add(tab);
}
protected
void
Index_Changed(Object sender, EventArgs e)
{
string
sql =
""
;
switch
(radbtnlist.SelectedItem.Text)
{
case
"Yes"
:
//The trigger on parent table will write to audit table
sql =
"UPDATE Sponsor_Study_Master_Parent SET QcStatus = 'Needs Qc', UserName='"
+ HttpContext.Current.User.Identity.Name.Substring(7) +
"',EditComments='Programming Error', where StudyID = "
+ StudyID.ToString();
Core.Data.Data.SQLExec(sql);
sql =
"UPDATE Study SET ProgrammingError = 0 where StudyID = "
+ StudyID.ToString();
Core.Data.Data.SQLExec(sql);
ResetErrorMessage();
break
;
case
"No"
:
sql =
"UPDATE Study SET ProgrammingError = 0 where StudyID = "
+ StudyID.ToString();
Core.Data.Data.SQLExec(sql);
ResetErrorMessage();
break
;
}
}
private
void
ResetErrorMessage()
{
lblError.Text =
""
;
radbtnlist.Items.Clear();
}
#endregion
private
void
ShowAlert(
string
sAlertMessageText)
{
ScriptManager.RegisterStartupScript(
this
,
this
.GetType(),
"sqlErr"
,
"alert('"
+ sAlertMessageText.Trim().Replace(
"'"
,
""
) +
"');"
,
true
);
}
protected
void
RadTabStrip1_TabClick(
object
sender, RadTabStripEventArgs e)
{
e.Tab.PageView.Selected =
true
;
}
private
void
AddPageView(RadTab tab)
{
RadPageView pageView =
new
RadPageView();
//I am using a value to determine the tab instead of using the text
pageView.ID =
"PV"
+ tab.Value;
tab.PageViewID = pageView.ID;
RadMultiPage1.PageViews.Add(pageView);
}
protected
void
RadMultiPage1_PageViewCreated(
object
sender, RadMultiPageEventArgs e)
{
//This is different I am loading one particular control and setting a property in it
//webproject1.Controls.PageViewGrid PVControl = new webproject1.Controls.PageViewGrid();
//PVControl.PageViewID = Convert.ToInt32(e.PageView.ID.Replace("PV", ""));
//PVControl.ID = e.PageView.ID + "_userControl";
try
{
switch
(e.PageView.ID)
{
case
"PV1"
:
HomeUserControl controlH = (HomeUserControl)Page.LoadControl(
"~/HomeUserControl.ascx"
);
controlH.StudyID = StudyID;
controlH.UserStudyRole = UserStudyRole;
controlH.StudyFieldsTable = StudyFieldsTable;
controlH.UseReport = UseReport;
controlH.UserID = UserID;
controlH.ID = e.PageView.ID +
"_userControl"
;
e.PageView.Controls.Add(controlH);
break
;
case
"PV2"
:
UsersUserControl controlU = (UsersUserControl)Page.LoadControl(
"~/UsersUserControl.ascx"
);
controlU.ID = e.PageView.ID +
"_userControl"
;
controlU.StudyID = StudyID;
e.PageView.Controls.Add(controlU);
break
;
case
"PV3"
:
StudySetupUserControl controlS = (StudySetupUserControl)Page.LoadControl(
"~/StudySetupUserControl.ascx"
);
controlS.ID = e.PageView.ID +
"_userControl"
;
controlS.Sponsor = Sponsor;
controlS.Protocol = Protocol;
controlS.QcPercentage = QcPercentage;
controlS.StudyFieldsTable = StudyFieldsTable;
controlS.StudyID = StudyID;
controlS.UseReport = UseReport;
controlS.WhichEditForm =
"StudyUsers"
;
controlS.StudyID = StudyID;
e.PageView.Controls.Add(controlS);
break
;
case
"PV4"
:
SSRSReportUserControl controlR = (SSRSReportUserControl)Page.LoadControl(
"~/SSRSReportUserControl.ascx"
);
controlR.ID = e.PageView.ID +
"_userControl"
;
e.PageView.Controls.Add(controlR);
//Button myButton = (Button)controlR.FindControl("Button1");
//ReportViewer myRpt = (ReportViewer)controlR.FindControl("ReportViewer1");
////Add the necessary AJAX setting programmatically
//RadAjaxManager1.AjaxSettings.AddAjaxSetting(myButton, myRpt);
break
;
case
"PV5"
:
QualityControlUserControl controlQ = (QualityControlUserControl)Page.LoadControl(
"~/QualityControlUserControl.ascx"
);
controlQ.ID = e.PageView.ID +
"_userControl"
;
controlQ.Sponsor = Sponsor;
controlQ.Protocol = Protocol;
controlQ.StudyID = StudyID;
controlQ.QcPercentage = QcPercentage;
controlQ.UseReport = UseReport;
e.PageView.Controls.Add(controlQ);
break
;
}
}
catch
(Exception ex) {
string
mydebug = ex.Message;
}
}
}
0

Phillip
Top achievements
Rank 1
answered on 09 Feb 2015, 10:25 PM
Below is the markup for the user control that is generating the error.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SSRSReportUserControl.ascx.cs" Inherits="SSRSReportUserControl" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<
script
type
=
"text/javascript"
>
function resize() {
var height = getDocHeight();
var elements = window.top.document.getElementsByTagName("div");
for (var i = 0; i <
elements.length
; i++) {
var
containerPageViewID
=
"ReportsPage"
;
if (elements[i].id.indexOf(containerPageViewID) > -1) {
elements[i].style.height = height + "px";
break;
}
}
}
if (window.addEventListener)
window.addEventListener("load", resize, false);
else if (window.attachEvent)
window.attachEvent("onload", resize);
else window.onload = resize;
function getDocHeight() {
var D = document;
return Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
Math.max(D.body.clientHeight, D.documentElement.clientHeight)
);
}
</
script
>
<
style
type
=
"text/css"
>
#content {
float:right;
width:85%;
padding:10px;
border:1px solid #000;
}/* Sidebar */
#sidebar {
margin-top:10px;
width:10%;
margin-bottom:10px;
float:left;
color: #000;
}
#legend {
position:relative;
margin-top:10px;
margin-bottom:10px;
border:1px solid #000;
color: #000;
height:90px;
}
a
{
display: block;
width: auto;
height: auto;
color: #000;
text-decoration: none;
}
a:hover, .selected a {
background-color: #369;
background-position: right bottom;
color: #fff;
}
ul {
margin: 0;
padding: 0;
list-style-type: none;
width:100%;
}
li {
display: inline; /* :KLUDGE: Removes large gaps in IE/Win */
}
</
style
>
<
div
id
=
"menu"
>
</
div
>
<
div
id
=
"sidebar"
><
fieldset
style
=
"border:1px solid #000;"
><
legend
>Select A Report</
legend
>
<
ul
>
<
li
><
asp:LinkButton
ID
=
"lnkAuditTrail"
runat
=
"server"
onclick
=
"lnkAuditTrail_Click"
>Audit Trail Report</
asp:LinkButton
></
li
>
<
li
><
asp:LinkButton
ID
=
"lnkUserAudit"
runat
=
"server"
onclick
=
"lnkUserAudit_Click"
>User Audit Report</
asp:LinkButton
></
li
>
<
li
><
asp:LinkButton
ID
=
"lnkLoginAudit"
runat
=
"server"
onclick
=
"lnkLoginAudit_Click"
>Login Audit Report</
asp:LinkButton
></
li
>
<
li
><
asp:LinkButton
ID
=
"lnkStudyUserChange"
runat
=
"server"
onclick
=
"lnkStudyUserChangeAudit_Click"
>Change User Study Setup</
asp:LinkButton
></
li
>
<
li
><
asp:LinkButton
ID
=
"lnkStudyUser"
runat
=
"server"
onclick
=
"lnkStudyUserAddDelAudit_Click"
>Add/Remove User From Study</
asp:LinkButton
></
li
>
</
ul
></
fieldset
>
<
fieldset
id
=
"legend"
><
legend
>User Action</
legend
>
<
ul
>
<
li
>D = Delete</
li
><
br
/>
<
li
>I = Insert</
li
><
br
/>
<
li
>U = Update</
li
>
</
ul
>
</
fieldset
>
</
div
>
<
div
id
=
"content"
>
<
div
id
=
"rptParams"
>
<
asp:Label
ID
=
"Label5"
runat
=
"server"
Text
=
"Select A Report From The Menu"
></
asp:Label
>
<
asp:Panel
ID
=
"PanelParms"
runat
=
"server"
Visible
=
"false"
>
<
asp:Label
ID
=
"lblSponsor"
runat
=
"server"
Text
=
"Sponsor/Protocol:"
></
asp:Label
><
asp:DropDownList
ID
=
"ddlSponsor"
Enabled
=
"true"
runat
=
"server"
Width
=
18
.75em
DataSourceID
=
"SponsorDataSource"
DataTextField
=
"SponsorText"
DataValueField
=
"StudyID"
></
asp:DropDownList
><
asp:Label
ID
=
"lblUser"
runat
=
"server"
Text
=
"User Name:"
></
asp:Label
><
asp:TextBox
ID
=
"txtUserName"
runat
=
"server"
></
asp:TextBox
><
telerik:RadDatePicker
ID
=
"RadDatePicker1"
MinDate
=
"2009/1/1"
runat
=
"server"
DateInput-Label
=
"Start Date:"
Width
=
"150px"
>
</
telerik:RadDatePicker
>
<
asp:RequiredFieldValidator
runat
=
"server"
ID
=
"RequiredFieldValidator1"
ControlToValidate
=
"RadDatePicker1"
ErrorMessage
=
"Enter a date"
></
asp:RequiredFieldValidator
><
telerik:RadDatePicker
ID
=
"RadDatePicker2"
MinDate
=
"2009/1/1"
runat
=
"server"
DateInput-Label
=
"End Date:"
Width
=
"150px"
>
</
telerik:RadDatePicker
>
<
asp:RequiredFieldValidator
runat
=
"server"
ID
=
"Requiredfieldvalidator2"
ControlToValidate
=
"Raddatepicker2"
ErrorMessage
=
"Enter a date"
></
asp:RequiredFieldValidator
><
asp:CompareValidator
ID
=
"dateCompareValidator"
runat
=
"server"
ControlToValidate
=
"Raddatepicker2"
ControlToCompare
=
"RadDatePicker1"
Operator
=
"GreaterThan"
Type
=
"Date"
ErrorMessage="The second date must be after the first one.<br /><
br
/>">
</
asp:CompareValidator
><
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Run Report"
onclick
=
"Button1_Click"
/>
<
br
/>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"User Full Name:"
></
asp:Label
>
<
asp:TextBox
ID
=
"txtUserFullName"
runat
=
"server"
></
asp:TextBox
>
<
asp:Label
ID
=
"Label4"
runat
=
"server"
Text
=
"Masking Code:"
></
asp:Label
>
<
asp:TextBox
ID
=
"txtMaskingCode"
runat
=
"server"
></
asp:TextBox
>
<
asp:Label
ID
=
"Label8"
runat
=
"server"
Text
=
"Reader"
></
asp:Label
>
<
asp:TextBox
ID
=
"txtReader"
runat
=
"server"
></
asp:TextBox
>
</
asp:Panel
>
</
div
>
<
div
id
=
"reportwrapper"
style
=
"height:100%; width:100%; float:right;"
><
asp:Panel
ID
=
"myPanel"
runat
=
server
></
asp:Panel
>
<
rsweb:ReportViewer
ID
=
"ReportViewer1"
runat
=
"server"
Visible
=
"false"
AsyncRendering
=
"False"
Font-Names
=
"Verdana"
Font-Size
=
"8pt"
InteractiveDeviceInfos
=
"(Collection)"
WaitMessageFont-Names
=
"Verdana"
WaitMessageFont-Size
=
"14pt"
BorderStyle
=
"Double"
Width
=
"100%"
Height
=
"100%"
OnReportError
=
"TheReport_ReportError"
onprerender
=
"ReportViewer1_PreRender"
>
</
rsweb:ReportViewer
>
</
div
>
<
asp:ObjectDataSource
ID
=
"SponsorDataSource"
runat
=
"server"
TypeName
=
"ReportsDB"
SelectMethod
=
"GetSponsors"
>
</
asp:ObjectDataSource
>
<
asp:ObjectDataSource
ID
=
"AuditReportDataSource"
runat
=
"server"
OnSelecting
=
"AuditReport_Selecting"
TypeName
=
"ReportsDB"
SelectMethod
=
"GetAuditReportData"
>
<
SelectParameters
>
<
asp:Parameter
Name
=
"StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"StudyID"
Type
=
"Int64"
/>
<
asp:Parameter
Name
=
"UserFullName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"MaskingCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Reader"
Type
=
"String"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
<
asp:ObjectDataSource
ID
=
"UserChangeReportDataSource"
runat
=
"server"
OnSelecting
=
"UserReport_Selecting"
TypeName
=
"ReportsDB"
SelectMethod
=
"GetCommonReportData"
>
<
SelectParameters
>
<
asp:Parameter
Name
=
"StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"UserName"
Type
=
"String"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
<
asp:ObjectDataSource
ID
=
"LoginReportDataSource"
runat
=
"server"
OnSelecting
=
"LoginReport_Selecting"
TypeName
=
"ReportsDB"
SelectMethod
=
"GetLoginReportData"
>
<
SelectParameters
>
<
asp:Parameter
Name
=
"StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"UserName"
Type
=
"String"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
<
asp:ObjectDataSource
ID
=
"UserStudyChangeReportDataSource"
runat
=
"server"
OnSelecting
=
"UserStudyChangeReport_Selecting"
TypeName
=
"ReportsDB"
SelectMethod
=
"GetUserStudyChangeReportData"
>
<
SelectParameters
>
<
asp:Parameter
Name
=
"StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"StudyID"
Type
=
"Int64"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
<
asp:ObjectDataSource
ID
=
"UserStudyReportDataSource"
runat
=
"server"
OnSelecting
=
"UserStudyChangeReport_Selecting"
TypeName
=
"ReportsDB"
SelectMethod
=
"GetUserStudyReportData"
>
<
SelectParameters
>
<
asp:Parameter
Name
=
"StudyID"
Type
=
"Int64"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
</
div
>
0

Phillip
Top achievements
Rank 1
answered on 09 Feb 2015, 10:30 PM
Below is the code behind for the user control generating the error.
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
Microsoft.Reporting.WebForms;
using
System.Data;
using
System.Reflection;
public
partial
class
SSRSReportUserControl : System.Web.UI.UserControl
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
//this.ReportViewer1.ShowReportBody = false;
}
}
public
void
AuditReport_Selecting(
object
source, ObjectDataSourceSelectingEventArgs e)
{
if
(
string
.IsNullOrEmpty(RadDatePicker1.SelectedDate.ToString()))
e.InputParameters[
"StartDate"
] = DateTime.MinValue;
else
e.InputParameters[
"StartDate"
] = RadDatePicker1.SelectedDate;
if
(
string
.IsNullOrEmpty(RadDatePicker2.SelectedDate.ToString()))
e.InputParameters[
"EndDate"
] = DateTime.MinValue;
else
e.InputParameters[
"EndDate"
] = RadDatePicker2.SelectedDate;
e.InputParameters[
"StudyID"
] = ddlSponsor.SelectedValue;
e.InputParameters[
"UserFullName"
] = txtUserFullName.Text;
e.InputParameters[
"MaskingCode"
] = txtMaskingCode.Text;
e.InputParameters[
"Reader"
] = txtReader.Text;
}
public
void
UserReport_Selecting(
object
source, ObjectDataSourceSelectingEventArgs e)
{
if
(
string
.IsNullOrEmpty(RadDatePicker1.SelectedDate.ToString()))
e.InputParameters[
"StartDate"
] = DateTime.MinValue;
else
e.InputParameters[
"StartDate"
] = RadDatePicker1.SelectedDate;
if
(
string
.IsNullOrEmpty(RadDatePicker2.SelectedDate.ToString()))
e.InputParameters[
"EndDate"
] = DateTime.MinValue;
else
e.InputParameters[
"EndDate"
] = RadDatePicker2.SelectedDate;
e.InputParameters[
"UserName"
] = txtUserName.Text;
}
public
void
LoginReport_Selecting(
object
source, ObjectDataSourceSelectingEventArgs e)
{
if
(
string
.IsNullOrEmpty(RadDatePicker1.SelectedDate.ToString()))
e.InputParameters[
"StartDate"
] = DateTime.MinValue;
else
e.InputParameters[
"StartDate"
] = RadDatePicker1.SelectedDate;
if
(
string
.IsNullOrEmpty(RadDatePicker2.SelectedDate.ToString()))
e.InputParameters[
"EndDate"
] = DateTime.MinValue;
else
e.InputParameters[
"EndDate"
] = RadDatePicker2.SelectedDate;
e.InputParameters[
"UserName"
] = txtUserName.Text;
}
public
void
UserStudyChangeReport_Selecting(
object
source, ObjectDataSourceSelectingEventArgs e)
{
e.InputParameters[
"StudyID"
] = ddlSponsor.SelectedValue;
}
protected
void
lnkAuditTrail_Click(
object
sender, EventArgs e)
{
PanelParms.Visible =
true
;
Label5.Visible =
false
;
lblSponsor.Visible =
true
;
ddlSponsor.Visible =
true
;
lblUser.Visible =
false
;
txtUserName.Visible =
false
;
Label1.Visible =
true
;
txtUserFullName.Visible =
true
;
Label4.Visible =
true
;
txtMaskingCode.Visible =
true
;
Label8.Visible =
true
;
txtReader.Visible =
true
;
//this.ReportViewer1.Visible = false;
ViewState[
"SelectedReport"
] =
"AuditTrail"
;
}
protected
void
lnkUserAudit_Click(
object
sender, EventArgs e)
{
PanelParms.Visible =
true
;
Label5.Visible =
false
;
lblSponsor.Visible =
false
;
ddlSponsor.Visible =
false
;
lblUser.Visible =
true
;
txtUserName.Visible =
true
;
Label1.Visible =
false
;
txtUserFullName.Visible =
false
;
Label4.Visible =
false
;
txtMaskingCode.Visible =
false
;
Label8.Visible =
false
;
txtReader.Visible =
false
;
//this.ReportViewer1.Visible = false;
ViewState[
"SelectedReport"
] =
"User"
;
}
protected
void
lnkLoginAudit_Click(
object
sender, EventArgs e)
{
PanelParms.Visible =
true
;
Label5.Visible =
false
;
lblSponsor.Visible =
false
;
ddlSponsor.Visible =
false
;
lblUser.Visible =
true
;
txtUserName.Visible =
true
;
Label1.Visible =
false
;
txtUserFullName.Visible =
false
;
Label4.Visible =
false
;
txtMaskingCode.Visible =
false
;
Label8.Visible =
false
;
txtReader.Visible =
false
;
//this.ReportViewer1.Visible = false;
ViewState[
"SelectedReport"
] =
"Login"
;
}
protected
void
lnkStudyUserChangeAudit_Click(
object
sender, EventArgs e)
{
PanelParms.Visible =
true
;
Label5.Visible =
false
;
lblSponsor.Visible =
false
;
ddlSponsor.Visible =
true
;
lblUser.Visible =
false
;
txtUserName.Visible =
false
;
Label1.Visible =
false
;
txtUserFullName.Visible =
false
;
Label4.Visible =
false
;
txtMaskingCode.Visible =
false
;
Label8.Visible =
false
;
txtReader.Visible =
false
;
//this.ReportViewer1.Visible = false;
ViewState[
"SelectedReport"
] =
"StudyUserChange"
;
}
protected
void
lnkStudyUserAddDelAudit_Click(
object
sender, EventArgs e)
{
PanelParms.Visible =
true
;
Label5.Visible =
false
;
lblSponsor.Visible =
false
;
ddlSponsor.Visible =
true
;
lblUser.Visible =
false
;
txtUserName.Visible =
false
;
Label1.Visible =
false
;
txtUserFullName.Visible =
false
;
Label4.Visible =
false
;
txtMaskingCode.Visible =
false
;
Label8.Visible =
false
;
txtReader.Visible =
false
;
//this.ReportViewer1.Visible = false;
ViewState[
"SelectedReport"
] =
"StudyUser"
;
}
protected
void
TheReport_ReportError(
object
sender, ReportErrorEventArgs e)
{
Response.Write(e.Exception.ToString());
e.Handled =
true
;
}
protected
void
Button1_Click(
object
sender, EventArgs e)
{
try
{
DateTime startDate;
DateTime endDate;
this
.ReportViewer1.Visible =
true
;
this
.ReportViewer1.Reset();
this
.ReportViewer1.ShowReportBody =
true
;
this
.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
ReportParameter[] parameters;
switch
(ViewState[
"SelectedReport"
].ToString())
{
case
"Login"
:
ReportViewer1.LocalReport.ReportPath = @
"Reports\LoginAttempts.rdlc"
;
LoginReportDataSource.DataBind();
this
.ReportViewer1.LocalReport.DataSources.Add(
new
ReportDataSource(
"DataSet1"
, LoginReportDataSource));
break
;
case
"User"
:
ReportViewer1.LocalReport.ReportPath = @
"Reports\UserChanges.rdlc"
;
UserChangeReportDataSource.DataBind();
this
.ReportViewer1.LocalReport.DataSources.Add(
new
ReportDataSource(
"DataSet1"
, UserChangeReportDataSource));
break
;
case
"AuditTrail"
:
//exportExcel();
parameters =
new
ReportParameter[6];
if
(DateTime.TryParse(RadDatePicker1.SelectedDate.ToString(),
out
startDate))
{
if
(DateTime.TryParse(RadDatePicker2.SelectedDate.ToString(),
out
endDate))
{
}
else
{
startDate = DateTime.MinValue;
endDate = DateTime.MinValue;
}
}
else
{
startDate = DateTime.MinValue;
endDate = DateTime.MinValue;
}
parameters[0] =
new
ReportParameter(
"StudyID"
, ddlSponsor.SelectedValue);
parameters[1] =
new
ReportParameter(
"StartDate"
, startDate.ToString());
parameters[2] =
new
ReportParameter(
"EndDate"
, endDate.ToString());
parameters[3] =
new
ReportParameter(
"UserFullName"
, txtUserFullName.Text);
parameters[4] =
new
ReportParameter(
"MaskingCode"
, txtMaskingCode.Text);
parameters[5] =
new
ReportParameter(
"Reader"
, txtReader.Text);
ReportViewer1.LocalReport.ReportPath = @
"Reports\AuditTrail.rdlc"
;
ReportsDB myDAL2 =
new
ReportsDB();
DataTable myAuditData = myDAL2.GetAuditReportData(startDate, endDate, Int64.Parse(ddlSponsor.SelectedValue), txtUserFullName.Text, txtMaskingCode.Text, txtReader.Text);
ReportViewer1.LocalReport.SetParameters(parameters);
ReportViewer1.LocalReport.DataSources.Add(
new
ReportDataSource(
"DataSet1"
, myAuditData));
break
;
case
"StudyUser"
:
parameters =
new
ReportParameter[3];
parameters[0] =
new
ReportParameter(
"StudyID"
, ddlSponsor.SelectedValue);
ReportViewer1.LocalReport.ReportPath = @
"Reports\UsersAddOrRemovedFromStudy.rdlc"
;
if
(DateTime.TryParse(RadDatePicker1.SelectedDate.ToString(),
out
startDate))
{
if
(DateTime.TryParse(RadDatePicker2.SelectedDate.ToString(),
out
endDate))
{
}
else
{
startDate = DateTime.MinValue;
endDate = DateTime.MinValue;
}
}
else
{
startDate = DateTime.MinValue;
endDate = DateTime.MinValue;
}
parameters[1] =
new
ReportParameter(
"StartDate"
, startDate.ToString());
parameters[2] =
new
ReportParameter(
"EndDate"
, endDate.ToString());
ReportsDB myDAL3 =
new
ReportsDB();
DataTable myUserToStudy = myDAL3.GetUserStudyReportData(startDate, endDate, Int64.Parse(ddlSponsor.SelectedValue));
ReportViewer1.LocalReport.SetParameters(parameters);
ReportViewer1.LocalReport.DataSources.Add(
new
ReportDataSource(
"DataSet1"
, myUserToStudy));
break
;
case
"StudyUserChange"
:
parameters =
new
ReportParameter[3];
parameters[0] =
new
ReportParameter(
"StudyID"
, ddlSponsor.SelectedValue);
ReportViewer1.LocalReport.ReportPath = @
"Reports\UserChangesToStudy.rdlc"
;
if
(DateTime.TryParse(RadDatePicker1.SelectedDate.ToString(),
out
startDate))
{
if
(DateTime.TryParse(RadDatePicker2.SelectedDate.ToString(),
out
endDate))
{
}
else
{
startDate = DateTime.MinValue;
endDate = DateTime.MinValue;
}
}
else
{
startDate = DateTime.MinValue;
endDate = DateTime.MinValue;
}
parameters[1] =
new
ReportParameter(
"StartDate"
, startDate.ToString());
parameters[2] =
new
ReportParameter(
"EndDate"
, endDate.ToString());
ReportsDB myDAL =
new
ReportsDB();
DataTable myUserChangesToStudy = myDAL.GetUserStudyChangeReportData(startDate, endDate, Int64.Parse(ddlSponsor.SelectedValue));
ReportViewer1.LocalReport.SetParameters(parameters);
ReportViewer1.LocalReport.DataSources.Add(
new
ReportDataSource(
"DataSet1"
, myUserChangesToStudy));
break
;
}
this
.ReportViewer1.Visible =
true
;
this
.ReportViewer1.DataBind();
this
.ReportViewer1.LocalReport.Refresh();
}
catch
(Exception ex)
{
Response.Write(ex.ToString());
}
}
public
void
exportExcel()
{
try
{
DateTime startDate;
DateTime endDate;
ReportParameter[] parameters =
new
ReportParameter[6];
if
(DateTime.TryParse(RadDatePicker1.SelectedDate.ToString(),
out
startDate))
{
if
(DateTime.TryParse(RadDatePicker2.SelectedDate.ToString(),
out
endDate))
{
}
else
{
startDate = DateTime.MinValue;
endDate = DateTime.MinValue;
}
}
else
{
startDate = DateTime.MinValue;
endDate = DateTime.MinValue;
}
parameters[0] =
new
ReportParameter(
"StudyID"
, ddlSponsor.SelectedValue);
parameters[1] =
new
ReportParameter(
"StartDate"
, startDate.ToString());
parameters[2] =
new
ReportParameter(
"EndDate"
, endDate.ToString());
parameters[3] =
new
ReportParameter(
"UserFullName"
, txtUserFullName.Text);
parameters[4] =
new
ReportParameter(
"MaskingCode"
, txtMaskingCode.Text);
parameters[5] =
new
ReportParameter(
"Reader"
, txtReader.Text);
Microsoft.Reporting.WebForms.ReportViewer myReportViewer =
new
Microsoft.Reporting.WebForms.ReportViewer();
myReportViewer.ProcessingMode = ProcessingMode.Local;
myReportViewer.LocalReport.ReportPath = @
"Reports\AuditTrail.rdlc"
;
myReportViewer.LocalReport.DataSources.Clear();
ReportsDB myDAL2 =
new
ReportsDB();
DataTable myAuditData = myDAL2.GetAuditReportData(startDate, endDate, Int64.Parse(ddlSponsor.SelectedValue), txtUserFullName.Text, txtMaskingCode.Text, txtReader.Text);
myReportViewer.LocalReport.SetParameters(parameters);
ReportDataSource reportDS =
new
ReportDataSource(
"DataSet1"
, myAuditData);
myReportViewer.LocalReport.DataSources.Add(reportDS);
myReportViewer.LocalReport.Refresh();
Response.Clear();
Warning[] warnings;
string
[] streams;
string
extension;
string
content;
string
encoding;
byte
[] b = myReportViewer.LocalReport.Render(
"EXCEL"
,
null
,
out
content,
out
encoding,
out
extension,
out
streams,
out
warnings);
Response.AppendHeader(
"Content-Disposition"
,
"attachment;filename=IncidentReport.xls"
);
Response.OutputStream.Write(b, 0, b.Length);
Response.ContentType = content;
Response.End();
}
catch
(Exception ex)
{
Response.Write(ex.Message.ToString());
}
}
public
void
DisableUnwantedExportFormat(ReportViewer ReportViewerID,
string
strFormatName)
{
FieldInfo info;
foreach
(RenderingExtension extension
in
ReportViewerID.LocalReport.ListRenderingExtensions())
{
if
(extension.Name == strFormatName)
{
info = extension.GetType().GetField(
"m_isVisible"
, BindingFlags.Instance | BindingFlags.NonPublic);
info.SetValue(extension,
false
);
}
}
}
protected
void
ReportViewer1_PreRender(
object
sender, EventArgs e)
{
DisableUnwantedExportFormat((ReportViewer)sender,
"WORD"
);
DisableUnwantedExportFormat((ReportViewer)sender,
"Excel"
);
}
}
0
Hi Philip,
Try modifying your Ajax settings in the UserControl like this:
and see how it goes.
Regards,
Maria Ilieva
Telerik
Try modifying your Ajax settings in the UserControl like this:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
DefaultLoadingPanelID
=
"RadAjaxLoadingPanel1"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"headerPanel"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"tabPanel"
></
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"headerPanel"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"tabPanel"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"tabPanel"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
></
telerik:RadAjaxLoadingPanel
>
<
h1
>
<
asp:Literal
runat
=
"server"
ID
=
"LogoLiteral"
Text
=
"Imaging Table Editor"
></
asp:Literal
>
</
h1
>
<
asp:Panel
ID
=
"headerPanel"
runat
=
"server"
>
...................
</
asp:Panel
>
<
asp:Panel
runat
=
"server"
ID
=
"tabPanel"
>
<
asp:Label
runat
=
"server"
ID
=
"lblNoAccess"
Text
=
""
></
asp:Label
>
<
telerik:RadTabStrip
ID
=
"RadTabStrip1"
MultiPageID
=
"RadMultiPage1"
runat
=
"server"
SelectedIndex
=
"0"
OnTabClick
=
"RadTabStrip1_TabClick"
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
ID
=
"RadMultiPage1"
runat
=
"server"
SelectedIndex
=
"0"
RenderSelectedPageOnly
=
"true"
OnPageViewCreated
=
"RadMultiPage1_PageViewCreated"
>
</
telerik:RadMultiPage
>
</
asp:Panel
>
Regards,
Maria Ilieva
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

Phillip
Top achievements
Rank 1
answered on 23 Feb 2015, 06:21 PM
The user control does not have any Ajax settings. I added the lines to the default.aspx page that loads the user controls. I still get the same error when I run a report. "Sys.InvalidOperationException: Could not find UpdatePanel with ID 'PV4_userControl_ReportViewer1_ReportViewer'. If it is being updated dynamically then it must be inside another UpdatePanel."
Do you have any other suggestions?
Do you have any other suggestions?
0

Phillip
Top achievements
Rank 1
answered on 23 Feb 2015, 06:41 PM
I also tried only the ajax settings you stated on the default.aspx/hosting page. I get the same error also. Do you have any other suggestions.
0
Hello Phillip,
The most common reason for this error is in case nested Ajax settings appear in the application. Can you please revise all the Ajax settings in the application and see if you will be able to isolate some part of the code that is added in double ajaxification.
Regards,
Maria Ilieva
Telerik
The most common reason for this error is in case nested Ajax settings appear in the application. Can you please revise all the Ajax settings in the application and see if you will be able to isolate some part of the code that is added in double ajaxification.
Regards,
Maria Ilieva
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.