Wired_Nerve
Top achievements
Rank 2
Wired_Nerve
asked on 19 Oct 2010, 04:39 PM
I am struggling with figuring out how to prevent an inner grid from triggering an ajaxmanager on a parent grid from repainting the parent grid..
1. The user loads the page.
---------(contains a grid,with expandable rows .. the rows have a tab control. tab 1=a form, tab 2 = inventory list as a grid)
2. The primary grid loads.
3. The user clicks on a row - expands.
4. The user then clicks on a tab (inventory) and a grid is displayed showing a list of items in another grid.
5. The user clicks on the inventory grid in the tab to sort.
6. The ajax seems to fire for the entire page instead of being limited tojust the innner grid in the tab control.
Any ideas?
1. The user loads the page.
---------(contains a grid,with expandable rows .. the rows have a tab control. tab 1=a form, tab 2 = inventory list as a grid)
2. The primary grid loads.
3. The user clicks on a row - expands.
4. The user then clicks on a tab (inventory) and a grid is displayed showing a list of items in another grid.
5. The user clicks on the inventory grid in the tab to sort.
6. The ajax seems to fire for the entire page instead of being limited tojust the innner grid in the tab control.
Any ideas?
5 Answers, 1 is accepted
0
Hi Warren,
Please, review the logic provided in this online demo demonstrating how to perform partial ajaxification (for controls in RadGrid) and let us know if you encounter any problems with implementing it for your scenario.
Regards,
Tsvetina
the Telerik team
Please, review the logic provided in this online demo demonstrating how to perform partial ajaxification (for controls in RadGrid) and let us know if you encounter any problems with implementing it for your scenario.
Regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Wired_Nerve
Top achievements
Rank 2
answered on 22 Oct 2010, 02:38 PM
This solution did not really aid me. I will try and attach my code for this page to see if they helps point out the issue...
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Nav.Master" AutoEventWireup="true"
CodeBehind="Students.aspx.cs" Inherits="TIPWebIT.StudentManagement.Students" %>
<%@ MasterType TypeName="TIPWebCommon.MasterPages.Nav" %>
<%@ Register TagPrefix="custom" Namespace="TIPWebCommon.FilteringTemplateColumns"
Assembly="TIPWebIT" %>
<%@ Register Src="StudentDetails.ascx" TagName="StudentDetails" TagPrefix="uc1" %>
<%@ Register Src="StudentInventory.ascx" TagName="StudentInventory" TagPrefix="uc1" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"head"
runat
=
"server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
runat
=
"server"
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function ShowViewStateSize() {
var buf = document.forms[0]["__VIEWSTATE"].value;
alert("View state is " + buf.length + " bytes");
}
function ChildRowClick(sender, eventArgs) {
eventArgs.get_domEvent().preventDefault();
eventArgs.get_domEvent().stopPropagation();
}
</
script
>
</
telerik:RadCodeBlock
>
<
telerik:RadGrid
ID
=
"RadGridStudents"
runat
=
"server"
DataSourceID
=
"LdsStudents"
AutoGenerateColumns
=
"False"
PageSize
=
"10"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
OnItemCreated
=
"RadGridStudents_ItemCreated"
OnPreRender
=
"RadGridStudents_PreRender"
OnItemDataBound
=
"RadGridStudents_ItemDataBound"
OnItemCommand
=
"RadGridStudents_ItemCommand"
OnExcelMLExportStylesCreated
=
"RadGridStudents_ExcelMLExportStylesCreated"
GridLines
=
"None"
>
<
ExportSettings
>
<
Excel
Format
=
"ExcelML"
/>
</
ExportSettings
>
<
MasterTableView
AutoGenerateColumns
=
"False"
DataKeyNames
=
"StudentsUID"
DataSourceID
=
"LdsStudents"
UseAllDataFields
=
"true"
GroupLoadMode
=
"Server"
>
<
CommandItemTemplate
>
<
div
class
=
"HeaderLeft"
>
<
table
>
<
tr
>
<
td
>
<
asp:ImageButton
runat
=
"server"
ID
=
"ImageButtonAddRecord"
ToolTip
=
"Add Record"
AlternateText
=
"Add Record"
CommandName
=
"InitInsert"
/>
</
td
>
<
td
>
<
asp:LinkButton
runat
=
"server"
ID
=
"LinkButtonAddRecord"
Text
=
"Add Record"
CommandName
=
"InitInsert"
/>
</
td
>
<
td
>
<
asp:CheckBox
ID
=
"CheckShowInactive"
runat
=
"server"
AutoPostBack
=
"True"
OnCheckedChanged
=
"CheckShowInactive_CheckedChanged"
/>
</
td
>
<
td
>
<
asp:LinkButton
ID
=
"LinkButtonShowInactive"
runat
=
"server"
Text
=
"Show Inactive"
OnClick
=
"CheckShowInactive_CheckedChanged"
/>
</
td
>
</
tr
>
</
table
>
</
div
>
<
div
class
=
"HeaderRight"
>
<
table
>
<
tr
>
<
td
>
<
asp:LinkButton
ID
=
"ExportToPdf"
ToolTip
=
"Export to PDF"
runat
=
"server"
OnClick
=
"ExportToPdfClick"
CommandName
=
"ExportToPdf"
CssClass
=
"rgExpPDF"
Height
=
"16px"
Width
=
"16px"
/>
</
td
>
<
td
>
<
asp:LinkButton
ID
=
"ExportToExcel"
ToolTip
=
"Export to Excel"
runat
=
"server"
OnClick
=
"ExportToExcelClick"
CommandName
=
"ExportToExcel"
CssClass
=
"rgExpXLS"
Height
=
"16px"
Width
=
"16px"
/>
</
td
>
<
td
>
<
asp:ImageButton
runat
=
"server"
ID
=
"ImageButtonRefresh"
ToolTip
=
"Refresh"
AlternateText
=
"Refresh"
OnClientClick
=
"window.location = 'Students.aspx'; return false;"
/>
</
td
>
<
td
>
<
asp:LinkButton
runat
=
"server"
ID
=
"LinkButtonRefresh"
Text
=
"Refresh"
OnClientClick
=
"window.location = 'Students.aspx'; return false;"
/>
</
td
>
</
tr
>
</
table
>
</
div
>
</
CommandItemTemplate
>
<
NestedViewTemplate
>
<
asp:Panel
ID
=
"PanelNestedView"
runat
=
"server"
CssClass
=
"EditFormTabs"
Visible
=
"false"
>
<
telerik:RadTabStrip
runat
=
"server"
ID
=
"TabStrip1"
MultiPageID
=
"MultiPage1"
SelectedIndex
=
"1"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Details"
Selected
=
"false"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Inventory"
Selected
=
"true"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
runat
=
"server"
ID
=
"MultiPage1"
SelectedIndex
=
"1"
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"StudentDetailsPageView"
Selected
=
"false"
>
<
uc1:StudentDetails
ID
=
"StudentDetails"
runat
=
"server"
/>
</
telerik:RadPageView
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"StudentInventoryPageView"
Selected
=
"true"
>
<
uc1:StudentInventory
ID
=
"StudentInventory"
runat
=
"server"
/>
</
telerik:RadPageView
>
</
telerik:RadMultiPage
>
</
asp:Panel
>
</
NestedViewTemplate
>
<
EditFormSettings
UserControlName
=
"StudentDetails.ascx"
EditFormType
=
"WebUserControl"
>
<
EditColumn
UniqueName
=
"EditCommandColumn1"
>
</
EditColumn
>
</
EditFormSettings
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
></
CommandItemSettings
>
<
ExpandCollapseColumn
Visible
=
"True"
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
UniqueName
=
"EditCommandColumn"
>
<
ItemStyle
HorizontalAlign
=
"Center"
/>
</
telerik:GridEditCommandColumn
>
<
telerik:GridTemplateColumn
DataField
=
"StudentID"
HeaderText
=
"Student ID"
SortExpression
=
"StudentID"
UniqueName
=
"StudentID"
CurrentFilterFunction
=
"StartsWith"
ShowFilterIcon
=
"False"
AutoPostBackOnFilter
=
"True"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"StudentIDLabel"
runat
=
"server"
Text='<%# Eval("StudentID") %>' ToolTip='<%# Eval("StudentsUID") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"FirstName"
HeaderText
=
"First"
SortExpression
=
"FirstName"
UniqueName
=
"FirstName"
CurrentFilterFunction
=
"StartsWith"
ShowFilterIcon
=
"False"
AutoPostBackOnFilter
=
"True"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"FirstNameLabel"
runat
=
"server"
Text='<%# Eval("FirstName") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"MiddleName"
HeaderText
=
"Middle"
SortExpression
=
"MiddleName"
UniqueName
=
"MiddleName"
CurrentFilterFunction
=
"StartsWith"
ShowFilterIcon
=
"False"
AutoPostBackOnFilter
=
"True"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"MiddleNameLabel"
runat
=
"server"
Text='<%# Eval("MiddleName") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"LastName"
HeaderText
=
"Last"
SortExpression
=
"LastName"
UniqueName
=
"LastName"
CurrentFilterFunction
=
"StartsWith"
ShowFilterIcon
=
"False"
AutoPostBackOnFilter
=
"True"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"LastNameLabel"
runat
=
"server"
Text='<%# Eval("LastName") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
custom:FilteringColumn
DataField
=
"Grade"
UniqueName
=
"GradeName"
HeaderText
=
"Grade"
TableName
=
"LdsGrades"
SortExpression
=
"SortOrder"
ShowFilterIcon
=
"false"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"GradeNameLabel"
runat
=
"server"
Text='<%# Eval("Grade") %>' />
</
ItemTemplate
>
</
custom:FilteringColumn
>
<
telerik:GridTemplateColumn
DataField
=
"HomeRoom"
HeaderText
=
"Homeroom"
SortExpression
=
"HomeRoom"
UniqueName
=
"HomeRoom"
ShowFilterIcon
=
"False"
AutoPostBackOnFilter
=
"true"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"HomeRoomLabel"
runat
=
"server"
Text='<%# Eval("HomeRoom") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Issue"
UniqueName
=
"TemplateColumn"
ShowFilterIcon
=
"false"
AllowFiltering
=
"False"
>
<
ItemTemplate
>
<
asp:ImageButton
ID
=
"IssueInventoryImageButton"
runat
=
"server"
AlternateText
=
"Issue Inventory to Student"
CommandArgument='<%# Eval("StudentsUID") %>' CommandName="IssueStudentInventory"
ImageUrl="~/Images/Issue_16.gif" ToolTip="Issue Inventory to Student." ImageAlign="Middle">
</
asp:ImageButton
>
<
asp:ImageButton
ID
=
"InventoryHistoryImageButton"
runat
=
"server"
AlternateText
=
"Inventory History"
CommandArgument='<%# Eval("StudentsUID") %>' CommandName="InventoryHistory" ImageUrl="~/Images/History_16.gif"
ToolTip="Inventory History" ImageAlign="Middle"></
asp:ImageButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
>
</
telerik:RadAjaxLoadingPanel
>
<
asp:LinqDataSource
ID
=
"LdsGrades"
runat
=
"server"
ContextTypeName
=
"TIPWebITLibrary.DAL.TIPWebITDataContext"
Select
=
"new (GradeUID, GradeName AS Grade, GradeDescription, SortOrder)"
TableName
=
"tblUnvGrades"
OrderBy
=
"SortOrder, GradeName"
>
</
asp:LinqDataSource
>
<
asp:LinqDataSource
ID
=
"LdsStudents"
runat
=
"server"
ContextTypeName
=
"TIPWebITLibrary.DAL.TIPWebITDataContext"
TableName
=
"VTechStudents"
Where
=
"Status != @Status && CampusID == @CampusID && StudentsUID == @StudentsUID"
OrderBy
=
"LastName, FirstName, MiddleName"
>
<
WhereParameters
>
<
asp:ControlParameter
ControlID
=
"HiddenFieldShowInactive"
Name
=
"Status"
DefaultValue
=
"0"
PropertyName
=
"Value"
Type
=
"Int32"
/>
</
WhereParameters
>
</
asp:LinqDataSource
>
<
asp:HiddenField
ID
=
"HiddenFieldShowInactive"
runat
=
"server"
Value
=
"0"
/>
</
asp:Content
>
using
System;
using
System.Globalization;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
Telerik.Web.UI;
using
Telerik.Web.UI.GridExcelBuilder;
using
TIPWebITLibrary.BLL.Common;
using
TIPWebITLibrary.Utilities.Encryption;
namespace
TIPWebIT.StudentManagement
{
public
partial
class
Students : System.Web.UI.Page
{
private
bool
excelExport;
private
bool
pdfExport;
private
bool
recentActivityFlag;
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
RadGridStudents.MasterTableView.PageSize = 10;
Master.HeaderImagePath =
"~/Images/student.gif"
;
Master.HeaderText =
"Students"
;
LdsStudents.WhereParameters.Add(
"CampusID"
, System.Data.DbType.String, Convert.ToString(
this
.Master.SessionUser.SiteID, CultureInfo.InvariantCulture));
}
((GridEditCommandColumn)RadGridStudents.MasterTableView.Columns.FindByUniqueName(
"EditCommandColumn"
)).EditImageUrl =
"~/App_Themes/"
+ Page.Theme +
"/Grid/Edit.gif"
;
// This code will intercept the querystring if there is one for the the ActivityUID
// and instantiates an object based on that ActivityUID to be used downstream
// This snipped of code should be used on all landing pages that have the Recent Activities feature. - WCL- See if this can be migrated to the master page
string
qsActivityUID = Request.QueryString[
"ActivityUID"
];
if
(!
string
.IsNullOrEmpty(qsActivityUID))
{
Int32 ActivityUID;
try
{
ActivityUID = Convert.ToInt32(Encryption64.DecryptQueryString(qsActivityUID.ToString(CultureInfo.InvariantCulture)), CultureInfo.InvariantCulture);
}
catch
(Exception)
{
throw
new
InvalidOperationException(
"Invalid Query String Value!"
);
}
SavedActivity oActivity =
new
SavedActivity(ActivityUID);
if
(Page.IsPostBack)
{
if
(!
string
.IsNullOrEmpty(RadGridStudents.MasterTableView.FilterExpression))
{
ClearFilters(
ref
RadGridStudents);
recentActivityFlag =
true
;
}
if
(LdsStudents.WhereParameters.Count > 2)
{
if
(LdsStudents.WhereParameters[2].DefaultValue != oActivity.Parameter.ToString(CultureInfo.InvariantCulture))
{
LdsStudents.WhereParameters[2].DefaultValue = oActivity.Parameter.ToString(CultureInfo.InvariantCulture);
recentActivityFlag =
true
;
}
}
else
{
LdsStudents.WhereParameters.Add(
"StudentsUID"
, System.Data.DbType.Int32, oActivity.Parameter.ToString(CultureInfo.InvariantCulture));
recentActivityFlag =
true
;
}
}
else
{
LdsStudents.WhereParameters.Add(
"StudentsUID"
, System.Data.DbType.Int32, oActivity.Parameter.ToString(CultureInfo.InvariantCulture));
}
}
}
protected
void
RadGridStudents_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridNestedViewItem)
{
e.Item.FindControl(
"PanelNestedView"
).Visible = ((GridNestedViewItem)e.Item).ParentItem.Expanded;
}
if
(e.Item
is
GridCommandItem)
{
((ImageButton)e.Item.FindControl(
"ImageButtonAddRecord"
)).ImageUrl =
"~/App_Themes/"
+ Page.Theme +
"/Grid/AddRecord.gif"
;
((ImageButton)e.Item.FindControl(
"ImageButtonRefresh"
)).ImageUrl =
"~/App_Themes/"
+ Page.Theme +
"/Grid/Refresh.gif"
;
if
(
this
.HiddenFieldShowInactive.Value ==
"1"
)
{
((CheckBox)e.Item.FindControl(
"CheckShowInactive"
)).Checked =
true
;
}
}
if
(excelExport)
{
if
(e.Item
is
GridFilteringItem || e.Item
is
GridEditFormItem)
{
e.Item.Visible =
false
;
}
}
if
(pdfExport)
{
if
(e.Item
is
GridDataItem)
e.Item.Style[
"background-color"
] =
"#FFFFFF"
;
}
}
protected
void
RadGridStudents_ItemCommand(
object
source, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.ExpandCollapseCommandName || e.CommandName ==
"RowClick"
)
{
((GridDataItem)e.Item).ChildItem.FindControl(
"PanelNestedView"
).Visible =
!e.Item.Expanded;
}
if
(ViewState[
"CheckStatus"
] !=
null
)
{
if
(Convert.ToBoolean(ViewState[
"CheckStatus"
], CultureInfo.InvariantCulture))
{
this
.HiddenFieldShowInactive.Value =
"1"
;
}
else
{
this
.HiddenFieldShowInactive.Value =
"0"
;
}
}
GridDataItem selectedItem =
null
;
switch
(e.CommandName)
{
case
"ExportToExcel"
:
excelExport =
true
;
break
;
case
"ExportToPdf"
:
pdfExport =
true
;
break
;
case
"Update"
:
case
"PerformInsert"
:
Master.ShowRecentActivities();
break
;
case
"Edit"
:
this
.RadGridStudents.MasterTableView.IsItemInserted =
false
;
break
;
case
"InitInsert"
:
this
.RadGridStudents.MasterTableView.ClearEditItems();
break
;
case
"Filter"
:
foreach
(GridDataItem item
in
this
.RadGridStudents.Items)
{
item.Expanded =
false
;
}
this
.RadGridStudents.MasterTableView.ClearEditItems();
break
;
case
"ExpandCollapse"
:
selectedItem = (GridDataItem)e.Item;
if
(selectedItem.Expanded)
{
//Collapsing
selectedItem.Selected =
false
;
}
else
{
//Expanding
foreach
(GridDataItem item
in
this
.RadGridStudents.Items)
{
item.Expanded =
false
;
}
this
.RadGridStudents.MasterTableView.ClearEditItems();
this
.RadGridStudents.MasterTableView.ClearSelectedItems();
selectedItem.Selected =
true
;
}
break
;
case
"RowClick"
:
selectedItem = (GridDataItem)e.Item;
if
(selectedItem.Expanded)
{
selectedItem.Selected =
false
;
selectedItem.Expanded =
false
;
}
else
{
foreach
(GridDataItem item
in
this
.RadGridStudents.Items)
{
item.Expanded =
false
;
}
this
.RadGridStudents.MasterTableView.ClearEditItems();
this
.RadGridStudents.MasterTableView.ClearSelectedItems();
selectedItem.Selected =
true
;
selectedItem.Expanded =
true
;
}
break
;
}
}
static
void
ClearFilters(
ref
RadGrid grid)
{
grid.MasterTableView.FilterExpression =
string
.Empty;
foreach
(GridColumn column
in
grid.MasterTableView.RenderColumns)
{
GridTemplateColumn templateColumn = column
as
GridTemplateColumn;
if
(templateColumn !=
null
)
{
templateColumn.CurrentFilterValue =
string
.Empty;
}
}
}
public
void
RadAjaxManager1_AjaxRequest(
object
sender, AjaxRequestEventArgs e)
{
if
(e.Argument ==
"RadWindowGrades"
)
{
StudentDetails myStudentDetails =
null
;
if
(RadGridStudents.MasterTableView.IsItemInserted ==
true
)
{
myStudentDetails = (StudentDetails)RadGridStudents.MasterTableView.GetInsertItem().FindControl(GridEditFormItem.EditFormUserControlID);
}
else
{
foreach
(GridEditFormItem item
in
this
.RadGridStudents.MasterTableView.GetItems(GridItemType.EditFormItem))
{
if
(item.IsInEditMode)
{
myStudentDetails = (StudentDetails)item.FindControl(GridEditFormItem.EditFormUserControlID);
}
}
}
if
(myStudentDetails !=
null
)
{
if
(e.Argument ==
"RadWindowGrades"
)
{
RadComboBox ddlGrade = (RadComboBox)myStudentDetails.FindControl(
"ddlGrade"
);
ddlGrade.Items.Clear();
ddlGrade.Items.Add(
new
RadComboBoxItem(
""
,
""
));
ddlGrade.DataBind();
}
}
}
else
if
(e.Argument.Contains(
"ReturnInventoryItem"
))
{
string
MyArgument = e.Argument.ToString();
string
[] split = MyArgument.Split(
new
Char[] {
':'
});
Int32 inventoryUID = Convert.ToInt32(split[1], CultureInfo.InvariantCulture);
CollectFromStudent(inventoryUID);
//RadGridStudents.MasterTableView.Rebind();
//FIND User Control and rebind
foreach
(GridDataItem item
in
RadGridStudents.Items)
{
if
(item.Selected)
{
if
(item.ChildItem
is
GridNestedViewItem)
{
GridNestedViewItem nv = (GridNestedViewItem)item.ChildItem;
var si = nv.FindControl(
"StudentInventory"
);
if
(si !=
null
)
{
si.DataBind();
}
}
}
}
}
else
{
RadGridStudents.MasterTableView.Rebind();
}
}
protected
void
RadGridStudents_PreRender(
object
sender, EventArgs e)
{
if
(recentActivityFlag)
{
RadGridStudents.MasterTableView.Rebind();
recentActivityFlag =
false
;
}
if
(RadGridStudents.MasterTableView.Items.Count == 1 && !RadGridStudents.MasterTableView.Items[0].EditFormItem.Visible && !RadGridStudents.MasterTableView.IsItemInserted)
{
RadGridStudents.MasterTableView.Items[0].Selected =
true
;
RadGridStudents.MasterTableView.Items[0].Expanded =
true
;
}
if
(ViewState[
"CheckStatus"
] !=
null
)
{
GridItem commandItem = RadGridStudents.MasterTableView.GetItems(GridItemType.CommandItem)[0];
CheckBox checkBox = (CheckBox)commandItem.FindControl(
"CheckShowInactive"
);
if
(ViewState[
"CheckStatus"
].ToString() ==
"true"
)
{
checkBox.Checked =
true
;
this
.HiddenFieldShowInactive.Value =
"1"
;
}
else
{
checkBox.Checked =
false
;
this
.HiddenFieldShowInactive.Value =
"0"
;
}
}
((GridTemplateColumn)
this
.RadGridStudents.MasterTableView.Columns.FindByUniqueName(
"StudentID"
)).CurrentFilterFunction = GridKnownFunction.StartsWith;
((GridTemplateColumn)
this
.RadGridStudents.MasterTableView.Columns.FindByUniqueName(
"FirstName"
)).CurrentFilterFunction = GridKnownFunction.StartsWith;
((GridTemplateColumn)
this
.RadGridStudents.MasterTableView.Columns.FindByUniqueName(
"MiddleName"
)).CurrentFilterFunction = GridKnownFunction.StartsWith;
((GridTemplateColumn)
this
.RadGridStudents.MasterTableView.Columns.FindByUniqueName(
"LastName"
)).CurrentFilterFunction = GridKnownFunction.StartsWith;
}
private
static
void
CollectFromStudent(
int
InventoryUID)
{
//Get the Inventory Item being collected
TIPWebITLibrary.BLL.InventoryManagement.Inventory StudentInventory =
new
TIPWebITLibrary.BLL.InventoryManagement.Inventory(InventoryUID);
// Get the last valid return source.
//Get the Entity information for the room it was last in via the history
TIPWebITLibrary.BLL.InventoryManagement.InventoryHistory myInvHistory =
new
TIPWebITLibrary.BLL.InventoryManagement.InventoryHistory();
foreach
(var item
in
myInvHistory.SelectByInventoryUID(InventoryUID))
{
if
(item.OriginEntityTypeUID == 3)
// STAFF
{
// determine if item (staff) is active
TIPWebITLibrary.BLL.StaffManagement.Staff oStaff =
new
TIPWebITLibrary.BLL.StaffManagement.Staff(item.OriginEntityUID);
if
(oStaff.Status ==
true
)
{
StudentInventory.EntityTypeUID = item.OriginEntityTypeUID;
StudentInventory.EntityUID = item.OriginEntityUID;
StudentInventory.StatusUID = item.OriginStatusUID;
StudentInventory.Update();
break
;
}
}
if
(item.OriginEntityTypeUID == 2)
// 2 = room
{
StudentInventory.EntityTypeUID = item.OriginEntityTypeUID;
StudentInventory.EntityUID = item.OriginEntityUID;
StudentInventory.StatusUID = item.OriginStatusUID;
StudentInventory.Update();
break
;
}
}
}
protected
void
CheckShowInactive_CheckedChanged(
object
sender, EventArgs e)
{
CheckBox checkStatus;
LinkButton linkButtonSender = sender
as
LinkButton;
if
(linkButtonSender !=
null
)
{
checkStatus = (CheckBox)linkButtonSender.Parent.FindControl(
"CheckShowInactive"
);
if
(checkStatus.Checked)
{
checkStatus.Checked =
false
;
}
else
{
checkStatus.Checked =
true
;
}
}
else
{
checkStatus = (CheckBox)sender;
}
if
(checkStatus.Checked)
{
ViewState[
"CheckStatus"
] =
"true"
;
this
.HiddenFieldShowInactive.Value =
"1"
;
}
else
{
ViewState[
"CheckStatus"
] =
"false"
;
this
.HiddenFieldShowInactive.Value =
"0"
;
}
RadGridStudents.MasterTableView.ClearEditItems();
}
protected
void
RadGridStudents_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridPagerItem)
{
RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl(
"PageSizeComboBox"
);
PageSizeCombo.Items.Clear();
PageSizeCombo.Items.Add(
new
RadComboBoxItem(
"10"
));
PageSizeCombo.FindItemByText(
"10"
).Attributes.Add(
"ownerTableViewId"
, RadGridStudents.MasterTableView.ClientID);
PageSizeCombo.Items.Add(
new
RadComboBoxItem(
"20"
));
PageSizeCombo.FindItemByText(
"20"
).Attributes.Add(
"ownerTableViewId"
, RadGridStudents.MasterTableView.ClientID);
PageSizeCombo.Items.Add(
new
RadComboBoxItem(
"50"
));
PageSizeCombo.FindItemByText(
"50"
).Attributes.Add(
"ownerTableViewId"
, RadGridStudents.MasterTableView.ClientID);
PageSizeCombo.Items.Add(
new
RadComboBoxItem(
"100"
));
PageSizeCombo.FindItemByText(
"100"
).Attributes.Add(
"ownerTableViewId"
, RadGridStudents.MasterTableView.ClientID);
PageSizeCombo.Items.Add(
new
RadComboBoxItem(
"250"
));
PageSizeCombo.FindItemByText(
"250"
).Attributes.Add(
"ownerTableViewId"
, RadGridStudents.MasterTableView.ClientID);
PageSizeCombo.Items.Add(
new
RadComboBoxItem(
"300"
));
PageSizeCombo.FindItemByText(
"300"
).Attributes.Add(
"ownerTableViewId"
, RadGridStudents.MasterTableView.ClientID);
PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString(CultureInfo.InvariantCulture)).Selected =
true
;
}
if
(e.Item
is
GridDataItem)
{
System.Web.UI.WebControls.ImageButton IssueInventoryImageButton = (System.Web.UI.WebControls.ImageButton)e.Item.FindControl(
"IssueInventoryImageButton"
);
IssueInventoryImageButton.Attributes.Add(
"onclick"
,
"javascript:OpenWindowNav('InventoryManagement/IssuanceManagement.aspx?EntityUID="
+ IssueInventoryImageButton.CommandArgument.ToString() +
"&IssuanceType=Student','RadWindowIssuance'); return false;"
);
System.Web.UI.WebControls.ImageButton InventoryHistoryImageButton = (System.Web.UI.WebControls.ImageButton)e.Item.FindControl(
"InventoryHistoryImageButton"
);
InventoryHistoryImageButton.Attributes.Add(
"onclick"
,
"javascript:OpenWindowNav('Common/InventoryHistory.aspx?EntityTypeUID=4&EntityUID="
+ InventoryHistoryImageButton.CommandArgument.ToString() +
"','RadWindowInventoryHistory'); return false;"
);
}
}
private
void
ConfigureExcelExport()
{
this
.RadGridStudents.ExportSettings.OpenInNewWindow =
true
;
this
.RadGridStudents.ExportSettings.ExportOnlyData =
true
;
this
.RadGridStudents.ExportSettings.IgnorePaging =
true
;
this
.RadGridStudents.MasterTableView.Columns.FindByUniqueName(
"EditCommandColumn"
).Visible =
false
;
this
.RadGridStudents.MasterTableView.Columns.FindByUniqueName(
"IssueColumn"
).Visible =
false
;
this
.RadGridStudents.ExportSettings.FileName =
"Students"
;
}
private
void
ConfigurePDFExport()
{
this
.RadGridStudents.ExportSettings.OpenInNewWindow =
true
;
this
.RadGridStudents.ExportSettings.ExportOnlyData =
true
;
this
.RadGridStudents.ExportSettings.IgnorePaging =
true
;
this
.RadGridStudents.ExportSettings.Pdf.PageTitle =
"Students"
;
this
.RadGridStudents.ExportSettings.Pdf.PageHeight = Unit.Parse(
"210mm"
, CultureInfo.InvariantCulture);
this
.RadGridStudents.ExportSettings.Pdf.PageWidth = Unit.Parse(
"297mm"
, CultureInfo.InvariantCulture);
this
.RadGridStudents.MasterTableView.Columns.FindByUniqueName(
"EditCommandColumn"
).Visible =
false
;
this
.RadGridStudents.MasterTableView.Columns.FindByUniqueName(
"IssueColumn"
).Visible =
false
;
this
.RadGridStudents.ExportSettings.FileName =
"Students"
;
}
protected
void
ExportToExcelClick(
object
sender, EventArgs e)
{
this
.ConfigureExcelExport();
this
.RadGridStudents.MasterTableView.ExportToExcel();
}
protected
void
ExportToPdfClick(
object
sender, EventArgs e)
{
this
.ConfigurePDFExport();
this
.RadGridStudents.MasterTableView.ExportToPdf();
}
protected
void
RadGridStudents_ExcelMLExportStylesCreated(
object
source, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLStyleCreatedArgs e)
{
foreach
(StyleElement style
in
e.Styles)
{
switch
(style.Id)
{
case
"headerStyle"
:
style.FontStyle.Bold =
true
;
style.FontStyle.Color = System.Drawing.Color.Black;
style.InteriorStyle.Color = System.Drawing.Color.LightGray;
style.InteriorStyle.Pattern = InteriorPatternType.Solid;
break
;
case
"itemStyle"
:
//style.InteriorStyle.Color = System.Drawing.Color.WhiteSmoke;
//style.InteriorStyle.Pattern = InteriorPatternType.Solid;
break
;
case
"alternatingItemStyle"
:
//style.InteriorStyle.Color = System.Drawing.Color.LightGray;
//style.InteriorStyle.Pattern = InteriorPatternType.Solid;
break
;
}
}
}
}
}
0
Hi Warren,
I would also need to see your AjaxSettings in order to see your idea of ajaxifying the controls in your page. I see that you also have a master page and I assume the settings are presented in it, so it would be helpful if you share that part as well.
My suggestion is that you send us the full code for the pages related to the problemmatic scenario in a formal support ticket, so we can run a test page using your logic and inspect the behavior of the ajaxified controls locally.
Greetings,
Tsvetina
the Telerik team
I would also need to see your AjaxSettings in order to see your idea of ajaxifying the controls in your page. I see that you also have a master page and I assume the settings are presented in it, so it would be helpful if you share that part as well.
My suggestion is that you send us the full code for the pages related to the problemmatic scenario in a formal support ticket, so we can run a test page using your logic and inspect the behavior of the ajaxified controls locally.
Greetings,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Wired_Nerve
Top achievements
Rank 2
answered on 29 Oct 2010, 07:27 PM
It would be easier to look at the files in a zip... See link:
http://cid-eca89497e9f9a1b2.skydrive.live.com/redir.aspx?resid=ECA89497E9F9A1B2!2519
If you can't get to it I will post the file info here...
http://cid-eca89497e9f9a1b2.skydrive.live.com/redir.aspx?resid=ECA89497E9F9A1B2!2519
If you can't get to it I will post the file info here...
0
Hi Warren,
The first thing which I noticed is that you have set RadAjaxManager as AJAX initiator for all grids in the page. This would mean that on any AJAX request on the page, these five RadGrid controls will be updated, thus including the callback to refresh the other controls they are set up to update, so this results in most of the page being updated.
Could you please remove this setting from the manager's set up and see if the undesired behavior persists?
Kind regards,
Tsvetina
the Telerik team
The first thing which I noticed is that you have set RadAjaxManager as AJAX initiator for all grids in the page. This would mean that on any AJAX request on the page, these five RadGrid controls will be updated, thus including the callback to refresh the other controls they are set up to update, so this results in most of the page being updated.
Could you please remove this setting from the manager's set up and see if the undesired behavior persists?
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGridSites"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGridRooms"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGridStaff"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGridStudents"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGridHardware"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
Kind regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items