Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
117 views
Hi,

Can anyone tell me about  LZS 221 algorithm?
gaurav
Top achievements
Rank 1
 asked on 08 Aug 2011
4 answers
144 views
Hi there, im sure theres a simple fix for this but ive been wrestling with  code for too long now and im out of ideas :(

The screenshot attached shows how when the user arrives at that screen they choose a part listed by using a tickbox and then inputing the quantity required. At the moment its allowing a zero quantity to be ordered, and this causes an issue with the sql database.

I'm trying to find a way of checking before the user leaves the page (either by verification when they click the save button, or something else) to carry out a query on the tick boxes selected if the value is greater than zero. I dont want zero quantities to be allowed upon save

Ive tried following some of the example code listed on the Telerik demos, but cant find anything that verifies a line thats been selected by a tick box, and then checks that or other selected tick box lines for a zero quantity and erroring if so.

The page loads zeros as default when the page is 1st opened, which has partly caused my headache !

This is the aspx code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="quotpart_BOM.aspx.cs" Inherits="quotpart_BOM" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<head id="Head1" runat="server">
    <title>Part Bill of material</title>
    <style type="text/css">
        #GridQuotationsPanel
        {
            height: 100%;
        }
    </style>
 
<head>
 
</head>
 
    <script language="javascript" src="../../JavaScript/PopUps.js" type="text/javascript"></script>
 
       
    </script>
 
</head>
 
 
<body>
 
    <script language="javascript" type="text/javascript">
        function Refresh() {
            $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
        }
 
        function RefreshAll() {
            $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("All");
        }
    </script>
 
    <form id="form1" runat="server">
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
    </telerik:RadStyleSheetManager>
    <div>
        <telerik:RadScriptManager ID="radScriptManager" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" EnableOutsideScripts="True" runat="server"
            OnAjaxRequest="RadAjaxManager1_AjaxRequest">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl LoadingPanelID="loading" ControlID="GridQuotations" />
                        <telerik:AjaxUpdatedControl ControlID="txtSearchCode" />
                        <telerik:AjaxUpdatedControl ControlID="txtCode" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnSearch">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl LoadingPanelID="loading" ControlID="GridQuotations" />
                        <telerik:AjaxUpdatedControl ControlID="txtSearchCode" />
                        <telerik:AjaxUpdatedControl ControlID="txtCode" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnAdd">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl LoadingPanelID="loading" ControlID="GridQuotations" />
                        <telerik:AjaxUpdatedControl ControlID="txtSearchCode" />
                        <telerik:AjaxUpdatedControl ControlID="txtCode" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="loading" HorizontalAlign="Center" MinDisplayTime="500"
            Transparency="30" runat="server">
            <div id="divLoader" class="loading">
            </div>
        </telerik:RadAjaxLoadingPanel>
        <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td valign="top">
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td align="left" colspan="3">
                                <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
                                    <tr>
                                        <td valign="top" class="main-header" height="80">
                                            <table width="100%" border="0px" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td>
                                                        <table width="100%" border="0px" cellspacing="0" cellpadding="0">
                                                            <tr>
                                                                <td>
                                                                    <table border="0" cellspacing="0" cellpadding="0">
                                                                        <tr>
                                                                            <td class="library_logo" valign="middle">
                                                                                Library
                                                                                <asp:HiddenField ID="hdnCustomerId" runat="server" Value="0" />
                                                                                <asp:HiddenField ID="hdnQuotId" runat="server" Value="0" />
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                                <td valign="top">
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="pop_up_sub_header" valign="middle">
                                                        <table border="0" cellspacing="0" cellpadding="0" width="100%" height="27px">
                                                            <tr>
                                                                <td width="95%" class="Pdding_left">
                                                                    <asp:Label ID="lblPath" runat="server"></asp:Label>
                                                                </td>
                                                                <td>
                                                                    <a href="#" onclick="javascript:self.close();" class="close_btn">Close</a>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="popup-inner-heading2">
                                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                                <tr>
                                                    <td align="left" width="31%">
                                                        <asp:Button ID="btnAdd" runat="server" Text="Save" class="save" OnClick="btnAdd_Click" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="popup-inner-heading2">
                                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                                <tr>
                                                    <td align="left" width="5%">
                                                        <span><b>Type</b></span>
                                                    </td>
                                                    <td align="left" width="15%">
                                                        <asp:DropDownList ID="ddlmode" runat="server" Width="90%">
                                                            <asp:ListItem Value="Comp">Component</asp:ListItem>
                                                            <asp:ListItem Value="Part">Parts</asp:ListItem>
                                                            <asp:ListItem Value="Prod">Product</asp:ListItem>                                                         
                                                            <asp:ListItem Value="Bought">Bought</asp:ListItem>
                                                        </asp:DropDownList>
                                                    </td>
                                                    <td align="left" valign="middle" width="5%">
                                                        <asp:Button ID="btnGo" runat="server" Text="Go" class="go_button" OnClick="btnGo_Click" />
                                                    </td>
                                                    <td align="left" width="5%">
                                                        <span><b>Code</b></span>
                                                    </td>
                                                    <td align="left" width="15%">
                                                        <asp:TextBox ID="txtCode" runat="server" Width="95%"></asp:TextBox>
                                                    </td>
                                                    <td align="left" valign="middle" width="5%">
                                                        <asp:ImageButton ID="btnSearch" runat="server" ImageUrl="../../App_Themes/GPC/images/search_search_btn.jpg"
                                                            CausesValidation="false" OnClick="btnSearch_Click" />
                                                    </td>
                                                    <td align="left" width="15%" valign="middle">
                                                        <a href="" onclick="return Overlay();">
                                                            <asp:Button ID="Button2" runat="server" CssClass="search_header" UseSubmitBehavior="false">
                                                            </asp:Button> Advanced Search</a>
                                                    </td>
                                                    <td align="left" width="10%">
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td valign="top" height="100%">
                    <div class="search_win" id='searchgrid' runat="server">
                        <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td rowspan="5" class="search_slider">
                                      
                                </td>
                                <td width="17" height="25" bgcolor="#DBDBDB">
                                      
                                </td>
                                <td height="25">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td align="left" valign="middle" bgcolor="#DBDBDB">
                                                <img src="../../App_Themes/GPC/images/search_magi.jpg" width="21" height="25" />
                                            </td>
                                            <td align="right" valign="middle" bgcolor="#DBDBDB" onclick="return Closesearch();">
                                                <img src="../../App_Themes/GPC/images/search_close.jpg" onclick="return Closesearch();"
                                                    width="14" height="13" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td width="17" height="25" bgcolor="#DBDBDB">
                                      
                                </td>
                            </tr>
                            <tr>
                                <td width="17" height="12">
                                      
                                </td>
                                <td height="12">
                                      
                                </td>
                                <td width="17" height="12">
                                      
                                </td>
                            </tr>
                            <tr>
                                <td width="17">
                                      
                                </td>
                                <td align="center" valign="top">
                                    <asp:Panel ID="pnlSearch" runat="server" DefaultButton="Button1">
                                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td width="1" align="right" valign="top">
                                                    <img src="../../App_Themes/GPC/images/search_in_left_top.jpg" width="3" height="4"
                                                        border="0" style="display: block; padding: 0; margin: 0; font-size: 0px;" />
                                                </td>
                                                <td height="4" align="left" valign="top" class="search_top_bor">
                                                </td>
                                                <td width="1" align="right" valign="top">
                                                    <img src="../../App_Themes/GPC/images/search_in_right_top.jpg" width="3" height="4"
                                                        border="0" style="display: block; padding: 0; margin: 0; font-size: 0px;" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="1" class="search_left_bor">
                                                </td>
                                                <td align="center" valign="top" bgcolor="#efefef">
                                                    <table width="90%" border="0" align="center" cellpadding="0" cellspacing="3">
                                                        <tr>
                                                            <td height="5" align="left" valign="middle">
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="left" valign="middle">
                                                                <span>Code</span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="left" valign="middle">
                                                                <asp:TextBox ID="txtSearchCode" runat="server" CssClass="newinput" Type="Number"
                                                                    Width="100%" MaxLength="10" NumberFormat-DecimalDigits="0" EnableEmbeddedSkins="false">
                                                                </asp:TextBox>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="left" valign="middle">
                                                                <span>Description</span>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="left" valign="middle">
                                                                <asp:TextBox ID="txtSearchDescription" runat="server" MaxLength="10" NumberFormat-DecimalDigits="0"
                                                                    CssClass="newinput" Type="Number" Width="100%" EnableEmbeddedSkins="false">
                                                                </asp:TextBox>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="left" valign="middle">
                                                                <table border="0" align="center" cellpadding="0" cellspacing="3">
                                                                    <tr>
                                                                        <td align="right">
                                                                            <asp:Button ID="Button1" runat="server" Style="display: none;" Text="Button" OnClientClick="return false;" />
                                                                            <img onclick="return Refresh();" alt="Search" src="../../App_Themes/GPC/images/search_search_btn.jpg">
                                                                        </td>
                                                                        <td align="left">
                                                                            <img onclick="return RefreshAll();" alt="View All" src="../../App_Themes/GPC/images/search_all_btn.jpg">
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                  
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                                <td width="1" class="search_right_bor">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="1">
                                                    <img src="../../App_Themes/GPC/images/search_in_left_bot.jpg" width="3" height="4"
                                                        border="0" style="display: block; padding: 0; margin: 0; font-size: 0px;" />
                                                </td>
                                                <td height="4" class="search_bot_bor">
                                                </td>
                                                <td width="1">
                                                    <img src="../../App_Themes/GPC/images/search_in_right_bot.jpg" width="3" height="4"
                                                        border="0" style="display: block; padding: 0; margin: 0; font-size: 0px;" />
                                                </td>
                                            </tr>
                                        </table>
                                    </asp:Panel>
                                </td>
                                <td width="17">
                                      
                                </td>
                            </tr>
                            <tr>
                                <td width="17">
                                      
                                </td>
                                <td>
                                      
                                </td>
                                <td width="17">
                                      
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                      
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id='maingrid' style="height: 100%;">
                        <telerik:RadGrid ID="GridQuotations" Skin="RadSkin" runat="server" Height="100%"
                            AllowPaging="True" PageSize="30" Width="100%" EnableEmbeddedSkins="False" AutoGenerateColumns="False"
                            AllowSorting="True" GridLines="None" AllowMultiRowSelection="True" EnableOutsideScripts="True"
                            OnNeedDataSource="GridQuotations_NeedDataSource">
                            <ExportSettings>
                                <Pdf PageWidth="8.5in" PageHeight="11in" PageTopMargin="" PageBottomMargin="" PageLeftMargin=""
                                    PageRightMargin="" PageHeaderMargin="" PageFooterMargin=""></Pdf>
                            </ExportSettings>
                            <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true"></PagerStyle>
                            <MasterTableView CommandItemDisplay="None" DataKeyNames="SearchID" AllowMultiColumnSorting="True"
                                AllowAutomaticUpdates="false" AllowAutomaticInserts="false" EditMode="InPlace">
 
<EditFormSettings>
<EditColumn InsertImageUrl="Update.gif" UpdateImageUrl="Update.gif" EditImageUrl="Edit.gif" CancelImageUrl="Cancel.gif"></EditColumn>
</EditFormSettings>
 
                                <CommandItemStyle CssClass="top-icon-bar" />
                                <RowIndicatorColumn Visible="False">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn Resizable="False">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridClientSelectColumn UniqueName="Column">
                                        <HeaderStyle Width="5%" />
                                    </telerik:GridClientSelectColumn>
                                    <telerik:GridTemplateColumn HeaderText="Code" UniqueName="Code" DataField="Code">
                                        <ItemTemplate>
                                            <asp:Label ID="lblCode" runat="server" Text='<%# Bind("Code") %>'></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle Width="20%"></HeaderStyle>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Quantity" UniqueName="Quantity" DataField="Quantity">
                                        <ItemTemplate>
                                            <telerik:RadTextBox ID="txtQuantity" runat="server" Text='<%# Eval("Quantity") %>' Width="50px"></telerik:RadTextBox
                                        </ItemTemplate>
                                        <HeaderStyle Width="20%"></HeaderStyle>
                                    </telerik:GridTemplateColumn>
 
                                    <telerik:GridTemplateColumn HeaderText="Description" UniqueName="description" DataField="description">
                                        <ItemTemplate>
                                            <asp:Label ID="lblDescription" runat="server" Text='<%# Bind("description") %>'></asp:Label
                                        </ItemTemplate>
                                        <HeaderStyle Width="25%"></HeaderStyle>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Cost(£)" UniqueName="cost">
                                        <ItemTemplate>
                                            <%# Eval("cost")%> 
                                        </ItemTemplate>
                                        <HeaderStyle Width="40%"></HeaderStyle>
                                    </telerik:GridTemplateColumn>
                                </Columns>
                            </MasterTableView>
 
                             
                                 
                            <ClientSettings>
                                <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                                <Selecting AllowRowSelect="true" />
                                <ClientEvents />
                            </ClientSettings>
                            <ValidationSettings CommandsToValidate="PerformInsert,Update" />
                            <ItemStyle HorizontalAlign="Left" Width="20%" />
                            <FilterMenu Skin="RadSkin" EnableEmbeddedSkins="False" EnableTheming="True">
                                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                            </FilterMenu>
                        </telerik:RadGrid>
                         
                    </div>
                </td>
            </tr>
            <tr>
                <td valign="bottom" class="footer-bar">
                      
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
 
</html>
 The following is the aspx.cs code

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using library.searchs;
using library.parts;
using settings.Users;
using library.Quotations;
 
public partial class quotpart_BOM : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((Session["User"] != null) && ((((LoginUsers)Session["User"]).UserId > 0)))
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["cid"] != null && Request.QueryString["id"] != null)
                {
                    hdnCustomerId.Value = Request.QueryString["cid"].ToString();
                    hdnQuotId.Value = Request.QueryString["id"].ToString();
                }
            }
 
        }
        else
        {
            Response.Redirect("~/control/message.aspx?s=1");
        }
    }
    protected void GridQuotations_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        librarySearch objBLL = new librarySearch(Convert.ToInt64(hdnCustomerId.Value));
 
        //objBLL.SearchType = "Prod";
        objBLL.SearchType = ddlmode.SelectedValue;
        objBLL.Order = 2;
        objBLL.OrderBy = 1;
        objBLL.PageIndex = 1;
        objBLL.RecordperPage = 99999;
        if (txtCode.Text.Trim().Length > 0)
        {
            objBLL.Code = txtCode.Text;
            txtSearchCode.Text = txtCode.Text;
        }
        GridQuotations.DataSource = (objBLL.LibrarySearchGetAll(objBLL)).SearchResults;
        objBLL = null;
    }
    protected void btnGo_Click(object sender, EventArgs e)
    {
        GridQuotations.Rebind();
    }
    protected void btnSearch_Click(object sender, ImageClickEventArgs e)
    {
        GridQuotations.Rebind();
    }
    protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
    {
        if (e.Argument == "Rebind")
        {
            txtCode.Text = txtSearchCode.Text;
            GridQuotations.MasterTableView.SortExpressions.Clear();
            GridQuotations.MasterTableView.GroupByExpressions.Clear();
            GridQuotations.Rebind();
        }
        if (e.Argument == "All")
        {
            clearSearchTerms();
            GridQuotations.MasterTableView.SortExpressions.Clear();
            GridQuotations.MasterTableView.GroupByExpressions.Clear();
            GridQuotations.Rebind();
        }
 
    }
    private void clearSearchTerms()
    {
        txtSearchCode.Text = "";
        txtSearchDescription.Text = "";
        txtCode.Text = "";
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string product_ID_STR = "";
        string product_Qty_STR = "";
        string product_type_STR = "";
        for (int i = 0; i < GridQuotations.Items.Count; i++)
        {
            if (((CheckBox)(GridQuotations.Items[i]["column"].Controls[0])).Checked)
            {
                product_ID_STR = product_ID_STR + GridQuotations.MasterTableView.DataKeyValues[i]["SearchID"].ToString() + ',';
                product_Qty_STR = product_Qty_STR + (GridQuotations.Items[i].FindControl("txtQuantity") as RadTextBox).Text + ',';
                product_type_STR = product_type_STR + (ddlmode.SelectedValue == "Prod" ? "Part" : ddlmode.SelectedValue) + ',';
            }
        }
        product_ID_STR = product_ID_STR.Trim(',');
        product_Qty_STR = product_Qty_STR.Trim(',');
        product_type_STR = product_type_STR.Trim(',');
        if (product_ID_STR.Trim().Length > 0)
        {
            QuotationBLL objQuotationBLL = new QuotationBLL();
            Quotation objQuotation = new Quotation();
            objQuotation.product_ID_STR = product_ID_STR;
            objQuotation.product_Qty_STR = product_Qty_STR;
            objQuotation.product_type_STR = product_type_STR;
            objQuotation.quot_pk = Convert.ToInt64(hdnQuotId.Value);
            objQuotation.updated_by = ((LoginUsers)Session["User"]).UserId;
            objQuotationBLL.fnAddQuotationProduct(objQuotation);
            objQuotationBLL = null;
            objQuotation = null;
            RadAjaxManager1.ResponseScripts.Add("returnToParent();");
        }
        else
        {
            RadAjaxManager1.Alert("No record selected");
        }
 
    }
}

Thanks in advance for any advice/pointers
Steven
Top achievements
Rank 1
 answered on 08 Aug 2011
3 answers
284 views
Hi, I am using the RadUpload control on my page. I've noticed that the RadUpload does not work if placed inside an UpdatePanel.

What's the reason for this? Is there any way around the issue?
Helen
Telerik team
 answered on 08 Aug 2011
5 answers
165 views
hi

    I have a  table in radeditor.in which values should be  changed at runtime.I have a button on whose click event table should be converted into pdf.I tried this


<telerik:RadEditor ID="pdffile_dl" runat="server" style="display: none" MaxHtmlLength="20000"    
            ContentFilters="PdfExportFilter, DefaultFilters" >
        <ExportSettings OpenInNewWindow="true" >
        </ExportSettings>        
    
  </telerik:RadEditor>
       
codebehind:

string aa="hello";

 protected void  btn_Click(object sender, ImageClickEventArgs e)
    {       
         pdffile_dl.Content="<table><tr><td>"+aa+"</td></tr></table>";

      pdffile_dl.ExportToPdf();
       
    }

the converted pdf file display nothing

Dobromir
Telerik team
 answered on 08 Aug 2011
2 answers
61 views
I have implemented a custom FileBrowserContentProvider for image/document selection.  I am currently using it with the RadFileExplorer and the RadEditor.  Within the RadFileExplorer I handle the OnClientFileOpen event with some custom functionality.  The issue is, I want to utilize that same custom functionality within the ImageManager and DocumentManager of the RadEdtior and I cannot find any reference to that event (OnClientFileOpen) within those dialogs.

Help?
Dobromir
Telerik team
 answered on 08 Aug 2011
6 answers
1.8K+ views
HI,

I want to implement Cell click event in radgrid. i.e when user selects cell in a radgrid then the particular cell should be highlighted and should be able to retrieve the value of cell in javascript.

Can anybody help in this?

Regards,
Medac
Bruno
Top achievements
Rank 1
 answered on 08 Aug 2011
1 answer
124 views
Hello

I put a listbox in a RadPan, but the listbox, seems to be under the pane

The scrollbars of the pane, have not effect on my listbox

Want's wrong ? Thank for your help

Anne

        <div id="ParentDivElement" style="height: 100%;">
            <telerik:RadSplitter ID="MainSplitter" runat="server" Height="90%" Width="100%" Orientation="Vertical">

                <telerik:RadPane ID="LeftPane" runat="server" Width="200" MinWidth="150" MaxWidth="400">
                    <h3>Liste Editions</h3>
                    <telerik:RadListBox ID="rdListeEditions" runat="server"></telerik:RadListBox>                      
                </telerik:RadPane>

                <telerik:RadSplitBar ID="VerticalSplitBar" runat="server" CollapseMode="Forward" />

                <telerik:RadPane ID="ContentPane" runat="server">
                    <h3>Détail</h3>
                     </telerik:RadPane>
             </telerik:RadSplitter>                    
        </div>
Dobromir
Telerik team
 answered on 08 Aug 2011
6 answers
272 views

I have a grid with nested views via tempates.  The tamplate retrieves data though an ObjectDataSource that gets it form a Webservice.
Now, when I expand any element in the hierarchy it works perfectly, however, if I try to sort or filter any column from the Mater Table, I get an exception:

Error: Sys.WebForms.PageRequestManagerServerErrorException: The DataSourceID of 'FormView' must be the ID of a control of type IDataSource.  A control with ID 'ObjectDataSource' could not be found.

I have tried adding the same ObjectDataSource after the grid definition but it does work (not exception thrown) for sorting/filtering of the Master Table but if I try to expand any of the nested views, it simply does not show any data. However, if right before I try sorting/filtering the master table (right after I load the gid for the first time) I expand any of the nested views, they do get the data. It is only after I sort/filter that they don't. 

The following is the code for the radGrid that I currently have, which is the one that forces the exception to be thrown:

<telerik:RadGrid ID="OrbitRadGrid" runat="server" AllowFilteringByColumn="True" AllowSorting="True" VirtualItemCount="50000" 
    GridLines="None" AllowPaging="true" PageSize="20" AllowCustomPaging="true" ShowGroupPanel="false" EnableLinqExpressions="false" 
    OnNeedDataSource="OrbitRadGrid_NeedDataSource" OnSortCommand="OrbitRadGrid_SortCommand"
    Skin="WebBlue" >
    <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="False" ReorderColumnsOnClient="True">
        <Scrolling AllowScroll="True" EnableVirtualScrollPaging="True" UseStaticHeaders="True" SaveScrollPosition="True" />
        <Resizing AllowColumnResize="True" />
    </ClientSettings>
    <MasterTableView DataKeyNames="Item_Name, Source_Name" AutoGenerateColumns="False" AllowNaturalSort="false" >
          
        <Columns>
            <telerik:GridBoundColumn DataField="Item_Name" HeaderText="Item Name" 
                ReadOnly="True" SortExpression="Item_Name" UniqueName="Item_Name" HeaderStyle-Width="220px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Source_Name" HeaderText="Item Source" ReadOnly="True" 
                SortExpression="Source_Name" UniqueName="Source_Name" HeaderStyle-Width="220px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ItemType_Name" HeaderText="Item Type" ReadOnly="True" 
                SortExpression="ItemType_Name" UniqueName="ItemType_Name" HeaderStyle-Width="115px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Team_Name" HeaderText="Item Team" ReadOnly="True" 
                SortExpression="Team_Name" UniqueName="Team_Name" HeaderStyle-Width="115px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="IsTestItem" HeaderText="Test" ReadOnly="True" 
                UniqueName="IsTestItem"  AllowFiltering="false" HeaderStyle-Width="50px">
            </telerik:GridBoundColumn>
              
            <telerik:GridBoundColumn DataField="IsItemOnHold" HeaderText="On Hold" ReadOnly="True" 
                UniqueName="IsItemOnHold"  AllowFiltering="false" HeaderStyle-Width="62px">
            </telerik:GridBoundColumn>
             
        </Columns>
          
        <NestedViewTemplate>
            <asp:Label ID="ItemName"   Text='<%# Eval("Item_Name") %>'   Visible="false" runat="server" />
            <asp:Label ID="ItemSource" Text='<%# Eval("Source_Name") %>' Visible="false" runat="server" />
            <asp:FormView ID="FormView" runat="server" DataSourceID="ObjectDataSource">
                <ItemTemplate>
                    <asp:Panel ID="NestedViewPanel" runat="server" CssClass="viewWrap" Width="1000px">
                        <telerik:RadTabStrip runat="server" ID="TabStip" MultiPageID="Multipage" SelectedIndex="0" Skin="WebBlue">
                            <Tabs>
                                <telerik:RadTab runat="server" Text="General" PageViewID="General"/>
                                <telerik:RadTab runat="server" Text="Status" PageViewID="Status"/>
                                <telerik:RadTab runat="server" Text="Coverage" PageViewID="Coverage"/>
                                <telerik:RadTab runat="server" Text="Rejection" PageViewID="Rejection"/>
                            </Tabs>
                        </telerik:RadTabStrip>
                        <telerik:RadMultiPage runat="server" ID="Multipage" SelectedIndex="0" RenderSelectedPageOnly="false" Height="90px">
                     
                            <telerik:RadPageView runat="server" ID="Genearal">
                                <table>
                                    <tr>
                                        <td><b>   Name:</b></td>
                                        <td><asp:Label id="Label0" runat="server" Text='<%# Eval("ItemName") %>' /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   Source:</b></td>
                                        <td><asp:Label id="Label1" runat="server" Text='<%# Eval("ItemSource") %>' /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   Type:</b></td>
                                        <td><asp:Label id="Label2" runat="server" Text='<%# Eval("ItemType") %>' /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   Acq. Number:</b></td>
                                        <td><asp:Label id="Label3" runat="server" Text='<%# Eval("ItemAcqNumber") %>' /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   Description:</b></td>
                                        <td><asp:Label id="Label4" runat="server" Text='<%# Eval("ItemDescription") %>' /></td>
                                    </tr>                                       
                                </table
                            </telerik:RadPageView>
                              
                            <telerik:RadPageView runat="server" ID="Status">
                                <table>
                                    <tr>
                                        <td><b>   Status:</b></td>
                                        <td><asp:Label id="Label6" runat="server" Text='<%# Eval("ItemStatus") %>' /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   Date:</b></td>
                                        <td><asp:Label id="Label7" runat="server" Text='<%# Eval("ItemStatusDate") %>' /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   Detail:</b></td>
                                        <td><asp:Label id="Label8" runat="server" Text='<%# Eval("ItemStatusDetail") %>' /></td>
                                    </tr>
                                </table>                   
                            </telerik:RadPageView>
                              
                            <telerik:RadPageView runat="server" ID="Coverage">
                                <table>
                                    <tr>
                                        <td><b>   Coverage 1:</b></td>
                                        <td><asp:Label id="Label9" runat="server" Text='<%# Eval("ItemCoverage1") %>' /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   Coverage 2:</b></td>
                                        <td><asp:Label id="Label10" runat="server" Text='<%# Eval("ItemCoverage2") %>' /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   Coverage 2 Type:</b></td>
                                        <td><asp:Label id="Label11" runat="server" Text='<%# Eval("ItemCoverage3Description") %>' /></td>
                                    </tr>
                                </table>
                            </telerik:RadPageView>
                            <telerik:RadPageView runat="server" ID="Rejection">
                                <table>
                                    <tr>
                                        <td><b>   Report Delivery:</b></td>
                                        <td><asp:Label id="Label12" runat="server" Text="Email" /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   Indicator:</b></td>
                                        <td><asp:Label id="Label13" runat="server" Text="abc" /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   Email Recipients:</b></td>
                                        <td><asp:Label id="Label14" runat="server" Text="joe@mail.com|jane@mail.com" /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   Node Id:</b></td>
                                        <td><asp:Label id="Label15" runat="server" Text="1234" /></td>
                                    </tr>
                                    <tr>
                                        <td><b>   FTP Name:</b></td>
                                        <td><asp:Label id="Label16" runat="server" Text="ftp://server.com" /></td>
                                    </tr>
                                </table>
                            </telerik:RadPageView>
                        </telerik:RadMultiPage>
                    </asp:Panel>
                </ItemTemplate>
            </asp:FormView>
            <asp:ObjectDataSource runat="server" ID="ObjectDataSource" SelectMethod="Get" TypeName="Orbit3UI.Model.MasterItemDetailsDataSource">
                <SelectParameters>
                    <asp:ControlParameter ControlID="ItemName" Name="ItemName" PropertyName="Text" />
                    <asp:ControlParameter ControlID="ItemSource" Name="ItemSource" PropertyName="Text" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </NestedViewTemplate>
    </MasterTableView>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
</telerik:RadGrid>

So what can I do in order to have this work for both sorting/filtering as well as hierarchy expansion? 

BTW, I do my own sorting/filtering as well as paging since I cannot load all the records from the database at once. 

I am wondering if by intercepting an event and doing something I can stop the grid from trying to interact with the FormView in the NestedTemplateView at all since all I want is to sort the Master Table! . 

Thanks. 

Sal
  

Sal
Top achievements
Rank 1
 answered on 08 Aug 2011
7 answers
199 views
I have a grid which is populated from a webservice with the required data. I then have a nested template where I show, inside a FormView, further details for the partiular record I selected to expand. I created an object data source for this, which ultimately also talks to a web service to retreive the data.  

It works fine for individual records retrieved one at a time, however, when I try to expand two records at the same time, both "views" are updated with the exact same information, instead of keeping the details for each record independently.

I think I know that this happens because it refreshes the datasource everytime I select a new record to expand. The problem is that I don't know how to tell the grid (and therefore the nested formview) not to refresh all open windows but only the one expanded.

Here is an excerpt from my code:

<telerik:RadGrid ID="OrbitRadGrid" runat="server" AllowFilteringByColumn="True" AllowSorting="True" VirtualItemCount="50000" 
        GridLines="None" AllowPaging="true" PageSize="30" AllowCustomPaging="true" ShowGroupPanel="false" EnableLinqExpressions="false" 
        OnNeedDataSource="OrbitRadGrid_NeedDataSource" OnSortCommand="OrbitRadGrid_SortCommand" 
        Skin="WebBlue" >
  
        <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="False" ReorderColumnsOnClient="True">
            <Scrolling AllowScroll="True" EnableVirtualScrollPaging="True" UseStaticHeaders="True" SaveScrollPosition="True" />
            <Resizing AllowColumnResize="True" />
        </ClientSettings>
  
        <MasterTableView DataKeyNames="Item_Name, Source_Name" AutoGenerateColumns="False" AllowNaturalSort="false">
              
            <Columns>
                <telerik:GridBoundColumn DataField="Item_Name" HeaderText="Item Name" 
                    ReadOnly="True" SortExpression="Item_Name" UniqueName="Item_Name" HeaderStyle-Width="220px">
                </telerik:GridBoundColumn>
  
                <telerik:GridBoundColumn DataField="Source_Name" HeaderText="Item Source" ReadOnly="True" 
                    SortExpression="Source_Name" UniqueName="Source_Name" HeaderStyle-Width="220px">
                </telerik:GridBoundColumn>
  
                <telerik:GridBoundColumn DataField="ItemType_Name" HeaderText="Item Type" ReadOnly="True" 
                    SortExpression="ItemType_Name" UniqueName="ItemType_Name" HeaderStyle-Width="115px">
                </telerik:GridBoundColumn>
  
                <telerik:GridBoundColumn DataField="Team_Name" HeaderText="Item Team" ReadOnly="True" 
                    SortExpression="Team_Name" UniqueName="Team_Name" HeaderStyle-Width="115px">
                </telerik:GridBoundColumn>
  
                <telerik:GridBoundColumn DataField="IsTestItem" HeaderText="Test" ReadOnly="True" 
                    UniqueName="IsTestItem"  AllowFiltering="false" HeaderStyle-Width="50px">
                </telerik:GridBoundColumn>
                  
                <telerik:GridBoundColumn DataField="IsItemOnHold" HeaderText="On Hold" ReadOnly="True" 
                    UniqueName="IsItemOnHold"  AllowFiltering="false" HeaderStyle-Width="62px">
                </telerik:GridBoundColumn>
                 
            </Columns>
          
            <NestedViewSettings DataSourceID="MasterItemsDetails" >
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="ItemName" MasterKeyField="Item_Name" />
                    <telerik:GridRelationFields DetailKeyField="ItemSource" MasterKeyField="Source_Name" />
                </ParentTableRelation>
            </NestedViewSettings>
  
            <NestedViewTemplate>
                <asp:FormView ID="FormView" runat="server" DataSourceID="MasterItemsDetails">
                    <ItemTemplate>
                        <asp:Panel ID="NestedViewPanel" runat="server" CssClass="viewWrap">
                            <div class="contactWrap">
                                <table>
                                    <tr>
                                        <td>
                                            <fieldset style="padding: 10px;">
                                                <legend style="padding: 5px;"><b>General info</b></legend>
                                                <table width="400">
                                                    ...
                                                </table>
                                            </fieldset>
                                        </td>
                                        <td>
                                            <table width="200">
                                                <tr>
                                                    <td>
                                                        <fieldset style="padding: 10px;">
                                                            <legend style="padding: 5px;"><b>Status</b></legend>
                                                            <table>
                                                                ...
                                                            </table>
                                                        </fieldset>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <fieldset style="padding: 10px;" >
                                                            <legend style="padding: 5px;"><b>Coverage</b></legend>
                                                            <table>
                                                                ...
                                                            </table>
                                                        </fieldset>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                        <td>
                                            <fieldset style="padding: 10px;" >
                                                <legend style="padding: 5px;"><b>Rejection Information</b></legend>
                                                <table width="300">
                                                    ...
                                                </table>
                                            </fieldset>
                                        </td>
  
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                    </ItemTemplate>             
                </asp:FormView>
            </NestedViewTemplate>
   
        </MasterTableView>
  
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
  
    </telerik:RadGrid>
  
    <asp:ObjectDataSource runat="server" ID="MasterItemsDetails" SelectMethod="Get" TypeName="Orbit3UI.Model.MasterItemDetailsDataSource">
        <SelectParameters>
            <asp:Parameter Name="itemName" Type="String" />
            <asp:Parameter Name="itemSource" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>

The OnNeedDataSource event is used for filtering of the Master table. 

Is there anything I need to set in order to prevent the nested formviews to update with each request?

Thank you
 
Sal
Top achievements
Rank 1
 answered on 08 Aug 2011
5 answers
258 views
Hi,
I have a RadTreeView in which I want to load the child nodes on demand (as it says in the Demo) using a WCF service I published to my Sharepoint Site.
The service works fine when I initialize the tree on runtime (I get the root's children when the page loads) however, when I open a node I get "The server method 'GetChildNodes' failed", using Fiddler I checked the source of the error and saw this:

"HTTP/1.1 415 Cannot process the message because the content type 'application/json; charset=utf-8' was not the expected type 'text/xml charset=utf-8'."

What am I doing wrong here?

Thanks!
Helen
Telerik team
 answered on 08 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?