Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
107 views

How to get the data from a sessiondatasource?
I get the following scenario:

The code the .aspx is as below:

<sds:SessionDataSource 
        DisplayWarning                  = "False"    
        PrimaryKeyFields                = "dp_key"
        ProviderName                    = "System.Data.SqlClient"
        ID                                         = "devis" 
        runat                                    = "server" 
        ConnectionString                = "<%$ ConnectionStrings:xxxxxxxxxx_Connection %>" 
        ConflictDetection               = "CompareAllValues" 
        OldValuesParameterFormatString  = "original_{0}"
        SelectCommand="SELECT * FROM [devis] ORDER BY dp_key"
        DeleteCommand="DELETE   FROM [devis] WHERE [dp_key] = ?"
        InsertCommand="INSERT   INTO devis(dp_codeprd, dp_nombre, dp_convives, dp_prixs, dp_prixs_unitaire) VALUES (?, ?, ?, ?, ? )" 
           
        >
        <DeleteParameters>
            <asp:Parameter Name="original_dp_key"               Type="Int32"   />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="dp_codeprd"                    Type="String"   />
            <asp:Parameter Name="dp_nombre"                     Type="String"   />
            <asp:Parameter Name="dp_convives"                   Type="Int16"    />
            <asp:Parameter Name="dp_prixs"                      Type="Decimal"  />
            <asp:Parameter Name="dp_prixs_unitaire"             Type="Decimal"  />
        </InsertParameters>
</sds:SessionDataSource>

This definition is used in a RadGrid. The code the .aspx is as below:
<telerik:RadGrid 
        ShowFooter              = "false"
        ID                      = "devis_prd" 
        runat                   = "server"
        DataSourceID            = "devis" 
        Width                   = "100%" 
        AllowPaging             = "True" 
        PageSize                = "10" 
        AllowSorting            = "false"
        GridLines               = "None"
           
        AllowAutomaticDeletes   = "True" 
        AllowAutomaticInserts   = "True"
        AllowAutomaticUpdates   = "True"
        onitemdatabound         = "devis_prd_ItemDataBound" 
    >
    <HeaderContextMenu EnableTheming="True">
        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
    </HeaderContextMenu>
    <MasterTableView 
        AutoGenerateColumns         = "False" 
        Width                       = "100%"    
        HorizontalAlign             = "NotSet"  
        CommandItemDisplay          = "None" 
        CurrentResetPageIndexAction = "SetPageIndexToFirst"
        DataKeyNames                = "dp_key, dp_prixs" 
        Name                        = "devis_prd"
        NoMasterRecordsText         = "Votre devis est vide !" 
        NoDetailRecordsText         = "Aucun produit sélectionné !"
        >
        <Columns>
            <telerik:GridBoundColumn
                DataField               = "dp_key" 
                HeaderText              = "Id " 
                SortExpression          = "dp_key" 
                UniqueName              = "dp_key"
                DataType                = "System.Int32" 
                ReadOnly                = "True" 
                Visible                 = "False"
                >
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn 
                DataField               = "dp_CodePrd" 
                UniqueName              = "dp_CodePrd"
                HeaderText              = "Code Produit"
                DataType                = "System.String"
                DataFormatString        = "{0:LLL-LL-000}"
                >
                <HeaderStyle HorizontalAlign="Center" /> 
                <ItemStyle   HorizontalAlign="Center" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn 
                DataField               = "dp_nombre" 
                SortExpression          = "dp_nombre" 
                UniqueName              = "dp_nombre"
                HeaderText              = "Nom du Produit"
                DataType                = "System.String" 
                >
                <HeaderStyle HorizontalAlign="Left" /> 
                <ItemStyle   HorizontalAlign="Left" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn 
                DataField               = "dp_convives" 
                SortExpression          = "dp_convives" 
                UniqueName              = "dp_convives"
                HeaderText              = "Convives"
                DataType                = "System.Int32" 
                >
                <HeaderStyle HorizontalAlign="Right" /> 
                <ItemStyle   CssClass="monto_grid" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn 
                DataField               = "dp_prixs" 
                SortExpression          = "dp_prixs" 
                UniqueName              = "dp_prixs"
                HeaderText              = "Prix de la Paella"
                DataType                = "System.Decimal" 
                DataFormatString        = "{0:C2}"
                >
                <HeaderStyle HorizontalAlign="Right" /> 
                <ItemStyle   CssClass="monto_grid" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn 
                DataField               = "dp_prixs_unitaire" 
                SortExpression          = "dp_prixs_unitaire" 
                UniqueName              = "dp_prixs_unitaire"
                HeaderText              = "Prix unitaire "
                HeaderStyle-Width       = "120"
                DataType                = "System.Decimal" 
                DataFormatString        = "{0:C2}"
                >
                <HeaderStyle HorizontalAlign="Right" /> 
                <ItemStyle   CssClass="monto_grid" />
            </telerik:GridBoundColumn>
            <telerik:GridButtonColumn 
                ConfirmText             = "Cette action permet de supprimer le produit sélectionné de votre devis. <br/><br/>Etes-vous sûr ? <br/><br/>" 
                ButtonType              = "ImageButton"
                CommandName             = "Delete" 
                Text                    = "Supprimer ce produit" 
                UniqueName              = "DeleteColumn" 
                ConfirmDialogType       = "RadWindow"
                >
                <HeaderStyle Width="20px" />
                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
            </telerik:GridButtonColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"></EditColumn>
        </EditFormSettings>
    </MasterTableView>
    <PagerStyle Mode="NextPrevAndNumeric" />
    <FilterMenu EnableTheming="True">
        <CollapseAnimation Duration="200" Type="OutQuint" />
    </FilterMenu>                        
</telerik:RadGrid>
So no problem here ...!

Then, I need to show the items found on the sessiondatasource and try the following(the code behind the .aspx is as below):
string query_str = "SELECT * FROM [devis] order by dp_key";
DataTable dt = GetDataTable(query_str);
RadGrid_devis_panel.DataSource = dt;
RadGrid_devis_panel.DataBind();
etapa_02.Alert("--> devis_rpt_PreRender : " + dt.Rows.Count);

I do not show any item (dt.Rows.Count = 0), as I can read data from the sessiondatasource?

Thanks in advance!
Jorge Saa-Gerbier

The code the  is as below: (the code behind the  is as below):
Iana Tsolova
Telerik team
 answered on 09 Feb 2011
3 answers
84 views
Hi there,

I stumbled across a little, I would not go as far as to call it a problem, issue. It seems the rotator behaves differently when setting either to Buttons or ButtonsOver mode. In Buttons mode the whole viewport is scrolled after clicking the left/right arrow. In ButtonsOver-mode only one item is advanced when clicking the right/left arrow.
Is it possible to achieve said behavior with the Buttons-Mode too? To clarify I would like the Buttons-Mode NOT wich Viewpoint but Item scrolling.

Thank you for your assistance.
Tsvetie
Telerik team
 answered on 09 Feb 2011
1 answer
86 views
Hi,

I am using webparts in the Rad Rotator. I have implemented a functionality by which the user when clicks in the title of the webpart will minimize/maximise the webpart and the underlying webparts will cover up the space as they are rendered as divs. This works fine if the webparts are placed outside the RadRotator. When I place the webparts in the RadRotator the minimize and maximize of the webparts happen but the space remains the same between the webparts. Any way to overcome this.
Tsvetie
Telerik team
 answered on 09 Feb 2011
1 answer
104 views
Hello,

When I'm trying to use OpenAccessDataSource as the datasource of the treeview, the treeview is using wrong table. 
I configured the datasource to use the Entitlement table. I attached it to treeview using the DatasourceId. It throws an exception about the Description field does not exist in the invoicelinesharing table.
<telerik:OpenAccessDataSource ID="EntitlementDS" runat="server" ObjectContextProvider="Xapt.AgilePoint.Data.SiteContextModel.SiteEntityDiagrams, Xapt.AgilePoint.Data.SiteContextModel"
    TypeName="Xapt.AgilePoint.Data.SiteContextModel.Entitlement" EnableDelete="False"
    EnableInsert="False" EnableUpdate="False">
</telerik:OpenAccessDataSource>
<telerik:RadTreeView runat="server" ID="tvEntitlement"  DataSourceID="EntitlementDS"
       DataFieldID="EntitlementId" DataFieldParentID="ParentId" DataTextField="Description">
</telerik:RadTreeView>


Yana
Telerik team
 answered on 09 Feb 2011
1 answer
70 views
I am getting following error with crash in loading the page when I switch from Week view to Day view in RadScheduler control. I would appreciate insight on the same please.
=========================

Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
=============================
I am doing this on click of custom links on my page. and event handler for the links as follows

==============================
CODE BEHIND ASPX.CS

 

protected

 

override void OnLoad(EventArgs e)
{
        
base.OnLoad(e);
        DayLink.ServerClick +=
new EventHandler(DayLink_ServerClick);
        WeekLink.ServerClick +=
new EventHandler(WeekLink_ServerClick);
        MonthLink.ServerClick +=
new EventHandler(MonthLink_ServerClick);
}

 

 

void MonthLink_ServerClick(object sender, EventArgs e)
{    
        SchedulerSelectedView =
SchedulerViewType.MonthView;
}

 

 

void WeekLink_ServerClick(object sender, EventArgs e)
{
        SchedulerSelectedView =
SchedulerViewType.WeekView;
}

 

 

void DayLink_ServerClick(object sender, EventArgs e)
{
        SchedulerSelectedView =
SchedulerViewType.DayView;
}

 

 

 

public SchedulerViewType SchedulerSelectedView
{
        
set { timeBlockRadSchedulerControl.SelectedView = value; }
        
get { return timeBlockRadSchedulerControl.SelectedView; }
}

 

 

==============================****************************************************************************
ASPX PAGE
==============================
<body style="background-color:Silver" >
    <
form runat="server">
        <
rad:RadScriptManager ID="scriptManager" runat="server" AsyncPostBackTimeout="5000">
            
<Scripts>
                
<asp:ScriptReference Path="../../../common/includes/JavaScript/AJAXClientEvents.js" />
            
</Scripts>
        
</rad:RadScriptManager>
        <div class="FloatRightDiv">
            
<a runat="server" href="#" id="DayLink">Day</a>
            
<a id="WeekLink" runat="server" >Week</a>
            
<a id="MonthLink" runat="server" >Month</a>
        
</div>
    
<rad:RadScheduler ID="timeBlockRadSchedulerControl" runat="server" Height="100" Width="100" SelectedView="MonthView" DataKeyField="PrimaryKey" DataSubjectField="DisplayName" DataStartField="StartDate" DataEndField="AppointmentEndDate" >
    <appointmenttemplate>
        
<div id="recurrenceDiv" runat="server">
            
<div class="rsAptTermsOfCourt">
                
<asp:Label ID="timeBlockNameLabel" runat="server" Text="TT"></asp:Label>
                
<asp:Label ID="appointmentTimeLabel" runat="server" Text="10:20 PM"></asp:Label>
                
<asp:Label ID="subjectapptLabel" runat="server" Text="Subject"></asp:Label>
            </div>
        </div>
    </appointmenttemplate>
</rad:RadScheduler>

</form>
</
body>
========================***************************************************************************************

 

Ashish
Top achievements
Rank 1
 answered on 09 Feb 2011
4 answers
103 views

 

<telerik:GridHyperLinkColumn DataNavigateUrlFields="EmployeeId,CertComplete" DataTextField="EmployeeId"

 

 

 

DataTextFormatString="Edit/Update" UniqueName="EmployeeCert" 

 

 

 

DataNavigateUrlFormatString="~/employee/employeesert.aspx?employeeId={0}&isCertComplete={1}"

 

 

 

HeaderText="Certificate" >

 

 

 

<HeaderStyle Width="10%"></HeaderStyle>

 

 

 

<ItemStyle VerticalAlign="Top" HorizontalAlign="Center" />

 

 

 

</telerik:GridHyperLinkColumn>

I want "Edit/update" to be unclickable or hidden when CertComplete is false?
Can i manage to do this from client side
 Can i set visible = '{1}' in the client side

If not how can i manage this for each row in the grid from server side.
Thanks

 

 

Zash
Top achievements
Rank 1
 answered on 09 Feb 2011
5 answers
182 views
Hi Guys,

I have the following scenario:

I have a radscheduler and a radgrid being refreshed whenever the date range is changed in the radscheduler. I am using the event Navigation completed in the radscheduler to update the data for the grid. I am using a rad window in the grid for edit/insert.
The RadAjaxManager configuration is as follows:
<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" ClientEvents-OnRequestStart="conditionaPostback">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="radScheduler">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="radScheduler" />
                        <telerik:AjaxUpdatedControl ControlID="gdvTasks" />
                       
                    </UpdatedControls>
                </telerik:AjaxSetting>
             
            </AjaxSettings>
        </telerik:RadAjaxManager>

The problem is that this way the radwindow is no more poping up when I click edit or insert in the grid.
If I remove the  <telerik:AjaxUpdatedControl ControlID="gdvTasks" /> line from the ajaxmanager then the radwindow pops up but the problem is that the grid is no more refreshed automatically so I need to click on the refresh button in the grid in order for the latest data to be displayed.
One more thing is that I am adding the radwindow from code behind when the user clicks the insert or edit link buttons in the grid.

Any Help is appreciated. Thank you in advance.
Iana Tsolova
Telerik team
 answered on 09 Feb 2011
0 answers
135 views
Please check this example...
Then RadPane with ID = "catalogsPane" has EnableViewState is false, when on postback (expand tree node) all nodes will be removed, event OnNodeExpand will not be fired.

full source code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="WebDesigner.WebForm3" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!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>
</head>
<body>
  <form id="form1" runat="server">
  <telerik:RadScriptManager ID="RadScriptManager" runat="server">
  </telerik:RadScriptManager>
  <telerik:RadAjaxManager ID="AjaxManager" runat="server" DefaultLoadingPanelID="AjaxLoadingPanel" EnableViewState="false">
  </telerik:RadAjaxManager>
  <telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel" Skin="Windows7" EnableViewState="false" runat="server">
  </telerik:RadAjaxLoadingPanel>
  <telerik:RadSplitter ID="viewSplitter" BorderStyle="None" PanesBorderSize="0" runat="server" Skin="Windows7">
    <telerik:RadPane runat="Server" ID="catalogsPane" Width="240px" MinWidth="100" EnableViewState="false">
      <telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="1" MultiPageID="RadMultiPage1">
        <Tabs>
          <telerik:RadTab runat="server" Text="Tree" Selected="True">
          </telerik:RadTab>
        </Tabs>
      </telerik:RadTabStrip>
      <telerik:RadMultiPage ID="RadMultiPage1" runat="server">
        <telerik:RadPageView ID="RadPageView1" Selected="true" runat="server">
          <div runat="server" id="container">
            <div>tree:</div>
            <telerik:RadTreeView runat="server" ID="treeControl2" OnNodeExpand="CatalogTree_ExpandNode" OnLoad="CatalogTree_Load" NodeClick="CatalogTree_NodeClick">
            </telerik:RadTreeView>
          </div>
        </telerik:RadPageView>
      </telerik:RadMultiPage>
    </telerik:RadPane>
  </telerik:RadSplitter>
  <div runat="server" id="Div1">
  </div>
  </form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Web.UI;
using Telerik.Web.UI;
 
namespace WebDesigner
{
    public partial class WebForm3 : Page
    {
        private readonly List<SiteDataItem> _siteData = new List<SiteDataItem>();
 
        protected override void OnInit(EventArgs e)
        {
            InitSiteData();
            container.Controls.Add(treeControl2);
        }
 
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            AjaxManager.AjaxSettings.AddAjaxSetting(treeControl2, treeControl2, AjaxLoadingPanel);
        }
 
        private static RadTreeNode CreateTreeNode(SiteDataItem item)
        {
            return new RadTreeNode
            {
                Text = item.Text,
                Value = item.ID.ToString(CultureInfo.InvariantCulture),
                ExpandMode = TreeNodeExpandMode.ServerSide
            };
        }
 
        private void LoadNodes(IRadTreeNodeContainer treeControl, IRadTreeNodeContainer root, int? parentIdent)
        {
            var controlNodes = root == null ? treeControl.Nodes : root.Nodes;
            foreach (var item in this._siteData)
            {
                if (parentIdent == item.ParentID)
                {
                    var nodeControl = CreateTreeNode(item);
                    controlNodes.Add(nodeControl);
                }
            }
        }
 
        protected void CatalogTree_NodeClick(object sender, RadTreeNodeEventArgs e)
        {
            throw new NotImplementedException();
        }
 
        protected void CatalogTree_Load(object sender, EventArgs e)
        {
            // make root nodes
            if (!Page.IsPostBack)
            {
                var treeControl = sender as RadTreeView;
                if (treeControl != null)
                {
                    LoadNodes(treeControl, null, null);
                }
            }
        }
 
        protected void CatalogTree_ExpandNode(object sender, RadTreeNodeEventArgs e)
        {
            if (e.Node.Nodes.Count == 0)
            {
                LoadNodes(sender as IRadTreeNodeContainer, e.Node, Int32.Parse(e.Node.Value));
            }
        }
 
        private void InitSiteData()
        {
            this._siteData.Add(new SiteDataItem(1, null, "Products"));
            this._siteData.Add(new SiteDataItem(2, 1, "RadControls for ASP.NET Ajax"));
            this._siteData.Add(new SiteDataItem(3, 1, "RadControls for Silverlight"));
            this._siteData.Add(new SiteDataItem(4, 2, "RadGrid"));
            this._siteData.Add(new SiteDataItem(5, 2, "RadScheduler"));
            this._siteData.Add(new SiteDataItem(6, 2, "RadEditor"));
            this._siteData.Add(new SiteDataItem(7, 3, "RadGrid"));
            this._siteData.Add(new SiteDataItem(8, 3, "RadMenu"));
            this._siteData.Add(new SiteDataItem(9, 3, "RadEditor"));
        }
    }
 
    #region Support
 
    internal class SiteDataItem
    {
        private string _text;
        private int _id;
        private int? _parentId;
 
        public string Text
        {
            get { return _text; }
            set { _text = value; }
        }
 
        public int ID
        {
            get { return _id; }
            set { _id = value; }
        }
 
        public int? ParentID
        {
            get { return _parentId; }
            set { _parentId = value; }
        }
         
        public SiteDataItem(int id, int? parentId, string text)
        {
            _id = id;
            _parentId = parentId;
            _text = text;
        }
    }
 
    #endregion
}
alex lexx
Top achievements
Rank 1
 asked on 09 Feb 2011
2 answers
138 views
When you right click on an item in the ListBox it works as expected.  But if you right click in the ListBox but not on an item it gives me the following error any ideas on how to correct this?

"Microsoft JScript runtime error: 'get_item()' is null or not an object"

 

function showContextMenu(sender, e) {

 

 

var RadList = $find("Listbox");

 

 

var RadListSelected = RadList.get_selectedItem();

 

 

var menu = $find("cm1");

 

 

var rawEvent = e.get_domEvent().rawEvent;

 

menu.show(rawEvent);

e.get_item().select();  < ERROR is called on this item because object is nothing

$telerik.cancelRawEvent(rawEvent);

}

Robert Canal
Top achievements
Rank 1
 answered on 09 Feb 2011
5 answers
174 views
I seem to have trouble using the recurrence editor to show an existing rule ready for editing.

For testing I am using:

 

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click

 

RecurrenceEditor2.RecurrenceRuleText = TextBox1.Text

TextBox2.Text =

"Done"

 

 

End Sub

 


to copy the text from TextBox1 which holds the rule produced by another RecurrenceEditor (RecurrenceEditor1).  I expect RecurrenceEditor2 to show the same settings as RecurrenceEditor1, but it just shows it's initial "empty" state.

Should I be doing anything else?

Thanks
John

Mallikharjun Mulagundla
Top achievements
Rank 1
 answered on 09 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?