Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
318 views

Hi,

    I am using Rad numeric text box in my page. Am trying to set the value of numeric text box on seleting a drop down list. But its not displaying the data. And i tried to set the value in prerender of text box also.. that is also not working . How to set the value of rad numeric text box in code behind. If i assign directly to value property its working.. If am assigning from viewstate its not working.

Here is the code i tried:

protected void dropDownListResource_SelectedIndexChanged(object sender, EventArgs e)
        {
double DailyRateToUse = val; //val - viewstate variable
 radNumericTextboxRate.Value = Convert.ToDouble(DailyRateToUse);
        }
    protected void radNumericTextboxRate_PreRender(object sender, EventArgs e)
        {
double DailyRateToUse = val//val - viewstate variabledouble
radNumericTextboxRate.Value = Convert.ToDouble(DailyRateToUse);
  
}

Thanks
Esther
Jayesh Goyani
Top achievements
Rank 2
 answered on 03 Aug 2011
3 answers
94 views
I have a grid that binds to a list of objects. The object has an 'ArtistID' which is not displayed in the grid and is not a data key

I need to gain access to this in the UpdateCommand event, but I just cant figure out how its done. 

anyone help ?
mww
Top achievements
Rank 1
 answered on 03 Aug 2011
1 answer
73 views
Hi,

I can't figure out how to make use of the GridGroupLoadMode.Client, define groups on the server and at the same time selectively collapse certain groups when the grid initially loads.  I'm loading the groups just fine, but when I try to set groupHeader.Expanded = false in the Pre_Render event, I get javascript errors and things don't work right afterwards (context menu doesn't expand, date picker for the filter box does not show, etc).  Do you have an example of how to achieve this?
Maria Ilieva
Telerik team
 answered on 03 Aug 2011
1 answer
158 views
Hi,

I am trying to implement "Export to Excel" functionality in a ASP.Net Ajax nested grid. The grid is a user control which displays the results.

I have used the RadAjaxManager on my main page (where the grid user control is displayed) and RadAjaxManagerProxy on the user control.
<%@ Page Title="" Language="C#" MasterPageFile="~/UserAccess.Master" AutoEventWireup="true"
    CodeBehind="QuoteAndPolicy.aspx.cs" Inherits="PASCore.UserAccess.QuoteAndPolicy" %>
  
<%@ Register Src="CustomControls/SearchPanel.ascx" TagName="SearchPanel" TagPrefix="search" %>
<%@ Register Src="CustomControls/QuoteAndPolicyGrid.ascx" TagName="QuoteAndPolicyGrid" TagPrefix="search" %>
  
<%-- Title of the web page  --%>
<asp:content id="Title" contentplaceholderid="PageTitlePlaceHolder" runat="server">
User Access - Quote/ Policy
</asp:content>
<%-- Main Search Panel --%>
<asp:content ContentPlaceHolderID="mainContentPlaceHolder" runat="server">   
    <telerik:RadAjaxManager ID="radAjaxManager" runat="server"/>
    <script type="text/javascript" src="Scripts/QuoteAndPolicy.js"></script
  
    <asp:table id="searchPanelTable" runat="server">
        <asp:tablerow runat="server">
            <asp:tablecell runat="server">
                <search:SearchPanel ID="SearchPanel" runat="server" />
            </asp:tablecell>
        </asp:tablerow>
    </asp:table>
    <asp:table id="searchResultsTable" runat="server">
        <asp:tablerow runat="server">
            <asp:tablecell runat="server">
                <search:QuoteAndPolicyGrid ID="QuoteAndPolicyGrid" runat="server" />
            </asp:tablecell>
        </asp:tablerow>
    </asp:table>
</asp:content>

User Control html code:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuoteAndPolicyGrid.ascx.cs"
    Inherits="PASCore.UserAccess.Controls.QuoteAndPolicyGrid" %>
<%@ Register Src="QuoteAndPolicyActions.ascx" TagName="QuoteAndpolicyActions" TagPrefix="Action" %>
<style type="text/css">
    .viewWrap
    {
        color: #819598;
        font-weight: bold;
        font-size: 16px;
        padding-top: 5px;
        padding-left: 15px;
        padding-bottom: 10px;
        padding-right: 5px;
    }
      
      
    .AjaxLoadingPanel
    {
        background: #fff url(Content/Images/loading.gif) center center no-repeat;
    }
      
    .RadGridPager
    {
        height: 51px;
        padding-left: 5px;
        background-color: white;
        vertical-align: bottom;
        color: #b79ea9;
        font-weight: bold;
    }
      
    .RadGridItemStyle
    {
        border-right: solid 1px gray !important;
    }
</style>
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="gridResults">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="gridResults" LoadingPanelID="radAjaxLoadingPanel" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
  
  
<telerik:RadAjaxLoadingPanel ID="radAjaxLoadingPanel" runat="server" Transparency="25" CssClass="AjaxLoadingPanel" />
<telerik:RadGrid ID="gridResults" runat="server" CellSpacing="0" GridLines="Both"
    AllowPaging="True" PageSize="20" ShowGroupPanel="True" OnItemCommand="GridResult_ItemCommand"
    OnNeedDataSource="MainGrid_NeedDataSource" BorderStyle="Solid" GroupingEnabled="true"
    AutoGenerateColumns="false" AllowSorting="true" Width="100%">
    <ClientSettings AllowColumnsReorder="false" ReorderColumnsOnClient="true" AllowAutoScrollOnDragDrop="True">
        <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True"
            AllowColumnResize="True"></Resizing>
    </ClientSettings>
    <PagerStyle CssClass="RadGridPager" Mode="NextPrevNumericAndAdvanced"></PagerStyle>
    <SortingSettings></SortingSettings>
    <ExportSettings HideStructureColumns="true" />
    <MasterTableView AllowMultiColumnSorting="True" EditMode="PopUp" CommandItemDisplay="Top">
        <NestedViewTemplate>
            <asp:panel runat="server" id="InnerContainer" cssclass="viewWrap" visible="false">
                <telerik:RadTabStrip runat="server" ID="TabStrip" MultiPageID="Multipage" SelectedIndex="0">
                    <tabs>
                  <telerik:RadTab runat="server" Text="Additional Info" PageViewID="additionalInfoView">
                  </telerik:RadTab>
                  <telerik:RadTab runat="server" Text="Coverage Details" PageViewID="coverageDetailsView">
                  </telerik:RadTab>
                </tabs>
                </telerik:RadTabStrip>
                <telerik:RadMultiPage runat="server" ID="multipage" SelectedIndex="0" RenderSelectedPageOnly="false">
                    <telerik:RadPageView runat="server" ID="additionalInfoView">
                        <telerik:RadGrid ID="additionalInfoGrid" runat="server" CellSpacing="0" GridLines="Both"
                            AllowPaging="True" PageSize="5" ShowGroupPanel="true" OnNeedDataSource="AdditionalInfoGrid_NeedDataSource"
                            Width="60%">
                            <clientsettings allowcolumnsreorder="false" reordercolumnsonclient="true">
                          <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" AllowColumnResize="True"></Resizing>
                      </clientsettings>
                            <mastertableview showheader="true" autogeneratecolumns="False" allowpaging="true"
                                pagesize="7" hierarchyloadmode="ServerOnDemand">
                        <Columns>
                            <telerik:GridBoundColumn
                                HeaderText="Customer Number" UniqueName="CustomerNumber" 
                                DataField="CustomerNumber" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn
                                HeaderText="Date of Birth" UniqueName="DateOfBirth" 
                                DataField="DateOfBirth" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn 
                                HeaderText="Agency" UniqueName="Agency"
                                DataField="Agency" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn
                                HeaderText="Producer Code" UniqueName="ProducerCode" 
                                DataField="ProducerCode" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn 
                                HeaderText="Last Modified" UniqueName="LastModified" 
                                DataField="LastModified" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn 
                                HeaderText="Comment" UniqueName="Comment" DataField="Comment" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                        </Columns>
                     </mastertableview>
                        </telerik:RadGrid>
                    </telerik:RadPageView>
                    <telerik:RadPageView runat="server" ID="coverageDetailsView">
                        <telerik:RadGrid ID="coverageDetailsGrid" runat="server" CellSpacing="0" GridLines="Both"
                            AllowPaging="True" PageSize="5" ShowGroupPanel="true" OnNeedDataSource="CoverageDetailsGrid_NeedDataSource"
                            Width="60%">
                            <clientsettings allowcolumnsreorder="false" reordercolumnsonclient="true">
                         <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" AllowColumnResize="True"></Resizing>
                     </clientsettings>
                            <mastertableview showheader="true" autogeneratecolumns="False" allowpaging="true"
                                pagesize="7" hierarchyloadmode="ServerOnDemand">
                        <Columns>
                            <telerik:GridBoundColumn DataField="NumberOfDrivers" 
                                HeaderText="Drivers" 
                                UniqueName="NumberOfDrivers" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="NumberOfVehicles" 
                                HeaderText="Vehicles" 
                                UniqueName="NumberOfVehicles" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CompCollisionDeductible" 
                                HeaderText="Comp/Collsion Deductibles" UniqueName="CompCollisionDeductible" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="LiabilityLimit" 
                                HeaderText="Policy Limits" UniqueName="LiabilityLimit" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CurrentPremium" 
                                HeaderText="Lines of Business/Premium" UniqueName="CurrentPremium" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="RenewalPremium" 
                                HeaderText="Renewal Premium per LOB" UniqueName="RenewalPremium" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle" Visible ="false">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </mastertableview>
                        </telerik:RadGrid>
                    </telerik:RadPageView>
                </telerik:RadMultiPage>
            </asp:panel>
        </NestedViewTemplate>
        <RowIndicatorColumn Visible="True">
        </RowIndicatorColumn>
        <ExpandCollapseColumn Visible="True">
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn HeaderText="Quote Number" UniqueName="ContractId" DataField="ContractId"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="ContractId" Visible= false>
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Quote Number" UniqueName="ContractNumber" DataField="ContractNumber"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="ContractNumber">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Insured" UniqueName="Insured" DataField="Insured"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="Insured">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Street Address" UniqueName="Address" DataField="Address"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="Address">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Risk State" UniqueName="RiskState" DataField="RiskState"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="RiskState">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Line Of Business" UniqueName="LineOfBusiness"
                DataField="LineOfBusiness" ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="LineOfBusiness">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Product" UniqueName="MarketSegment" DataField="MarketSegment"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="MarketSegment">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Eff - Exp Dates" UniqueName="EffExpDates" DataField="EffExpDate"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="EffExpDates">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Status" UniqueName="Status" DataField="Status"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="Status">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Agency" UniqueName="Agency" DataField="Agency"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="Agency">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Premium" UniqueName="Premium" DataField="Premium"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="Premium">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Renewal Premium" UniqueName="RenewalPremium" DataField="RenewalPremium"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="RenewalPremium" visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Premium Difference ($)" UniqueName="TermPremiumChangeDifference" DataField="TermPremiumChangeDifference"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="TermPremiumChangeDifference" visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Premium Difference (%)" UniqueName="TermPremiumChangePercentage" DataField="TermPremiumChangePercentage"
                ItemStyle-CssClass="RadGridItemStyle" HeaderStyle-CssClass="RadGridItemStyle"
                SortExpression="TermPremiumChangePercentage" visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridEditCommandColumn UniqueName="actionsCommandColumn" EditText="Go" ButtonType="PushButton">
            </telerik:GridEditCommandColumn>
        </Columns>
        <EditFormSettings PopUpSettings-Modal="true" InsertCaption="Actions" EditFormType="Template">
            <FormTemplate>
                <Action:QuoteAndpolicyActions ID="quoteAndPolicyActions" runat="server" />
            </FormTemplate>
        </EditFormSettings>
    </MasterTableView>
    <ClientSettings>
        <ClientEvents OnPopUpShowing="PopUpShowing" />
    </ClientSettings>
    <HeaderStyle BorderStyle="Solid" />
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
    </HeaderContextMenu>
</telerik:RadGrid>

User Control code behind (.cs): In the nested grid, master grid data gets binded when the page loads. Nested grid data gets binded only when user tries to expand the data for a particular row in the mater grid.
/// <summary>
        /// This event is called to populate data on the MainGrid of the page.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void MainGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
          
        {
            if (ContractSearchResponse == null) return;
  
            contracts = ContractSearchResponse.Contracts;
          
            var columnsDataQuery = (from contract in contracts
                                    orderby String.Concat(contract.InsuredFirstName, string.Empty, String.Empty, contract.InsuredLastName), 
                                            String.Concat(contract.AddressLine1, ", ", contract.AddressCityName, ", ", contract.AddressCityCode, ", ", contract.AddressStateCode)
                                    ascending
                                    select new
                                    {   
                                        Insured = String.Format("{0} {1}", contract.InsuredFirstName, contract.InsuredLastName),
                                        ContractId = contract.ContractId,
                                        ContractNumber = contract.ContractNumber,
                                        Address = string.Concat(contract.AddressLine1, ", ", contract.AddressCityName, ", ", contract.AddressCityCode, ", ", contract.AddressStateCode),
                                        MarketSegment = contract.MarketSegment,
                                        LineOfBusiness = contract.LineType,
                                        EffExpDates = contract.ContractExpDate,
                                        Status = contract.TransactionStatus.ToString(),
                                        RiskState = contract.RiskState,
                                        Premium = String.Format("${0}",contract.PreviousTermPremium.ToString()),
                                        RenewalPremium = String.Format("${0}", contract.RenewalTermPremium.ToString()),
                                        TermPremiumChangeDifference = String.Format("${0}", contract.TermPremiumChangeDifference.ToString()),
                                        TermPremiumChangePercentage = String.Format("{0}%",contract.TermPremiumChangePercentage.ToString())
                                    }).AsQueryable();
       
            ((RadGrid)source).DataSource = columnsDataQuery;
            if (DisplayFutureRenewal)
            {
                ((RadGrid)source).Columns.FindByUniqueName("RenewalPremium").Visible = true;
                ((RadGrid)source).Columns.FindByUniqueName("TermPremiumChangeDifference").Visible = true;
                ((RadGrid)source).Columns.FindByUniqueName("TermPremiumChangePercentage").Visible = true;
  
            }
        }
  
  
/// <summary>
        /// This event is called to populate data on the Additional Info sub-grid of the page.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void AdditionalInfoGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {       
                var contractService = isDebuggingEnabled == true ? ZhongsContractService() : ContractServiceFactory.GetContractService();
                      
                ContractDetailResponse contractDetailResponse = null;
                
                //Fetch the contract details information.
                contractDetailResponse = contractService.GetContractDetails(new ContractDetailRequest()
                    {
                        ContractId = contractId,
                        LineType = (lineOfBusiness.CompareTo("Personal Auto") == 0 ?
                            Resources.Enums.LineType.PersonalAuto :
                            Resources.Enums.LineType.PersonalMultiline)
                    }
                );
  
         
                if (contractDetailResponse != null)
                {
                    //Filter the contract details information for Details
                      var contractDetailResponsesQuery = (from contDetailResp in contractDetailResponse.Enumerated()
                                                            select new
                                                            {
                                                                CustomerNumber = contDetailResp.PersonalLine.CustomerNumber,
                                                                DateOfBirth = contDetailResp.PersonalLine.NamedInsuredDateOfBirth,
                                                                Agency = contDetailResp.PersonalLine.AgencyName,
                                                                ProducerCode = contDetailResp.PersonalLine.ProducerCode,
                                                                LastModified = contDetailResp.PersonalLine.LastModified,
                                                                Comment = contDetailResp.PersonalLine.Comment
  
                                                            }
                                                            ).AsQueryable();
  
  
                    ((RadGrid)source).Columns.FindByUniqueName("CustomerNumber").Visible = true;
                    ((RadGrid)source).Columns.FindByUniqueName("DateOfBirth").Visible = true;
                    ((RadGrid)source).Columns.FindByUniqueName("LastModified").Visible = true;
                    ((RadGrid)source).Columns.FindByUniqueName("Comment").Visible = true;
                    ((RadGrid)source).DataSource = contractDetailResponsesQuery;
  
  
  
                }
                     
            
        }
        /// <summary>
        /// This event is called to populate data on the Coverage Details sub-grid of the page.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void CoverageDetailsGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
              
                var contractService = isDebuggingEnabled == true ? ZhongsContractService() : ContractServiceFactory.GetContractService();
               
                ContractDetailResponse contractDetailResponse = null;
            
                //Fetch the contract details information.
                contractDetailResponse = contractService.GetContractDetails(new ContractDetailRequest()
                    {
                        ContractId = contractId,
                        LineType = (lineOfBusiness.CompareTo("Personal Auto") == 0 ?
                            Resources.Enums.LineType.PersonalAuto :
                            Resources.Enums.LineType.PersonalMultiline)
                    }
                );
            
  
                if (contractDetailResponse != null && contractDetailResponse.AutoLOBContract != null)
                {
                    //Filter the contract details information for Coverage Summary information
                    var coverageDetailsQuery = (from contractDetailResp in contractDetailResponse.Enumerated()
                                                select new
                                                {   NumberOfDrivers = contractDetailResp.AutoLOBContract.DriverList.Count.ToString(),
                                                    NumberOfVehicles = contractDetailResp.AutoLOBContract.VehicleList.Count.ToString(),
                                                    CompCollisionDeductible = String.Format("${0}/${1}", string.Empty, string.Empty),
                                                    LiabilityLimit = String.Format("Liability Limit - ${0}", contractDetailResp.AutoLOBContract.CombinedSingleLimit)                              
                                                }).AsQueryable();
  
                    ((RadGrid)source).Columns.FindByUniqueName("NumberOfDrivers").Visible = true;
                    ((RadGrid)source).Columns.FindByUniqueName("NumberOfVehicles").Visible = true;
                    ((RadGrid)source).Columns.FindByUniqueName("CompCollisionDeductible").Visible = true;
                    ((RadGrid)source).Columns.FindByUniqueName("LiabilityLimit").Visible = true;
                    ((RadGrid)source).DataSource = coverageDetailsQuery;
                    return;
                }
  
  
              
                if (contractDetailResponse != null && contractDetailResponse.MultilineLOBContract != null)
                {
  
                    var lobCurrentTermPremiums = contractDetailResponse.MultilineLOBContract.LOBCurrentTermPremiums == null ? new List <LOBPremium>() :  contractDetailResponse.MultilineLOBContract.LOBCurrentTermPremiums;
                    var lobPriorTermPremiums = contractDetailResponse.MultilineLOBContract.LOBPriorTermPremiums == null ? new List<LOBPremium>() : contractDetailResponse.MultilineLOBContract.LOBPriorTermPremiums;
                  
                    var leftOuterJoin = from lctp in lobCurrentTermPremiums
                                        join lptp in lobPriorTermPremiums 
                                        on lctp.LineOfBusiness equals lptp.LineOfBusiness 
                                        into temp
                                        from lptp in temp.DefaultIfEmpty(new LOBPremium(){ LineOfBusiness = lctp.LineOfBusiness, Premium = null})
                                        select 
                                        new
                                        {
                                            LineOfBusiness = lctp.LineOfBusiness,
                                            CurrentPremium = lctp.Premium, 
                                            RenewalPremium = lptp.Premium
                                        };
  
                
                    var rightOuterJoin = from lptp in lobPriorTermPremiums
                                         join lctp in lobCurrentTermPremiums
                                         on lptp.LineOfBusiness equals lctp.LineOfBusiness
                                         into temp
                                         from lctp in temp.DefaultIfEmpty(new LOBPremium() { LineOfBusiness = lptp.LineOfBusiness, Premium = null })
                                         select
                                         new
                                         {
                                             LineOfBusiness = lptp.LineOfBusiness,
                                             CurrentPremium = lctp.Premium,
                                             RenewalPremium = lptp.Premium
                                         };
  
                    var fullOuterJoin = leftOuterJoin.Union(rightOuterJoin);
  
                    var groupedLinedOfBusiness = from lob in fullOuterJoin.OrderBy(lobPremium => lobPremium.LineOfBusiness)
                                                 group lob by lob.LineOfBusiness
                                                into grouped
                                                select new
                                                {
                                                    CurrentPremium = String.Format("{0} - ${1}", grouped.Key, grouped.Max(l => l.CurrentPremium).ToString()),
                                                    RenewalPremium = String.Format("{0} - ${1}", grouped.Key, grouped.Max(l => l.RenewalPremium).ToString())
                                                };
  
  
                    if (contractDetailResponse.MultilineLOBContract.LOBPriorTermPremiums != null && 
                        contractDetailResponse.MultilineLOBContract.LOBPriorTermPremiums.Count > 0)
                    {
                        ((RadGrid)source).Columns.FindByUniqueName("RenewalPremium").Visible = true;
                    }
  
                    if (contractDetailResponse.MultilineLOBContract.LOBCurrentTermPremiums != null &&
                       contractDetailResponse.MultilineLOBContract.LOBCurrentTermPremiums.Count > 0)
                    {
                        ((RadGrid)source).Columns.FindByUniqueName("CurrentPremium").Visible = true;
                    }
                    ((RadGrid)source).DataSource = groupedLinedOfBusiness.AsQueryable();
  
                    return;       
                }
        }
  
        /// <summary>
        /// This event is called when the user clicks on the item rows on the MainGrid.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void GridResult_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item is
                GridDataItem)
            {
                GridDataItem item = e.Item as GridDataItem;
    
                item.ChildItem.FindControl("InnerContainer").Visible = !e.Item.Expanded;
  
                contractId = item["ContractId"].Text;
  
                lineOfBusiness = item["LineOfBusiness"].Text;
            
                if (!item.Expanded)
                {
                    GridNestedViewItem nestedItem = (GridNestedViewItem)item.ChildItem;
                    RadGrid tempGrid = (RadGrid)nestedItem.FindControl("additionalInfoGrid");
                    tempGrid.Rebind();
  
                    tempGrid = (RadGrid)nestedItem.FindControl("coverageDetailsGrid");
  
                    tempGrid.Rebind();
  
                }
            }
        }

Questions: How do i register Client Events? I tried doing in Page_Load, but system threw an exception because it is not able to find getCurrent(this.page)
I want to export with "ExportOnlydata" = true and "IgnorePaging" = true, In doing so i get excpetion, which i think is because child grid data is not available (since it gets loaded only on Grid ItemCommand event).

I would really appreciate if you could look into my code and suggest me how to implement "Export to excel" functionality in this case.

Thanks,

-Rajesh
Jayesh Goyani
Top achievements
Rank 2
 answered on 03 Aug 2011
2 answers
268 views

I am using the Notification control to alert our users that are logged into our system of when we will be doing maintenance. I plan on using a simple text file (server side) that will have the contents to display. If the file has text, the notification will display it to the user. If the file is empty, then do not show the notification to the user. I have code in the "OnCallbackUpdate" sub to read the file. If the message is empty I set the notification control to visible = false. However, it still shows up on the screen. How do I make it not show when there isn't any text to display?

<telerik:RadNotification ID="RadNotification1" runat="server" LoadContentOn="EveryShow"
    ShowInterval="6000" OnCallbackUpdate="OnCallbackUpdate" Position="Center" VisibleTitlebar="False"
    AutoCloseDelay="5000" EnableRoundedCorners="True" EnableShadow="True" Skin="Office2010Black">
</telerik:RadNotification>

Protected Sub OnCallbackUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadNotificationEventArgs)
    Dim sMsg As String = ""
    Dim sr As System.IO.StreamReader = New System.IO.StreamReader("C:\temp\TextFile1.txt")
    sMsg = sr.ReadToEnd
    sr.Close()
    If Not String.IsNullOrEmpty(sMsg.Trim) Then
        RadNotification1.Text = sMsg
    Else
        RadNotification1.Visible = False
    End If
End Sub
Svetlina Anati
Telerik team
 answered on 03 Aug 2011
1 answer
91 views
Hello 

I have a Dot Net Nuke site wich uses Rad controls, I have a module wich has a hidden panel and has to populate a rad grid after a query, the grid is showing up but it looses it´s skin and when i ckick next and prev buttons of the grid it dissapears.

The skin i'm using is vista but it happens with all skins, I have the property "enable ajax skin rendering" set to true in the control and I set  it again in page load. Im using a rad ajax manager. 

I had the problem with Q1 2011 and I just updated to Q2 2011 but the problem still there.

Here you have an image of the problem,

Thanks for your help!!!

Felipe Botero
Pavlina
Telerik team
 answered on 03 Aug 2011
3 answers
137 views
Hi,

I have column as name in my RadGrid. Some of its values contains an apostrophe character. For e.g. Albin's but after searching it in filter I get no records. Does this have any solution. ?

The version of my Telerik control is 2008.3.1314.35.

Thanks.
Pavlina
Telerik team
 answered on 03 Aug 2011
1 answer
159 views
Hi,

My labels are appearing as 1, 2, 3 etc. and I want to set them to some text. Searches of the forum lead me to Datalabelscolumn but that appears to be for bound data. My data is unbound.

Hope soembody can help.

Many thanks,
Marek Walford

Here's my code:


Public

 

 

Sub GenerateGraph(ByVal X As Int16, ByVal Y As Int16, _

 

 

 

ByVal KTO As Double, ByVal CTO As Double, _

 

 

 

ByVal KHW As Double, ByVal CHW As Double, _

 

 

 

ByVal KCC As Double, ByVal CCC As Double, _

 

 

 

ByVal KMC As Double, ByVal CMC As Double, _

 

 

 

ByVal KWA As Double, ByVal CWA As Double)

 

 

 

Dim radChart1 As New Telerik.WinControls.UI.RadChart

 

 

 

Dim CSHW As New Telerik.Charting.ChartSeries()

 

 

 

Dim CSCC As New Telerik.Charting.ChartSeries()

 

 

 

Dim CSMC As New Telerik.Charting.ChartSeries()

 

 

 

Dim CSWA As New Telerik.Charting.ChartSeries()

 

 

 

Dim CSIEHW As New Telerik.Charting.ChartSeriesItem(KHW)

 

 

 

Dim CSIECC As New Telerik.Charting.ChartSeriesItem(KCC)

 

 

 

Dim CSIEMC As New Telerik.Charting.ChartSeriesItem(KMC)

 

 

 

Dim CSIEWA As New Telerik.Charting.ChartSeriesItem(KWA)

 

 

 

Dim CSICHW As New Telerik.Charting.ChartSeriesItem(CHW)

 

 

 

Dim CSICCC As New Telerik.Charting.ChartSeriesItem(CCC)

 

 

 

Dim CSICMC As New Telerik.Charting.ChartSeriesItem(CMC)

 

 

 

Dim CSICWA As New Telerik.Charting.ChartSeriesItem(CWA)

 

radChart1.BeginInit()

radChart1.Size =

 

New System.Drawing.Size(X, Y)

 

radChart1.DefaultType = Telerik.Charting.

 

ChartSeriesType.StackedBar

 

radChart1.ChartTitle.Remove()

 

 

'PlotArea X Axis

 

 

 

With radChart1.PlotArea.XAxis

 

.AxisLabel.Visible =

 

True

 

 

 

End With

 

 

 

'PlotArea Y Axis

 

 

 

With radChart1.PlotArea.YAxis

 

.Appearance.ValueFormat = Telerik.Charting.Styles.

 

ChartValueFormat.Currency

 

.AxisLabel.TextBlock.Text =

 

"Cost"

 

.AxisLabel.Visible =

 

True

 

 

 

End With

 

 

 

'Hardware

 

CSHW.Items.AddRange(

 

New Telerik.Charting.ChartSeriesItem() {CSIEHW, CSICHW})

 

CSHW.Name =

 

"Hardware"

 

CSHW.Appearance.ShowLabels =

 

False

 

CSHW.Type = Telerik.Charting.

 

ChartSeriesType.StackedBar

 

radChart1.Series.Add(CSHW)

 

 

'Colour consumables

 

CSCC.Items.AddRange(

 

New Telerik.Charting.ChartSeriesItem() {CSIECC, CSICCC})

 

CSCC.Name =

 

"Colour Consumables"

 

CSCC.Appearance.ShowLabels =

 

False

 

CSCC.Type = Telerik.Charting.

 

ChartSeriesType.StackedBar

 

radChart1.Series.Add(CSCC)

 

 

'Mono consumables

 

CSMC.Items.AddRange(

 

New Telerik.Charting.ChartSeriesItem() {CSIEMC, CSICMC})

 

CSMC.Name =

 

"Mono Consumables"

 

CSMC.Appearance.ShowLabels =

 

False

 

CSMC.Type = Telerik.Charting.

 

ChartSeriesType.StackedBar

 

radChart1.Series.Add(CSMC)

 

 

'Warranty

 

CSWA.Items.AddRange(

 

New Telerik.Charting.ChartSeriesItem() {CSIEWA, CSICWA})

 

CSWA.Name =

 

"Warranty"

 

CSWA.Appearance.ShowLabels =

 

False

 

CSWA.Type = Telerik.Charting.

 

ChartSeriesType.StackedBar

 

radChart1.Series.Add(CSWA)

 

 

'Oreintation

 

radChart1.SeriesOrientation = Telerik.Charting.

 

ChartSeriesOrientation.Horizontal

 

radChart1.EndInit()

radChart1.Save(Response.OutputStream,

 

ImageFormat.Jpeg)

 

 

 

End Sub

 

Bartholomeo Rocca
Top achievements
Rank 1
 answered on 03 Aug 2011
1 answer
85 views
Hi,

Upload control appearance is completely different in different browsers like IE,Firefox,Chrome. Is their any way to make unique appearance?

Thanks in advance.

Thanks,
Sumanth
Kate
Telerik team
 answered on 03 Aug 2011
2 answers
674 views
Hi,

I am new to Telerik and have some requirements where I need to change ConfirmText Property of GridButtonColumn from ItemDataBound event of radGrid.

Below is the event I am using where I need to change the ConfirmText property:

 

 

protected void RgDictionary_ItemDataBound(object sender, GridItemEventArgs e)

 

{

 

 

if (e.Item is GridDataItem && !e.Item.IsInEditMode && e.Item.NamingContainer.NamingContainer is RadGrid)

 

{

 

 

GridDataItem dataBoundItem = e.Item as GridDataItem;

 

bool

 

 

IsChildDictionary = (dataBoundItem["IsChildDictionary"].Controls[0] as CheckBox).Checked;

 

 

 

    if (IsChildDictionary)

 

    {

    dataBoundItem[

 

"RawString"].Style.Add("color", "green");

 

    (dataBoundItem[

 

"DeleteColumn"].Controls[0] as LinkButton).Text = "Make Local";

 

 

 

    //Here I want to change ConfirmText Property Value

 

 

 

 

 

    (dataBoundItem[

 

"EditCanonicalForm"].Controls[0] as LinkButton).Style.Add("display", "none");

 

}

}

Deepak
Top achievements
Rank 1
 answered on 03 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?