I have 3 radGrid controls on a page that require refreshing when a product changes on the fly.
i have a javascript class containing a method Validate() that calls refreshGrids(with a new product id) .
The RadAjaxManager1_AjaxRequest event fires and the grids are repopulated however the grids have not refreshed with the new dataset.
I followed the published examples and tried the solutions on the forum with no success.
I tried moving the code found in GetData into the RadAjaxManager1_AjaxRequest... still no success.
Please advise.
Regards Emran
Designer
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function refreshGrids(arg) {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(arg);
}
</script>
</telerik:RadCodeBlock>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<telerik:UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="rgAnyTo" />
<telerik:AjaxUpdatedControl ControlID="rgSpecificTo" />
<telerik:AjaxUpdatedControl ControlID="rgInformationOnly" />
</telerik:UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<label>Any Switches</label>
<telerik:RadGrid ID="rgAnyTo" runat="server" AutoGenerateColumns="False" GridLines="None" GroupingEnabled="False" ShowHeader="False" >
<HeaderContextMenu>
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</HeaderContextMenu>
<mastertableview>
<Columns>
<telerik:GridBoundColumn DataField="sFullDisplayRecommendation" UniqueName="sFullDisplayRecommendation"></telerik:GridBoundColumn>
</Columns>
</mastertableview>
</telerik:RadGrid>
<label>Specific Switches</label>
<telerik:RadGrid ID="rgSpecificTo" runat="server" AutoGenerateColumns="False" GridLines="None" GroupingEnabled="False" ShowHeader="False" >
<HeaderContextMenu>
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</HeaderContextMenu>
<mastertableview>
<Columns>
<telerik:GridBoundColumn DataField="sFullDisplayRecommendation" UniqueName="sFullDisplayRecommendation"></telerik:GridBoundColumn>
</Columns>
</mastertableview>
</telerik:RadGrid>
<label>Information </label>
<telerik:RadGrid ID="rgInformationOnly" runat="server" AutoGenerateColumns="False" GridLines="None" GroupingEnabled="False" ShowHeader="False">
<HeaderContextMenu>
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</HeaderContextMenu>
<mastertableview>
<Columns>
<telerik:GridBoundColumn DataField="sFullDisplayRecommendation" UniqueName="sFullDisplayRecommendation"></telerik:GridBoundColumn>
</Columns>
</mastertableview>
</telerik:RadGrid>
Code behind
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
GetData(Convert.ToInt32(e.Argument));
}
public void GetData(int OrigProductId)
{
BusinessLib.LinqEntities.CedarLinqDataContext cedar = new BusinessLib.LinqEntities.CedarLinqDataContext();
BusinessLib.LinqEntities.LinqClassesDataContext admin = new BusinessLib.LinqEntities.LinqClassesDataContext();
BusinessLib.LinqEntities.RecommendationSet set = cedar.RecommendationSets.Single(p => p.iRecommendationSetId == 110);
var resultSet = from rt in cedar.RecommendationTrunks
join oProd in cedar.LIVE_Products on new { ProductID = rt.iOriginalProductID, VersionID = set.iDrugVersion } equals
new { ProductID = oProd.iProductID, VersionID = oProd.iVersionID }
join rProd in cedar.LIVE_Products on new { ProductID = rt.iReplacementProductID, VersionID = set.iDrugVersion } equals
new { ProductID = rProd.iProductID, VersionID = rProd.iVersionID } into g2
join oBNF in cedar.LIVE_BNFDetails on new { BNFID = oProd.iBNFID, VersionID = set.iDrugVersion } equals
new { BNFID = oBNF.iBNFID, VersionID = oBNF.iVersionID }
from rProd in g2.DefaultIfEmpty()
where
rt.iRecommendationSetId == NumberUtils.CIntDef(Session["RecommendationSetId"]) &&
rt.bDeleted == false &&
rt.bDisabled == false &&
rt.iDosageTypeID != 2 &&
rt.iOriginalProductID == OrigProductId
select rt;
var rsAny = from rs in resultSet
where
rs.iRecommendationTypeID == (byte)RecommendationType.Switch &&
rs.iDosageTypeID != (byte)DosageType.Specific
select rs;
rgAnyTo.DataSource = rsAny;
rgAnyTo.DataBind();
rgAnyTo.Rebind();
var rsSpecfc = from rs in resultSet
where
rs.iRecommendationTypeID == (byte)RecommendationType.Switch &&
rs.iDosageTypeID == (byte)DosageType.Specific
select rs;
rgSpecificTo.DataSource = rsSpecfc;
rgSpecificTo.DataBind();
rgSpecificTo.Rebind();
var rsInfo = from rs in resultSet
where
rs.iRecommendationTypeID == (byte)RecommendationType.Info
select rs;
rgInformationOnly.DataSource = rsInfo;
rgInformationOnly.DataBind();
rgInformationOnly.Rebind();
}
i have a javascript class containing a method Validate() that calls refreshGrids(with a new product id) .
The RadAjaxManager1_AjaxRequest event fires and the grids are repopulated however the grids have not refreshed with the new dataset.
I followed the published examples and tried the solutions on the forum with no success.
I tried moving the code found in GetData into the RadAjaxManager1_AjaxRequest... still no success.
Please advise.
Regards Emran
Designer
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function refreshGrids(arg) {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(arg);
}
</script>
</telerik:RadCodeBlock>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<telerik:UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="rgAnyTo" />
<telerik:AjaxUpdatedControl ControlID="rgSpecificTo" />
<telerik:AjaxUpdatedControl ControlID="rgInformationOnly" />
</telerik:UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<label>Any Switches</label>
<telerik:RadGrid ID="rgAnyTo" runat="server" AutoGenerateColumns="False" GridLines="None" GroupingEnabled="False" ShowHeader="False" >
<HeaderContextMenu>
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</HeaderContextMenu>
<mastertableview>
<Columns>
<telerik:GridBoundColumn DataField="sFullDisplayRecommendation" UniqueName="sFullDisplayRecommendation"></telerik:GridBoundColumn>
</Columns>
</mastertableview>
</telerik:RadGrid>
<label>Specific Switches</label>
<telerik:RadGrid ID="rgSpecificTo" runat="server" AutoGenerateColumns="False" GridLines="None" GroupingEnabled="False" ShowHeader="False" >
<HeaderContextMenu>
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</HeaderContextMenu>
<mastertableview>
<Columns>
<telerik:GridBoundColumn DataField="sFullDisplayRecommendation" UniqueName="sFullDisplayRecommendation"></telerik:GridBoundColumn>
</Columns>
</mastertableview>
</telerik:RadGrid>
<label>Information </label>
<telerik:RadGrid ID="rgInformationOnly" runat="server" AutoGenerateColumns="False" GridLines="None" GroupingEnabled="False" ShowHeader="False">
<HeaderContextMenu>
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</HeaderContextMenu>
<mastertableview>
<Columns>
<telerik:GridBoundColumn DataField="sFullDisplayRecommendation" UniqueName="sFullDisplayRecommendation"></telerik:GridBoundColumn>
</Columns>
</mastertableview>
</telerik:RadGrid>
Code behind
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
GetData(Convert.ToInt32(e.Argument));
}
public void GetData(int OrigProductId)
{
BusinessLib.LinqEntities.CedarLinqDataContext cedar = new BusinessLib.LinqEntities.CedarLinqDataContext();
BusinessLib.LinqEntities.LinqClassesDataContext admin = new BusinessLib.LinqEntities.LinqClassesDataContext();
BusinessLib.LinqEntities.RecommendationSet set = cedar.RecommendationSets.Single(p => p.iRecommendationSetId == 110);
var resultSet = from rt in cedar.RecommendationTrunks
join oProd in cedar.LIVE_Products on new { ProductID = rt.iOriginalProductID, VersionID = set.iDrugVersion } equals
new { ProductID = oProd.iProductID, VersionID = oProd.iVersionID }
join rProd in cedar.LIVE_Products on new { ProductID = rt.iReplacementProductID, VersionID = set.iDrugVersion } equals
new { ProductID = rProd.iProductID, VersionID = rProd.iVersionID } into g2
join oBNF in cedar.LIVE_BNFDetails on new { BNFID = oProd.iBNFID, VersionID = set.iDrugVersion } equals
new { BNFID = oBNF.iBNFID, VersionID = oBNF.iVersionID }
from rProd in g2.DefaultIfEmpty()
where
rt.iRecommendationSetId == NumberUtils.CIntDef(Session["RecommendationSetId"]) &&
rt.bDeleted == false &&
rt.bDisabled == false &&
rt.iDosageTypeID != 2 &&
rt.iOriginalProductID == OrigProductId
select rt;
var rsAny = from rs in resultSet
where
rs.iRecommendationTypeID == (byte)RecommendationType.Switch &&
rs.iDosageTypeID != (byte)DosageType.Specific
select rs;
rgAnyTo.DataSource = rsAny;
rgAnyTo.DataBind();
rgAnyTo.Rebind();
var rsSpecfc = from rs in resultSet
where
rs.iRecommendationTypeID == (byte)RecommendationType.Switch &&
rs.iDosageTypeID == (byte)DosageType.Specific
select rs;
rgSpecificTo.DataSource = rsSpecfc;
rgSpecificTo.DataBind();
rgSpecificTo.Rebind();
var rsInfo = from rs in resultSet
where
rs.iRecommendationTypeID == (byte)RecommendationType.Info
select rs;
rgInformationOnly.DataSource = rsInfo;
rgInformationOnly.DataBind();
rgInformationOnly.Rebind();
}