Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
136 views
Dear Support team

I wanted to create a RadGrid with self-referencing hierarchy so i did what ever was written in documentation. now the table shows up with collapse/expand column but it doesn't show chid hierarch.
Please help me to solve the issue.


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        EnableTheming="True">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI"
                Name="Telerik.Web.UI.Common.Core.js">
            </asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI"
                Name="Telerik.Web.UI.Common.jQuery.js">
            </asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI"
                Name="Telerik.Web.UI.Common.jQueryInclude.js">
            </asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI"
                Name="Telerik.Web.UI.Common.jQueryInclude.js">
            </asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI"
                Name="Telerik.Web.UI.Common.jQuery.js">
            </asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI"
                Name="Telerik.Web.UI.Common.Core.js">
            </asp:ScriptReference>
        </Scripts>
    </telerik:RadScriptManager>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        DeleteCommand="DELETE FROM [Parts] WHERE [PartID] = @PartID"
        InsertCommand="INSERT INTO [Parts] ([Part Name], [ParentID]) VALUES (@Part_Name, @ParentID)"
        SelectCommand="SELECT * FROM [Parts]"
        UpdateCommand="UPDATE [Parts] SET [Part Name] = @Part_Name, [ParentID] = @ParentID WHERE [PartID] = @PartID">
        <DeleteParameters>
            <asp:Parameter Name="PartID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Part_Name" Type="String" />
            <asp:Parameter Name="ParentID" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Part_Name" Type="String" />
            <asp:Parameter Name="ParentID" Type="Int32" />
            <asp:Parameter Name="PartID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True"
        AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
        AutoGenerateHierarchy="True" CellSpacing="0" DataSourceID="SqlDataSource1"
        GridLines="None">
<MasterTableView AutoGenerateColumns="False" DataKeyNames="PartID,ParentID"
            DataSourceID="SqlDataSource1">
    <SelfHierarchySettings KeyName="PartID" ParentKeyName="`" />
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
 
    <Columns>
        <telerik:GridBoundColumn DataField="PartID" DataType="System.Int32"
            FilterControlAltText="Filter PartID column" HeaderText="PartID" ReadOnly="True"
            SortExpression="PartID" UniqueName="PartID">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Part Name"
            FilterControlAltText="Filter Part Name column" HeaderText="Part Name"
            SortExpression="Part Name" UniqueName="Part Name">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ParentID" DataType="System.Int32"
            FilterControlAltText="Filter ParentID column" HeaderText="ParentID"
            SortExpression="ParentID" UniqueName="ParentID">
        </telerik:GridBoundColumn>
    </Columns>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
 
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
    </telerik:RadGrid>
    <script type="text/javascript">
        //Put your Java Script code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
  
    <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="WebBlue">
    </telerik:RadSkinManager>
    <div>
 
    </div>
    </form>
</body>
</html>
Shinu
Top achievements
Rank 2
 answered on 14 Nov 2011
1 answer
70 views
I am fatching 20,000 rows from database throw dataset and show in radgrid,i want to impliment custom paging with each page 2000 rows ,and i want to implement client side pagging that when pageindex will be change it will not be refreshed ,so plese help me to implement the code.
Princy
Top achievements
Rank 2
 answered on 14 Nov 2011
1 answer
244 views
Hi All,

I have generated a RadGrid using a table. Code below is
While delete I need confirmation.
For that I have added confirmationtext usingtelerik:GridButtonColumn But it is not deleting. Only it is howing a message box. So what code we need to put in code-behind or aspx page to do deletions. Tell me some suggestions

<telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True"             
            ShowStatusBar="True" AllowPaging="True" Skin="Office2007"
            AutoGenerateDeleteColumn="True" AutoGenerateColumns="False" AllowFilteringByColumn="True"
            DataSourceID="SqlDataSource5" GridLines="None" Width="520px"
AllowAutomaticUpdates="True" AllowAutomaticInserts="True" AutoGenerateEditColumn="True">
             
            <MasterTableView DataSourceID="SqlDataSource5" AllowAutomaticUpdates="True"
                 CommandItemDisplay="Top"  DataKeyNames="ID" AllowAutomaticInserts="true">
                 
                <Columns>               
                    <telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID"
                        UniqueName="ID" DataType="System.Int32" ReadOnly="True" Visible="false"  />
                    <telerik:GridBoundColumn DataField="Class" HeaderText="Class" SortExpression="Class"
                        UniqueName="Class" />                   
                    <telerik:GridBoundColumn DataField="Course"
                        HeaderText="Course" SortExpression="Course" UniqueName="Course" AllowFiltering="false">
                    </telerik:GridBoundColumn
                     
                    <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this row or record?"
                    CommandName="Delete" Text="Delete">
</telerik:GridButtonColumn>
 
                     
                        
                    <%--<telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
UniqueName="DeleteColumn">
<ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
</telerik:GridButtonColumn>--%>
     
                </Columns>
            </MasterTableView>
                    <HeaderStyle HorizontalAlign="Center" />
        </telerik:RadGrid>
         
                    <asp:SqlDataSource ID="SqlDataSource5" runat="server"
                        ConnectionString="<%$ ConnectionStrings:SearchingConnectionString %>"
                        DeleteCommand="DELETE FROM [Clas_Course] WHERE [ID] = @ID"
                        InsertCommand="INSERT INTO [Clas_Course] ([Class], [Course]) VALUES (@Class, @Course)"
                        SelectCommand="SELECT [ID], [Class], [Course] FROM [Clas_Course]"
                        UpdateCommand="UPDATE [Clas_Course] SET [Class] = @Class, [Course] = @Course WHERE [ID] = @ID">
                        <DeleteParameters>
                            <asp:Parameter Name="ID" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>                       
                            <asp:Parameter Name="Class" Type="String" />
                            <asp:Parameter Name="Course" Type="String" />
                        </InsertParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="Class" Type="String" />
                            <asp:Parameter Name="Course" Type="String" />
                            <asp:Parameter Name="ID" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                </td></tr>
                 </table>   <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
                    </div
        <div class="cornerDiv">
            <img src="Images/bLeft_corner.gif" class="float"/>
            <div class="bg_div"></div>
            <img src="Images/bRight_corner.gif" class="float"/>
        </div>
Shinu
Top achievements
Rank 2
 answered on 14 Nov 2011
1 answer
265 views

Posted on Nov 7, 2011 (permalink)

Hi,
   I am working on a form that requires a detail grid view for each Grid object. I have made a main OrderView Grid which just shows the dates for the orders and a child grid that should get the OrderDate from the Parent grid and show orders just for the selected Date in the parent grid. the OrderDate is common between both grids, but when I try to pass in the OrderDate to the child grid  I am getting the this error "An unhandled exception of type 'System.StackOverflowException' occurred in System.dll"
, I looked at the example at http://demos.telerik.com/aspnet-ajax/grid/examples/programming/detailtabledatabind/defaultcs.aspx
to do this. Can someone please show me how to do this with an example in code?  Your helps appreciated thanks.

*Note I posted a similar question earlier and I kept getting responses similar to what I had already posted here in the codebehind,please take a look at the code behind I have posted a comment in 

 

grdOrderDates_DetailTableDataBind event

 

 sample here and any relevant suggestions would be helpful?  Sorry about all the posted code Im dissapointed you cant attach a project file as an attachment :( and wanted to have the other person look at the same thing im looking at, thanks!

ASPX:
  
  
         <telerik:RadAjaxManagerProxy ID="OrderAM" runat="server">
             <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="AjaxOrderDates">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="grdOrderDates" LoadingPanelID="RadAjaxLoadingPanel" />
                    </UpdatedControls>                  
                </telerik:AjaxSetting>
           </AjaxSettings>
         </telerik:RadAjaxManagerProxy>
  
    <div style="margin:20px 100px 20px 400px">
    <h3> Orders By Date</h3>
    <br />
    <br />
  
    <table>
       <tr>
         <td>
            Start Date:
         </td>
         <td align="left">
            <telerik:RadDatePicker runat="server" ID="CalStartDate"></telerik:RadDatePicker>
         </td>
       </tr>
  
       <tr>
         <td>
           End Date:
         </td>
         <td align="left">
            <telerik:RadDatePicker runat="server" ID="CalEndDate"></telerik:RadDatePicker>
         </td>
       </tr>
       <tr style="margin:20px 0">
         <td colspan="2" align="center">
            <asp:Button runat="server" ID="BtnSubmit" Text="Submit" 
                 onclick="BtnSubmit_Click" />
         </td>
       </tr>
  
  
    </table>
  
  
  
        <telerik:RadGrid runat="server" ID="grdOrderDates" Width="750px" Height="100%" AllowPaging="true"
            AllowSorting="true" EnableLinqExpressions="false"
            ShowFooter="true" ondetailtabledatabind="grdOrderDates_DetailTableDataBind">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <MasterTableView AutoGenerateColumns="false" AllowAutomaticDeletes="true" AllowAutomaticInserts="true"
                AllowAutomaticUpdates="true" InsertItemPageIndexAction="ShowItemOnCurrentPage"
                DataKeyNames="OrderDate" CommandItemDisplay="Top" EditMode="PopUp" AllowMultiColumnSorting="true"
                OverrideDataSourceControlSorting="true" AllowFilteringByColumn="true" FilterItemStyle-HorizontalAlign="Left"
                ShowFooter="true" ShowHeader="true" HierarchyLoadMode="ServerOnDemand">
          
                <CommandItemSettings AddNewRecordText="" />
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                </ExpandCollapseColumn>
                   
  
                       <DetailTables>
                          <telerik:GridTableView AutoGenerateColumns="false" DataKeyNames="OrderDate" DataSourceID="ODSOrders">
                                
  
                              <ParentTableRelation>
                                 <telerik:GridRelationFields DetailKeyField="Date" MasterKeyField="OrderDate" />
                              </ParentTableRelation>
                              <Columns>
                                 <telerik:GridBoundColumn DataField="Date" HeaderText="OrderDate" ></telerik:GridBoundColumn>
                                 <telerik:GridBoundColumn DataField="OrderID" HeaderText="OrderID" ></telerik:GridBoundColumn>
                                 <telerik:GridBoundColumn DataField="Customer" HeaderText="Customer" ></telerik:GridBoundColumn>
                                 <telerik:GridBoundColumn DataField="Location" HeaderText="Location" ></telerik:GridBoundColumn>
                                 <telerik:GridBoundColumn DataField="Destination" HeaderText="Destination" ></telerik:GridBoundColumn>
                                 <telerik:GridBoundColumn DataField="Quantity" HeaderText="Quantity" ></telerik:GridBoundColumn>
                                 <telerik:GridBoundColumn DataField="QuantityRemaining" HeaderText="Quantity Remaining" ></telerik:GridBoundColumn>
                              </Columns>
                          </telerik:GridTableView>
                       </DetailTables>
  
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        <HeaderStyle></HeaderStyle>
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="OrderDate" UniqueName="OrderDate" HeaderText="Order Date" />
  
                </Columns>
                  
              
            </MasterTableView>
            <GroupingSettings CaseSensitive="False" />
              
        </telerik:RadGrid>
    </div>
  
     
    <asp:ObjectDataSource ID="ODSOrderList" runat="server" TypeName="DAL.OrderRepository"
        DataObjectTypeName="DAL.OrderView" SelectMethod="getOrderDatesinRange" 
    onselecting="ODSOrderList_Selecting">
       <SelectParameters>
             <asp:Parameter Name="StartDate" DbType="DateTime" />
             <asp:Parameter Name="EndDate" DbType="DateTime" />
       </SelectParameters>
    </asp:ObjectDataSource>
      
    <asp:ObjectDataSource ID="ODSOrders" runat="server" TypeName="DAL.OrderRepository"
        DataObjectTypeName="DAL.Order" SelectMethod="getOrderListinRange" 
       >
      <SelectParameters>
             <asp:Parameter Name="orderDate" Type="DateTime" />
       </SelectParameters>
    </asp:ObjectDataSource>

And here is the Codebehind file and the C# class and repository im using with some sample data so you can try this as well:

C# code Behind
  
 public partial class OrderView_Screen : System.Web.UI.Page
    {
        DateTime orderDate;
  
        protected void Page_Load(object sender, EventArgs e)
        {
  
        }
  
        public void LoadOrdersByDate()
        {
            //Loads Parent Grid when date range for Orders is given and binds Parent grid
            grdOrderDates.DataSourceID = "ODSOrderList";
            grdOrderDates.DataBind();
        }
  
        protected void ODSOrderList_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            e.InputParameters["StartDate"] = CalStartDate.SelectedDate;
            e.InputParameters["EndDate"] = CalEndDate.SelectedDate;
        }
  
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            //Loads Parent Grid when date range for Orders is given and binds Parent grid
            LoadOrdersByDate();
        }
  
  
        protected void grdOrderDates_DetailTableDataBind(object sender, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            try
            {
  
                GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
  
                // This line throws error An unhandled exception of type 'System.StackOverflowException' occurred in System.dll 
                DateTime orderDate = Convert.ToDateTime(dataItem["OrderDate"].Text);
  
                e.DetailTableView.DataSourceID = "ODSOrders";
                e.DetailTableView.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
  
        protected void ODSOrders_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
          e.InputParameters["orderDate"] = orderDate;
        }
    }

C# DAL Classes and Repository Class

public class Order
    {
        public Int16 OrderID { get; set; }
        public string Customer { get; set; }
        public string Destination { get; set; }
        public Int16 Quantity { get; set; }
        public Int16 QuantityRemaining { get; set; }
        public DateTime Date { get; set; }
    }
  
public class OrderView
    {
        public DateTime OrderDate { get; set; }
        public Int16 OrderID { get; set; }
  
    }
  
  
  public class OrderRepository
    {
  
       public IEnumerable<OrderView> getOrderDatesinRange(DateTime startdate, DateTime enddate)
       {
      
            List<OrderView> orderViewList = new List<OrderView>();
  
            IEnumerable<OrderView> filterList = getOrderRange(startdate, enddate);
  
          
  
            var oList = (from o in filterList
                         where o.OrderDate >= startdate
                             && o.OrderDate < enddate
                         select o).GroupBy(i => i.OrderDate, (key, group) => group.First()).ToList();
  
  
            orderViewList = oList.Cast<OrderView>().ToList();
         
  
            
  
            return orderViewList;
        }
  
  
        public IEnumerable<Order> getOrderListinRange(DateTime orderDate)
        {
            IEnumerable<Order> ordersList = new List<Order>();
  
            IEnumerable<Order> filterList = getOrders(orderDate);
  
  
            ordersList = (from o in filterList
                          where o.Date == orderDate
                          select o).ToList();
  
            return ordersList;
        }
  
  
  
        public IEnumerable<OrderView> getOrderRange(DateTime startdate, DateTime enddate)
        {
            List<OrderView> getList = new List<OrderView>();
            
            getList.Add(new OrderView {OrderDate = new DateTime(2011,10,1) , OrderID = 1});
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 2), OrderID = 1 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 3), OrderID = 1 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 4), OrderID = 1 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 6), OrderID = 1 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 7), OrderID = 1 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 8), OrderID = 1 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 9), OrderID = 1 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 10), OrderID = 1 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 11), OrderID = 1 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 12), OrderID = 1 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 1), OrderID = 2 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 2), OrderID = 2 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 3), OrderID = 2 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 4), OrderID = 2 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 6), OrderID = 2 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 7), OrderID = 2 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 8), OrderID = 3 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 9), OrderID = 3 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 10), OrderID = 3 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 11), OrderID = 3 });
            getList.Add(new OrderView { OrderDate = new DateTime(2011, 10, 12), OrderID = 3 });
            return getList;
        }
  
  
        public IEnumerable<Order> getOrders(DateTime orderDate)
        {
            List<Order> getOrderList = new List<Order>();
  
            getOrderList.Add(new Order { Date = new DateTime(2011, 10, 1), OrderID = 1, Customer = "Evraz", Destination = "Houston", Quantity = 70, QuantityRemaining = 55 });
            getOrderList.Add(new Order { Date = new DateTime(2011, 10, 2), OrderID = 1, Customer = "Evraz", Destination = "Houston", Quantity = 70, QuantityRemaining = 35 });
            getOrderList.Add(new Order { Date = new DateTime(2011, 10, 3), OrderID = 1, Customer = "Evraz", Destination = "Houston", Quantity = 70, QuantityRemaining = 20 });
            getOrderList.Add(new Order { Date = new DateTime(2011, 10, 1), OrderID = 2, Customer = "TCIM", Destination = "Orlando", Quantity = 100, QuantityRemaining = 80 });
            getOrderList.Add(new Order { Date = new DateTime(2011, 10, 2), OrderID = 2, Customer = "TCIM", Destination = "Orlando", Quantity = 70, QuantityRemaining = 60 });
            getOrderList.Add(new Order { Date = new DateTime(2011, 10, 3), OrderID = 2, Customer = "TCIM", Destination = "Orlando", Quantity = 70, QuantityRemaining = 30 });
            getOrderList.Add(new Order { Date = new DateTime(2011, 10, 1), OrderID = 3, Customer = "PT", Destination = "Atlanta", Quantity = 80, QuantityRemaining = 70 });
            getOrderList.Add(new Order { Date = new DateTime(2011, 10, 2), OrderID = 3, Customer = "PT", Destination = "Atlanta", Quantity = 80, QuantityRemaining = 40 });
            getOrderList.Add(new Order { Date = new DateTime(2011, 10, 3), OrderID = 3, Customer = "PT", Destination = "Atlanta", Quantity = 80, QuantityRemaining = 20 });
              
             
            return getOrderList;
        }
  
    }
Shinu
Top achievements
Rank 2
 answered on 14 Nov 2011
2 answers
103 views
My problem is pretty simple but I really can not figure how to solve it, the scheduler keeps doing full post backs on the page while I'm changing the dates, opening the advanced form, etc...

Please provide me with attached working example built on 4.0. I been trying to solve this silly issue for more than three hours and tried to put the script manager in Master page, etc... but nothing worked for me.

I'm using Telerik 2011 Q2 and I have the scheduler in the page as below:
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <rad:RadScriptManager runat="server" ID="RadScriptManager1" />
    <rad:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <ajaxsettings>
                <rad:AjaxSetting AjaxControlID="RadScheduler1">
                    <UpdatedControls>
                        <rad:AjaxUpdatedControl ControlID="RadScheduler1" />
                    </UpdatedControls>
                </rad:AjaxSetting>
            </ajaxsettings>
    </rad:RadAjaxManager>
    <div id="dvMain">
        <rad:RadScheduler ID="RadScheduler1" runat="server" Skin="Windows7" DayStartTime="08:00:00"
            DayEndTime="18:00:00" DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start"
            DataEndField="End">
        </rad:RadScheduler>
    </div>
    <rad:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
</asp:Content>

The HTML in master page as below:
<head runat="server">
    <title>Home</title>
</head>
<body>
    <form id="frmMaster" runat="server">
    <div>
        <asp:ContentPlaceHolder ID="MainContentPlaceHolder" runat="server">
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

waiting your forthcoming reply.
Taiseer
Top achievements
Rank 1
 answered on 13 Nov 2011
1 answer
107 views
Hi all
I have two radzones and i'm adding the docks dynamically to the zones on button click.
My problem is if add one dock , resize the dock by grabing the dock.
Then I added one more dock then previously added dock not persisting its height instead its getting default height.
How can I avoid this on postback.
pls help as early as possible.

my aspx code.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DashBoard.aspx.cs" Inherits="DashBoard_DashBoard" EnableEventValidation="false"%>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE HTML />
  
<head>
    <link href="../css/main.css" type="text/css" rel="stylesheet" />
    <link href="../css/jquery-ui.css" type="text/css" rel="stylesheet" />
    <script src="../Scripts/jquery.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery-ui.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.ui.core.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery-ui-1.8.5.custom.min.js" type="text/javascript"></script>
    <script  src="../Scripts/Resize.js" type="text/javascript"></script>
  
    <title>Dashboard</title>
    <style type="text/css">
        .style1
        {
            width: 119%;
            height: 324px;
        }
        .style3
        {
            width: 265px;
            height: 284px;
        }
        .zone
        {
         overflow:auto;
        }
          
    </style>
    <%-- Css for maximize and minimize button--%>
    <style type="text/css">
        body
        {
          width:100%;
          height:97%;
          overflow-y:hidden;
        }
          .rdContent
          {
            overflow-x:hidden !important;
          }
            
          .rdTitleBar em
          {
           width:auto !important;
          }
    
        .max
        {
            /*change the url of the image */
            width: 20px !important;
            background: url('../images/maximize.gif') no-repeat !important;
        }
        .min
        {
            /*change the url of the image */
            width: 20px !important;
            background: url('../images/minimize.jpg') no-repeat !important;
        }
        .style5
        {
            width: 265px;
            height: 182px;
        }
        .style6
        {
            width: 265px;
            height: 181px;
        }   
    </style>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
              
            var isMax=false;
            var expandDockheight;
            window.onresize = resizeDockZones;
  
            
            function dockInitialize(obj, args) {
                OverrideClose();
            }
  
            // When a dock is closed, its DockZoneId is stored into the hidden field
            function ClientCommand(sender, args) {
  
                if (args.Command.get_name() == "Close") 
                {
                    var hiddenField = $get("<%=closedDockZoneId.ClientID %>");
                    hiddenField.value = sender.get_dockZoneID();
  
                    //this code repositions the docks to their zones once a dock is closed
                    var zones = Telerik.Web.UI.RadDockZonesGlobalArray;
                    var length = docks.length;
                    var zonesCount = 0;
  
                    for (var i = 0; i < length; i++)
                    {
                        //                         if (docks.length == 2) 
                        //                        {
                        //                            if (!docks[i].get_closed()) {
                        //                                zones[0].dock(docks[i]);
                        //                                zonesCount++;
                        //                            }
                        //                        }
  
                        SwitchCheckBox(docks[i], !docks[i].get_closed());
                    }
                }                
            }
  
            //Enables/Disables the checkboxes
            function SwitchCheckBox(dock, toDisable) {
                var id = "";
                switch (dock.get_id())//disable the respective check-box
                {
                    case "1":
                        id = "#chkAlrmSumry";
                        break;
                    case "2":
                        id = "#chkActCals";
                        break;
                    case "3":
                        id = "#chkPndCals";
                        break;
                    case "4":
                        id = "#chkCalActConsole";
                        break;
                    case "5":
                        id = "#chkDisptchr";
                        break;
                    case "6":
                        id = "#chkCalActEndpnt";
                        break;
                }
  
                EnableDisableCheckBox(id, toDisable);
            }
  
            function EnableDisableCheckBox(id, toDisable) {
                if (toDisable) {
                    $(id).attr('checked');
                    // $(id)[0].parentNode.className = "aspNetDisabled";
                }
                else {
                    $(id).removeAttr('checked');
                    // $(id)[0].parentNode.className = "";
                }
            }
  
            //When the content area of a dock is clicked, page navigation to the desired location must take place
            var docks = [];
            //When the content area of a dock is clicked, page navigation to the desired location must take place
            function Dock_OnClientInitialize(dock, args) {
                docks[docks.length] = dock;
                var dockElem = dock.get_contentContainer();  //get reference to the dock's wrapper element
  
                $addHandler(dockElem, "dblclick", Function.createDelegate(dock, function () {
                    //if maximized do not redirect
                  if (this.get_commands().Maximize.get_state() == 2) 
                     return;
  
                    switch (this.get_id())//assign different pages to the docks according their title
                    {
                        case "1":
                            window.location = "AlarmSummary.aspx";
                            break;
                        case "2":
                            window.location = "ActiveCalls.aspx";
                            break;
                        case "3":
                            window.location = "PendingCalls.aspx";
                            break;
                        case "4":
                            window.location = "CallActivityForConsole.aspx";
                            break;
                        case "5":
                            window.location = "CallActivityForDispatchr.aspx";
                            break;
                        case "6":
                            window.location = "CallActivityForEndPnt.aspx";
                            break;
                    }
                }), false);
            }
  
            function Dock_resize(dock, args) {
                args.Command.set_state(args.Command.get_state() == 1 ? 2 : 1);
            }
  
            function noError() {
                return true;
            }
  
            window.onerror = noError;
            //Function for providng maximize and minimize features for the docks
            var dockZoneID = "";
            var dockInitialSize = {};
  
            function Dock_OnMaximizeCommand(dock, args) {
                if (window.innerHeight != undefined)
                    var viewportSize = { 'width': window.innerWidth + "px", 'height': window.innerHeight + "px" };
                //var viewportSize = { 'width': 750, 'height': 550 };
                else
                    var viewportSize = { 'width': document.documentElement.clientWidth + "px", 'height': document.documentElement.clientHeight + "px" };
                //var viewportSize = { 'width': 750, 'height': 550 };
                if (args.Command.get_state() == 1) {
                    //primary state
                    dockZoneID = dock.get_dockZoneID(); //store the dockZone where the dock was docked
                    dock.undock();
                    //set absolute position manually to workaround a bug in the undock() method
                    dock.get_element().style.position = "absolute";
                    //position the dock according to the layout wrapper
                    dock.set_top("0px");
                    dock.set_left("0px");
                    //store original dock size
                    dockInitialSize.width = dock.get_element().clientWidth;
                    dockInitialSize.height = dock.get_element().clientHeight;
                    //maximize the dock
                    dock.set_width(viewportSize.width);
                    dock.set_height(viewportSize.height);
                    expandDockheight = viewportSize.height;
                    //set the state of the command
                    args.Command.set_state(args.Command.get_state() == 1 ? 2 : 1);
                    isMax = true;
                }
  
                else 
                  {
                    //alternate state
                    //restore original dock size
                    dock.set_width(dockInitialSize.width);
                    dock.set_height(dockInitialSize.height);
                    dock._expandedHeight = dockInitialSize.height
  
                    if (args.Command.get_state() == 2) {
                        dock.set_width(dockInitialSize.width);
                        dock.set_height(dockInitialSize.height);
                    }
  
                    try {
                        dockZoneID = dock._dockZone.get_clientID() == null ? "" : dock._dockZone.get_clientID();
                    }
  
                    catch (exception) {
                        if (dockZoneID) {
                            $find(dockZoneID).dock(dock);
                        }
                    }
  
                    if (dockZoneID) {
                        $find(dockZoneID).dock(dock);
                    }
                    //dock the dock to its zone
                    //set the state of the command
                    args.Command.set_state(args.Command.get_state() == 1 ? 2 : 1);
                    isMax = false;
                    dock.doPostBack(args.Command.get_name());
                }
            }
  
            function pageLoad() {
               resizeDockZones();
            }
  
            function resizeDockZones() {
                var viewPortSize = $telerik.getViewPortSize();
                var dockZone1 = $find("<%=RadDockZone1.ClientID %>");
                var dockZone2 = $find("<%=RadDockZone2.ClientID %>");
                resizeZones(dockZone1, dockZone2, viewPortSize);
            }
  
            function OnresizeEnd(dock, args) {
               return dock._height;
            }
  
        </script>
        <style id="dockStyles" type="text/css" runat="server">            
        </style>
    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server" visible="True">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div id="modalRightCenterContent" style="display: none; background-color:white; border-color:red; border-style:solid; border-width:1px;">
        <div class="contentTableHeading">
            <asp:CheckBox ID="chkAlrmSumry" runat="server" />
            <asp:Label ID="alrmSuryLbl" runat="server" Text="Alarm Summary" ForeColor="#122480"/><br />
            <asp:CheckBox ID="chkActCals" runat="server" />
            <asp:Label ID="actCalLbl" runat="server" Text="Active Calls" ForeColor="#122480"/><br />
            <asp:CheckBox ID="chkPndCals" runat="server" />
            <asp:Label ID="pndCalLbl" runat="server" Text="Pending Calls" ForeColor="#122480"/><br />
            <asp:CheckBox ID="chkCalActConsole" runat="server" />
            <asp:Label ID="calActCnslLbl" runat="server" Text="Call Activity for Active Consoles"  ForeColor="#122480"/><br />
            <asp:CheckBox ID="chkDisptchr" runat="server" />
            <asp:Label ID="calActDisptrLbl" runat="server" Text="Call Activity for Active Dispatchers"  ForeColor="#122480"/><br />
            <asp:CheckBox ID="chkCalActEndpnt" runat="server" />
            <asp:Label ID="calActEndpntLbl" runat="server" Text="Call Activity for Active Endpoints" ForeColor="#122480"/><br />            
        </div>
        <div class="buttonHolder">
<%--            <input type="button" id="btnAdd" value="" class="btnMedium " />--%>
            <asp:Button ID="btnAdd" runat="server" CssClass="btnMedium"/>            
            <input type="button" id="btnCancel" value="" class="btnSmall marginActionButton"
                title="Cancel" />
        </div>
    </div>
     <input id="lnkPopup" type="button" class="btnVeryBig" value="" title="Add Widget"/>
               <telerik:RadDockLayout runat="server" ID="RadDockLayout1"
                OnSaveDockLayout="RadDockLayout1_SaveDockLayout" EnableViewState="false">
                    <div style="width:99%; height:95%;">
                        <br />
                        <asp:Table ID="Table1" runat="server" Width="100%">
                        <asp:TableRow>
                        <asp:TableCell Width="50%" Height="95%">
                        <telerik:RadDockZone ID="RadDockZone1" runat="server" Orientation="Vertical" CssClass="zone"  BorderColor="#d7d7d7">
                                    </telerik:RadDockZone>
                        </asp:TableCell>
                        <asp:TableCell  Width="50%" Height="95%">
                        <telerik:RadDockZone ID="RadDockZone2" runat="server" CssClass="zone" Orientation="Vertical"  BorderColor="#d7d7d7">
                                    </telerik:RadDockZone>
                        </asp:TableCell>
                        </asp:TableRow>
                        </asp:Table>
                    </div>
            </telerik:RadDockLayout>
            <asp:HiddenField runat="server" ID="closedDockZoneId" />
            <%--stores the id of the RadDockZone, which holds the closed RadDock--%>
          
  
    <%--Here goes the javascript for the popup--%>
    <script language="javascript" type="text/javascript">
        var popup = 0;
        $("#modalRightCenterContent").dialog({
            minHeight: 48,
            minWidth: 470,
            resizable: false,
            modal: true,
            autoOpen: false,
            title: "Add Widgets"
        })
              .parents(".ui-dialog").find(".ui-dialog-titlebar")
              .removeClass("ui-widget-header").addClass("titleBar");
  
        $("#lnkPopup").click(function () {
            $("#modalRightCenterContent").dialog('open');
        });
  
        $("#btnCancel").click(function () {
            $("#modalRightCenterContent").dialog('close');
        });
        $("#btnAdd").click(function () {
            document.location.href = "DashBoard.aspx?Dock1Val=" + chkAlrmSumry.checked + "&Dock2Val=" + chkActCals.checked + "&Dock3Val=" + chkPndCals.checked + "&Dock4Val=" + chkCalActConsole.checked + "&Dock5Val=" + chkDisptchr.checked + "&Dock6Val=" + chkCalActEndpnt.checked + "";
            $("#modalRightCenterContent").dialog('close');
            $("#chkAlrmSumry").removeAttr('checked');
            $("#chkActCals").removeAttr('checked');
            $("#chkPndCals").removeAttr('checked');
            $("#chkCalActConsole").removeAttr('checked');
            $("#chkDisptchr").removeAttr('checked');
            $("#chkCalActEndpnt").removeAttr('checked');
        });
    </script>
    </form>
</body>
</html>
My code behind
// ----------------------------------------
//  Copyright 2011 Avtec (Inc)
//
// This File has the implementation of DashBoard class methods.
//
//  Workfile:  DashBoard.aspx.cs
//  Revision:  1.0
//  Modified:  06/27/2011
//  All rights reserved. Copying, compilation, modification, distribution
//  or any other use whatsoever of this material is strictly prohibited
//  without the written consent of Avtec Inc.
// ----------------------------------------
  
  
/****************************************************************************/
/*!
*
*   @file DashBoard.aspx.cs
*
*   @brief Implements the Dashboard functionality
*
*/
/****************************************************************************/
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Telerik.Web.UI;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Web.Script.Serialization;
using System.Collections.ObjectModel;
using Avtec.DiagnosticLogger;
  
/****************************************************************************/
/*!
*   @brief Implements the funtionality related to widgets in the Dashboard tab.
*   
*/
/****************************************************************************/
public partial class DashBoard_DashBoard : System.Web.UI.Page
{
    ////////////////////////////////////////////////////
    //
    //!func Page_Load()
    //
    //!output param - None
    //
    //!input param - object,EventArgs
    //
    //!brief - 
    //
    /////////////////////////////////////////////////////
  
    bool[] Dock_flag = { false, false, false, false, false, false };
    bool[] chkBxStats = new bool[6];
    static string[] zoneIds= new string[6] { "", "", "", "", "", "" };
    string result_dock = "";
    static public string consleDocTitle;
    static public string disptrDocTitle;
    static public string endPntDocTitle;
    Business bsl;
  
    #region Properties
  
    private List<DockState> CurrentDockStates
    {
        get
        {
            // Store the info about the added docks in the session.  
            List<DockState> _currentDockStates = (List<DockState>)Session["CurrentDockStatesDynamicDocks"];
            if (Object.Equals(_currentDockStates, null))
            {
                _currentDockStates = new List<DockState>();
                Session["CurrentDockStatesDynamicDocks"] = _currentDockStates;
            }
            return _currentDockStates;
        }
        set
        {
            Session["CurrentDockStatesDynamicDocks"] = value;
        }
    }
    #endregion
  
    #region Protected Methods
    
    protected override void OnInit(EventArgs e)
    {
        string dockZneID = "";
  
        if (Session["DockFlags"] != null)
        {
            Dock_flag = (bool[])Session["DockFlags"];
        }
  
        for (int i = 0; i < CurrentDockStates.Count; i++)
        {
  
            if (CurrentDockStates[i].Closed == false)
            {
  
                RadDock dock = CreateRadDockFromState(CurrentDockStates[i]);
                RadDockLayout1.Controls.Add(dock);
                CreateSaveStateTrigger(dock);
                dock.Closed = false;
            }
        }
  
        if (!Page.IsPostBack)
        {
            for (int i = 1; i <= 6; i++)
            {
                result_dock = Request.QueryString["Dock" + i.ToString() + "Val"];
  
  
                if (result_dock != null && !result_dock.Equals(""))
                {
                    if (result_dock.Equals("true") && Dock_flag[i - 1] == false)
                    {
                        RadDock dock = CreateRadDock(i);
                        AddToEmptyRadDock(dock);
                        CreateSaveStateTrigger(dock);
                        Dock_flag[i - 1] = true;
                        Session["DockFlags"] = Dock_flag;
                        dock.Closed = false;
                        zoneIds[i - 1] = dock.DockZoneID;
                    }
                }
            }
        }
  
        for (int i = 1; i <= 6; i++)
        {
            if (Session["ZoneIds"] != null)
            {
                zoneIds = (string[])Session["ZoneIds"];
            }
  
            result_dock = Request.QueryString["Dock" + i.ToString() + "Val"];
            dockZneID = zoneIds[i - 1] == null ? "" : zoneIds[i - 1];
  
            if (result_dock == "false" && !dockZneID.Equals(""))
            {
                removeDock(i, dockZneID);
            }
        }
    }
  
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            setDockName();
        }
          
      // refreshTimer.Interval = 10 * 6 * 200;
    }
  
    #endregion 
  
    #region Private Methods
  
    private void setDockName()
    {
        DataAccess accessData = new DataAccess();
        Business bsl = new Business();
  
        try
        {
            int[] values = accessData.getXYvalues();
            consleDocTitle = "Call Activity for " + values[1] + " Consoles for past " + values[0] + " hours";
            disptrDocTitle = "Call Activity for " + values[1] + " Dispatchers for past " + values[0] + " hours";
            endPntDocTitle = "Call Activity for " + values[1] + " Endpoints for past " + values[0] + " hours";
        }
  
        catch (Exception exception)
        {
            bsl.LogException("Page_load", exception.Message, "DashBoard.aspx.cs");
        }
  
        finally
        {
            accessData = null;
            bsl = null;
        }       
    }
  
    private void AddToEmptyRadDock(RadDock dock)
    {
        if (RadDockZone1.Docks.Count == 0)
        {
            RadDockZone1.Controls.Add(dock);
        }
  
        else
            if (RadDockZone2.Docks.Count == 0)
            {
                RadDockZone2.Controls.Add(dock);
            }
            else
                if (RadDockZone1.Docks.Count < 3 && !(RadDockZone1.Docks.Count > RadDockZone2.Docks.Count))
                {
                    RadDockZone1.Controls.Add(dock);
                }
                else
                    if (RadDockZone2.Docks.Count < 3)
                    {
                        RadDockZone2.Controls.Add(dock);
                    }
    }
  
    private RadDock CreateRadDockFromState(DockState state)
    {
         
        string docks = CurrentDockStates[0].DockZoneID;
        RadDock dock = new RadDock();
        dock.DockMode = DockMode.Default;
        dock.EnableAnimation = true;
        dock.EnableRoundedCorners = true;
        dock.EnableEmbeddedSkins = true;
        dock.TitlebarContainer.BorderColor = System.Drawing.ColorTranslator.FromHtml("#548264");
        dock.UniqueName = state.UniqueName;
        dock.ID = string.Format("RadDock{0}", state.UniqueName);
        dock.ApplyState(state);
        dock.Resizable = true;
        dock.Skin = "Outlook";
        DockCloseCommand closeCommand = new DockCloseCommand();
        closeCommand.AutoPostBack = true;
        DockExpandCollapseCommand expandCommand = new DockExpandCollapseCommand();
        expandCommand.AutoPostBack = false;
        DockToggleCommand maximizeCommand = new DockToggleCommand();
        maximizeCommand.Name = "Maximize";
        maximizeCommand.Text = "Maximize";
        maximizeCommand.OnClientCommand = "Dock_OnMaximizeCommand";
        maximizeCommand.AlternateText = "Restore";
        maximizeCommand.CssClass = "max";
        maximizeCommand.AlternateCssClass = "min";
        //assign client-side event handler
        dock.OnClientInitialize = "Dock_OnClientInitialize";
        dock.OnClientCommand = "ClientCommand";
        dock.ContentContainer.Style.Add(HtmlTextWriterStyle.OverflowX, "hidden");
        dock.TitlebarContainer.HorizontalAlign = HorizontalAlign.Left;
        dock.OnClientResizeEnd="OnresizeEnd";
        setDockName();
  
        switch (state.Tag)
        {
            case "1":
  
                Control widget = LoadControl("Controls/AlarmSummaryCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock1_Command);
                dock.ID = "1";
                dock.Title = "Alarm Summary";
                dock.ContentContainer.Controls.Add(widget);
                break;
  
            case "2":
  
                widget = LoadControl("Controls/ActiveCallsCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock2_Command);
                dock.ID = "2";
                dock.Title = "Active Calls";
                dock.ContentContainer.Controls.Add(widget);
                break;
  
            case "3":
  
                widget = LoadControl("Controls/PendingCallsCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock3_Command);
                dock.ID = "3";
                dock.Title = "Pending Calls";
                dock.ContentContainer.Controls.Add(widget);
                break;
  
            case "4":
  
                widget = LoadControl("Controls/CallActivityForConsoleCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock4_Command);
                dock.ID = "4";
                dock.Title = consleDocTitle;
                dock.ContentContainer.Controls.Add(widget);
                break;
  
            case "5":
  
                widget = LoadControl("Controls/CallActivityForDispatchrCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock5_Command);
                dock.ID = "5";
                dock.Title = disptrDocTitle;
                dock.ContentContainer.Controls.Add(widget);
                break;
  
            case "6":
  
                widget = LoadControl("Controls/CallActivityForEndPntCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock6_Command);
                dock.ID = "6";
                dock.Title = endPntDocTitle;
                dock.ContentContainer.Controls.Add(widget);
                break;
        }
  
        dock.Commands.Add(closeCommand);
        dock.Commands.Add(maximizeCommand);
        dock.Commands.Add(expandCommand);
        return dock;
    }
  
    private RadDock CreateRadDock(int i)
    {
        RadDock dock = new RadDock();
        dock.DockMode = DockMode.Default;
        dock.EnableAnimation = true;
        dock.EnableRoundedCorners = true;
        dock.EnableEmbeddedSkins = true;
        dock.TitlebarContainer.BorderColor = System.Drawing.ColorTranslator.FromHtml("#548264");
        dock.TitlebarContainer.HorizontalAlign = HorizontalAlign.Left;
        dock.Resizable = true;
        dock.UniqueName = Guid.NewGuid().ToString();
        dock.ID = string.Format("RadDock{0}", dock.UniqueName);
  
        switch (i)
        {
            case 1:
                dock.ID = "1";
                dock.Tag = "1";
                break;
            case 2:
                dock.ID = "2";
                dock.Tag = "2";
                break;
            case 3:
                dock.ID = "3";
                dock.Tag = "3";
                break;
            case 4:
                dock.ID = "4";
                dock.Tag = "4";
                break;
            case 5:
                dock.ID = "5";
                dock.Tag = "5";
                break;
            case 6:
                dock.ID = "6";
                dock.Tag = "6";
                break;
        }
  
        dock.Height = Unit.Pixel(165);
        dock.Width = Unit.Pixel(460);
  
        //assign client-side event handler
        dock.OnClientInitialize = "Dock_OnClientInitialize";
        DockCloseCommand closeCommand = new DockCloseCommand();
        closeCommand.AutoPostBack = true;
        DockExpandCollapseCommand expandCommand = new DockExpandCollapseCommand();
        dock.OnClientCommand = "ClientCommand";
        DockToggleCommand maximizeCommand = new DockToggleCommand();
        maximizeCommand.Name = "Maximize";
        maximizeCommand.Text = "Maximize";
        maximizeCommand.OnClientCommand = "Dock_OnMaximizeCommand";
        maximizeCommand.AlternateText = "Restore";
        maximizeCommand.CssClass = "max";
        maximizeCommand.AlternateCssClass = "min";
  
        dock.ContentContainer.Style.Add(HtmlTextWriterStyle.OverflowX, "hidden");
        dock.Skin = "Outlook";
  
        switch (dock.ID)
        {
            case "1":
  
                Control widget = LoadControl("~/DashBoard/Controls/AlarmSummaryCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock1_Command);
                dock.ContentContainer.Controls.Add(widget);
                dock.Title = "Alarm Summary";
                break;
  
            case "2":
  
                widget = LoadControl("~/DashBoard/Controls/ActiveCallsCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock2_Command);
                dock.Title = "Active Calls";
                dock.ContentContainer.Controls.Add(widget);
                break;
  
            case "3":
  
                widget = LoadControl("~/DashBoard/Controls/PendingCallsCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock3_Command);
                dock.Title = "Pending Calls";
                dock.ContentContainer.Controls.Add(widget);
                break;
  
            case "4":
  
                widget = LoadControl("~/DashBoard/Controls/CallActivityForConsoleCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock4_Command);
                dock.Title = consleDocTitle;
                dock.ContentContainer.Controls.Add(widget);
                break;
  
            case "5":
  
                widget = LoadControl("~/DashBoard/Controls/CallActivityForDispatchrCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock5_Command);
                dock.Title = disptrDocTitle;
                dock.ContentContainer.Controls.Add(widget);
                break;
  
            case "6":
  
                widget = LoadControl("~/DashBoard/Controls/CallActivityForEndPntCtrl.ascx");
                dock.Command += new DockCommandEventHandler(this.Dock6_Command);
                dock.Title = endPntDocTitle;
                dock.ContentContainer.Controls.Add(widget);
                break;
        }
  
        dock.Commands.Add(closeCommand);
        dock.Commands.Add(maximizeCommand);
        dock.Commands.Add(expandCommand);
        return dock;
    }
  
    private void CreateSaveStateTrigger(RadDock dock)
    {
        dock.AutoPostBack = true;
        dock.CommandsAutoPostBack=false;
    }
  
    private void Refresh(CheckBox chkbox, int index)
    {
        Dock_flag[index] = false;
        chkbox.Checked = false;
        zoneIds[index] = "";
    }
  
    private void removeDock(int dockid, string zoneID)
    {
         
        bsl = new Business();
  
        if (!zoneID.Equals(""))
        {
            if (zoneID == "RadDockZone1")
            {
                try
                {
                    RadDock dock = (from s in RadDockZone1.Docks
                                    where s.Tag == dockid.ToString()
                                    select s).First();
                    deleteDock(dockid, RadDockZone1, dock);
                }
  
                catch (Exception exception1)
                {
                    RadDock dock = (from s in RadDockZone2.Docks
                                    where s.Tag == dockid.ToString()
                                    select s).First();
                    deleteDock(dockid, RadDockZone2, dock);
                }
            }
  
            else
            {
                try
                {
                    RadDock dock = (from s in RadDockZone2.Docks
                                    where s.Tag == dockid.ToString()
                                    select s).First();
                    deleteDock(dockid,RadDockZone2,dock);
                     
                }
  
                catch (Exception exception2)
                {
                    RadDock dock = (from s in RadDockZone1.Docks
                                    where s.Tag == dockid.ToString()
                                    select s).First();
                    deleteDock(dockid, RadDockZone1, dock);
                }
            }
        }
  
        switch (dockid)
        {
            case 1:
                chkAlrmSumry.Checked = false;
                break;
            case 2:
                chkActCals.Checked = false;
                break;
            case 3:
                chkPndCals.Checked = false;
                break;
            case 4:
                chkCalActConsole.Checked = false;
                break;
            case 5:
                chkDisptchr.Checked = false;
                break;
            case 6:
                chkCalActEndpnt.Checked = false;
                break;
        }
  
        bsl = null;
    }
  
    private void deleteDock(int dockid,RadDockZone zone,RadDock dock)
    {
  
        zone.Docks.Remove(dock);
        zone.Controls.Remove(dock);
        dock.Closed = true;
        zoneIds[dockid - 1] = "";
        Dock_flag[dockid - 1] = false;
    }
  
    private void enableChhbx(int dockid)
    {
        switch (dockid)
        {
            case 1:
                chkAlrmSumry.Checked = true;
                break;
            case 2:
                chkActCals.Checked = true;
                break;
            case 3:
                chkPndCals.Checked = true;
                break;
            case 4:
                chkCalActConsole.Checked = true;
                break;
            case 5:
                chkDisptchr.Checked = true;
                break;
            case 6:
                chkCalActEndpnt.Checked = true;
                break;
        }
    }
    #endregion
  
    #region Control Events
  
    protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)
    {
        CurrentDockStates = new List<DockState>();
        var docks = RadDockLayout1.RegisteredDocks;
          
        foreach (DockState ds in RadDockLayout1.GetRegisteredDocksState())
        {
            CurrentDockStates.Add(ds);            
        }
          
        for (int i = 0; i < CurrentDockStates.Count; i++)
        {
          //  zoneIds[i] = CurrentDockStates[i].DockZoneID;
        }
  
        Session["DockFlags"] = Dock_flag;
  
        for(int i=1;i<=6;i++)
        {
            if (Dock_flag[i - 1] == true)
            {
                enableChhbx(i);
            }
        }
    }
  
    protected void Dock1_Command(object sender, DockCommandEventArgs e)
    {
        if (e.Command.Name.Equals("Close"))
        {
            Refresh(chkAlrmSumry, 0);
        }
    }
  
    protected void Dock2_Command(object sender, DockCommandEventArgs e)
    {
        if (e.Command.Name.Equals("Close"))
        {
            Refresh(chkActCals, 1);
        }
    }
  
    protected void Dock3_Command(object sender, DockCommandEventArgs e)
    {
        if (e.Command.Name.Equals("Close"))
        {
            Refresh(chkPndCals, 2);
        }
    }
  
    protected void Dock4_Command(object sender, DockCommandEventArgs e)
    {
        if (e.Command.Name.Equals("Close"))
        {
            Refresh(chkCalActConsole, 3);
        }
    }
  
    protected void Dock5_Command(object sender, DockCommandEventArgs e)
    {
        if (e.Command.Name.Equals("Close"))
        {
            Refresh(chkDisptchr, 4);
        }
    }
  
    protected void Dock6_Command(object sender, DockCommandEventArgs e)
    {
        if (e.Command.Name.Equals("Close"))
        {
            Refresh(chkCalActEndpnt, 5);
        }
    }
  
    #endregion    
}
Please help as soon as possible since its urgent for me
Ram
Top achievements
Rank 1
 answered on 12 Nov 2011
5 answers
178 views
Hi.
I tested the RadRating with a RadGrid and the time to show
results displays two lines of RadRating to select and the other with the assigned value.

As I show only the value of RadRating?

Thanks.

<telerik:RadGrid runat="server" ID="gridResults" AllowPaging="true" GridLines="None" OnItemDataBound="ResultsItemDataBound" AutoGenerateColumns="false" PageSize="10" Width= "570px" 
AllowSorting="true">
<ItemStyle BackColor="White" BorderColor="White" BorderWidth="0px" />
<AlternatingItemStyle BackColor="White" BorderColor="White" BorderWidth="0px" />
<MasterTableView TableLayout="Fixed" BackColor="White" BorderColor="White" BorderStyle="None"
BorderWidth="0px" AllowCustomSorting="true">
    <ItemTemplate>
         <asp:Label ID="lblId" Visible="false" Text='<%#Eval("Id")%>' runat="server" />
            <div class="itemGrid">
                 <div class="cadena">
                   <asp:Image runat="server" ID="imgCadena" Visible="true" Height="75px" Width="75px" 
                        style="margin-left:12px;" ImageAlign="Left" ImageUrl='<%#Eval("thumb") %>'/><br />                                
                  </div>                            
                  <div class="hotel">                            
                  <asp:Label ID="lblHotel" runat="server" Text='<%#Eval("name") %>'></asp:Label>
                  <br />
                  <asp:Label ID="lblDesc" runat="server" Font-Size="XX-Small" ForeColor="Silver" Text='<%#Eval("desc") %>'>
                   </asp:Label>
                   </div>                                                       
                   <div class="Stars">
                   <br />
                   <div style="text-align:center; float:left;">
                   <telerik:RadRating ID="RadRating1" runat="server" DBValue='<%#Eval("starsLevel")%>' />
                   </div>                            
                   <asp:Label ID="lblStars" runat="server"></asp:Label> <br />
                   </div>
                   <div class="precio">
                   <br />                            
                   <asp:Label ID="lblFare" runat="server" style="font-weight:bold" />
                   <br />
                   <div id="divComprar" runat="server" clientidmode="Static">                            
                   <telerik:RadButton ID="btnComprar" runat="server" Height="56px" Width="75px" Text="Comprar"
                           ForeColor="White" OnClick="BtnComprar_OnClick" Image-IsBackgroundImage="true"
                    Image-HoveredImageUrl="~/Images/btnBuscarHovered.png" Image-ImageUrl="~/Images/btnBuscar.png" >
                   </telerik:RadButton>
                   </div>                                                        
                   </div>                                            
                    </ItemTemplate>
                    <Columns>
                           //etc. 
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
Roberts
Top achievements
Rank 1
 answered on 11 Nov 2011
1 answer
94 views
Is there any way to bind the checked/unchecked status of the listbox checkboxes from the datasource?
Thanks.
Dan
Dan
Top achievements
Rank 2
 answered on 11 Nov 2011
0 answers
93 views
Hello!
I have a RadRibbonBar in Master Page, and RadGrid in Details.
RadGrid contains

  <telerik:GridTemplateColumn  UniqueName="Select" HeaderStyle-Width="3%"  AllowFiltering="false">
                          
                          <ItemTemplate>
                           <asp:CheckBox  id="chkSelect" runat="server"  />
                          </ItemTemplate>
                          
                       </telerik:GridTemplateColumn>

When user click on Export button, I need Get all rows selected in RadGrid. And export to XLS.

I dont kwon how access to selected Rows from radribbonBar :-)

thanks!

july
July
Top achievements
Rank 2
 asked on 11 Nov 2011
3 answers
187 views
Hi,

I'm having trouble with my RadGrid - whenever I try editing an item the row isn't put into edit mode and instead all the data is lost from the Grid.  I have AllowAutomaticUpdates set to true, and am using the NeedDataSource method.

My aspx code:
<telerik:RadGrid ID="SubmittedApplicantsRadGrid" runat="server" GridLines="Both" AutoGenerateColumns="False" OnNeedDataSource="SubmittedApplicantsRadGrid_NeedDataSource" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true">
    <ValidationSettings ValidationGroup="SubmittedApplicants"></ValidationSettings>
    <MasterTableView DataKeyNames="Id" EditMode="InPlace" CommandItemDisplay="None" NoMasterRecordsText="No applicants submitted to this job">
    <Columns>       
        <telerik:GridBoundColumn DataField="ApplicantName.Title" DataType="System.String" ReadOnly="true" HeaderText="Name" UniqueName="Name"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="PayRate" DataType="System.Double" DataFormatString="{0:C}" ReadOnly="true" HeaderText="Pay Rate" UniqueName="PayRate"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="BillRate" DataType="System.Double" DataFormatString="{0:C}" ReadOnly="true" HeaderText="Bill Rate" UniqueName="BillRate"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ApplicantName.Class" DataType="System.String" ReadOnly="true" HeaderText="Employee Class" UniqueName="Class"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="SubmittedBy.Title" DataType="System.String" ReadOnly="true" HeaderText="Submitted By" UniqueName="SubmittedBy"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="SubmittedDate" DataType="System.DateTime"  ReadOnly="true" HeaderText="Submitted On" UniqueName="SubmittedDate"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ForwardedBy.Title" DataType="System.String" ReadOnly="true" HeaderText="Forwarded By" UniqueName="ForwardedBy"></telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ForwardedDate" DataType="System.DateTime" ReadOnly="false" HeaderText="Forwarded On" UniqueName="ForwardedDate"></telerik:GridBoundColumn>
        <telerik:GridCheckBoxColumn DataField="Interviewed" DataType="System.Boolean" ReadOnly="false" HeaderText="Interviewed?" UniqueName="Interviewed"></telerik:GridCheckBoxColumn>
 
        <telerik:GridEditCommandColumn ButtonType="ImageButton">
            <ItemStyle Wrap="False" Width="28px" />
        </telerik:GridEditCommandColumn>
    </Columns>
 
    <EditFormSettings>
        <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
    </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>

And my C# code:
protected void SubmittedApplicantsRadGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    EntityList<ApplicantsSubmittedJobsItem> ApplicantsSubmittedJobs = data.GetList<ApplicantsSubmittedJobsItem>("ApplicantsSubmittedJobs");
 
    var applicantSubmittedJobs = from applicantSubmittedJob in ApplicantsSubmittedJobs
                                 select applicantSubmittedJob;
 
    SubmittedApplicantsRadGrid.DataSource = applicantSubmittedJobs;
}

Any help you could provide would be much appreciated.

Thanks!
Tarkon
Top achievements
Rank 1
 answered on 11 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?