Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
111 views
Hi there,

I am thinking about a way to extend the Document/Image managers in the Editor to allow a user to store actual metadata about each item somewhere. It is similar in a way to the concept of your custom content provider:
http://demos.telerik.com/aspnet-ajax/editor/examples/dbfilebrowsercontentprovider/defaultcs.aspx

But really I am more interested in reading additional data about a file into fields on the properties tab and then allowing a way for the user to save it. I'm thinking the easiest route might be to have an xml document somewhere that I can store this metadata per item in. Then I need to override the Dialogs and build in code that loads the info into extra fields on the properties tab.

Is there any existing framework I can tie into? Client-side or Server-side events? Or any existing examples of something similar to this?

Many thanks
Gavin
Phil
Top achievements
Rank 1
 answered on 07 Jun 2012
3 answers
108 views

Hi!

I've a radgrid with autogeneratecolumn=true, i'm using advenced databinding to bind the data.

when i change the page or apply filter/sorting the radgrid throws exception during the binding (eg column not found).

the problem occures when change the datasource and reloaded the page.

I tried to set enableviewstatecolumn=false but not works.

Can I help me?

Eyup
Telerik team
 answered on 07 Jun 2012
1 answer
36 views
So here's the scenario that I have:

I have a dashboard that has multiple radgrids in it.  These rad grids are one offs (in other words no update, delete, add).  I want to be able to let the users click on a row and redirect to a report page.  All of this works until I want to have each radgrid update every 5 seconds.  The calls are made from code behind. I thought about adding a ticker like the example here:

http://demos.telerik.com/aspnet-ajax/grid/examples/client/livedata/defaultcs.aspx

However this doesn't work because the data I am pulling is designed to work for an increasing number of rad grids so if the client decided they want to add another radgrid they can.  I use a lambda expression to parse the object from code behind.  Which isn't really possible to do from javascript and ajax (that I am aware of).  If I add the static classes this makes the display to brittle and will require maintenance more often than I wanted. 

So I decided to go with the update panel binding the ajaxmanager to the radgrid at instantiation of the radgrid.  Here's my current problem.  If I bind the update panel I need to assign an ID to reference the control.  If I pass in the control during instantiation then I have to create concrete NeedDataSource classes.  Is there any way to create n number of rad grids from code behind and then have the following abilities:

1.   Allow row clicked events
2.   update every interval

I keep getting i.get_postBackElement() is undefined. Here's a look at some of the code I have (that doesn't work):

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" />
    <fieldset id="Facility" class="dashboardFieldsetDisplay">
        <legend>Facility Data</legend>
        <asp:Panel ID="FacilityGrids" runat="server" CssClass="dashboardGrid"></asp:Panel>
    </fieldset>
    <fieldset id="Company" class="dashboardFieldsetDisplay">
        <legend>Company Data</legend>
        <asp:Panel ID="CompanyGrids" runat="server" CssClass="dashboardGrid"></asp:Panel>
    </fieldset>
    <fieldset id="Region" class="dashboardFieldsetDisplay">
        <legend>Region Data</legend>
        <asp:Panel ID="RegionGrids" runat="server" CssClass="dashboardGrid"></asp:Panel>
    </fieldset>
    <div class="clearBoth"></div>
    <div class="displayNone">
        <asp:Timer ID="Ticker" runat="server" OnTick="Ticker_Ticked"></asp:Timer>
    </div>
</asp:Content>

Code Behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PCSGroup.Freund;
using Telerik.Web.UI;
 
 
public partial class _default : Base
{
    private List<DateTime> dateRange = new List<DateTime>();
    private List<RegionalSales> allRegionalSales = new List<RegionalSales>();
    private List<FacilitySales> allFacilitySales = new List<FacilitySales>();
    private List<CompanySales> allCompanySales = new List<CompanySales>();
    private List<RadGrid> listOfGrids = new List<RadGrid>();
    private int dashboardWidth = 235;
 
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        int count = 0;
        while(count < 5)
        {
            dateRange.Add(DateTime.Now.Date.AddDays(count));
            count++;
        }
 
        foreach (DateTime day in dateRange)
        {
            //loops through the region sales object and creates a list of regionalsales if any exist for that date
            RegionalSales regionOrders = new RegionalSales(day);
            allRegionalSales.AddRange(regionOrders.SelectOrders());
 
            //loops through the facility sales object and creates a list of facilitysales if any exist for that date
            FacilitySales facilityOrders = new FacilitySales(day);
            allFacilitySales.AddRange(facilityOrders.SelectOrders());
 
            //loops through the company sales object and creates a list of companysales if any exist for that date
            CompanySales companyOrders = new CompanySales(day);
            allCompanySales.AddRange(companyOrders.SelectOrders());
        }
    }
 
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        Ticker.Interval = 3000;
        foreach (Region region in new Region().SelectAllRegionsNotDeleted())
        {
            Panel gridWrapper = new Panel();
            gridWrapper.Width = 250;
            gridWrapper.CssClass = "floatLeft";
            Literal regionHead = new Literal();
            regionHead.Text = String.Format("<h2>{0}</h2>", region.RegionName);
            gridWrapper.Controls.Add(regionHead);
            gridWrapper.Controls.Add(GetRegionChart(region.RegionID));
            RegionGrids.Controls.Add(gridWrapper);
        }
        foreach (Facility facility in new Facility().SelectAllFacilitiesNotDeleted())
        {
            Literal facilityHead = new Literal();
            facilityHead.Text = String.Format("<h2>{0}</h2>", facility.FacilityName);
            FacilityGrids.Controls.Add(facilityHead);
            FacilityGrids.Controls.Add(GetFacilityChart(facility.FacilityID));
        }
        foreach (Company company in new Company().SelectAllCompaniesNotDeleted().Where(i => i.CompanyID != 2).ToList())
        {
            Panel gridWrapper = new Panel();
            gridWrapper.Width = 250;
            gridWrapper.CssClass = "floatLeft";
            Literal companyHead = new Literal();
            companyHead.Text = String.Format("<h2>{0}</h2>", company.CompanyName);
            gridWrapper.Controls.Add(companyHead);
            gridWrapper.Controls.Add(GetCompanyChart(company.CompanyID));
            CompanyGrids.Controls.Add(gridWrapper);
        }
    }
 
    protected void Company3_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        RadGrid company = listOfGrids.FirstOrDefault(i => i.ID == "Company_3");
        company.DataSource = allCompanySales.Where(i => i.CompanyID == 3);
    }
 
    public void Ticker_Ticked(object sender, EventArgs e)
    {
        foreach (RadGrid grid in listOfGrids)
        {
            grid.Rebind();
        }
    }
 
    private RadGrid GetRegionChart(int ID)
    {
        string[] keys = { "RegionID", "DeliveryDate" };
        RadGrid thisView = new RadGrid();
        thisView.CssClass = "roundedCorners";
        thisView.Skin = Skin;
        thisView.Width = dashboardWidth;
        thisView.AutoGenerateColumns = false;
        thisView.GridLines = GridLines.None;
        thisView.MasterTableView.Width = Unit.Percentage(100);
        thisView.MasterTableView.NoMasterRecordsText = string.Empty;
        thisView.MasterTableView.ClientDataKeyNames = keys;
        thisView.ClientSettings.ClientEvents.OnRowClick = "RegionRowClick";
 
        thisView.DataSource = allRegionalSales.Where(i => i.RegionID == ID);
 
        GridBoundColumn boundColumn;
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "DeliveryDate";
        boundColumn.HeaderText = "Date";
        boundColumn.DataFormatString = "{0:MM/dd}";
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "NewCount";
        boundColumn.HeaderText = "New";
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "RenewedCount";
        boundColumn.HeaderText = "Renewed";
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "CancelledCount";
        boundColumn.HeaderText = "Cancelled";
 
        listOfGrids.Add(thisView);
        return thisView;
    }
 
    private RadGrid GetFacilityChart(int ID)
    {
        string[] keys = { "FacilityID", "DeliveryDate" };
        RadGrid thisView = new RadGrid();
        thisView.CssClass = "roundedCorners";
        thisView.Skin = Skin;
        thisView.Width = dashboardWidth;
        thisView.AutoGenerateColumns = false;
        thisView.GridLines = GridLines.None;
        thisView.ID = String.Format("FacilityID_{0}", ID);
        thisView.MasterTableView.Width = Unit.Percentage(100);
        thisView.MasterTableView.NoMasterRecordsText = string.Empty;
        thisView.MasterTableView.ClientDataKeyNames = keys;
        thisView.ClientSettings.ClientEvents.OnRowClick = "FacilityRowClick";
 
        thisView.DataSource = allFacilitySales.Where(i => i.FacilityID == ID);
 
        GridBoundColumn boundColumn;
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "DeliveryDate";
        boundColumn.HeaderText = "Date";
        boundColumn.DataFormatString = "{0:MM/dd}";
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "NewCount";
        boundColumn.HeaderText = "New";
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "RenewedCount";
        boundColumn.HeaderText = "Renewed";
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "CancelledCount";
        boundColumn.HeaderText = "Cancelled";
 
        listOfGrids.Add(thisView);
        return thisView;
    }
 
    private RadGrid GetCompanyChart(int ID)
    {
        string[] keys = { "CompanyID", "DeliveryDate" };
        RadGrid thisView = new RadGrid();
        thisView.CssClass = "roundedCorners";
        thisView.Skin = Skin;
        thisView.Width = dashboardWidth;
        thisView.AutoGenerateColumns = false;
        thisView.GridLines = GridLines.None;
        thisView.ID = String.Format("Company_{0}", ID);
        thisView.MasterTableView.Width = Unit.Percentage(100);
        thisView.MasterTableView.NoMasterRecordsText = string.Empty;
        thisView.MasterTableView.ClientDataKeyNames = keys;
        thisView.ClientSettings.ClientEvents.OnRowClick = "CompanyRowClick";
        /*
         !!!!              Here's the code that doesn't work                  !!!!
                      I am creating a reference to a method
                      that does makes my code very brittle.
       */
        if (ID == 3)
        {
            thisView.NeedDataSource += new GridNeedDataSourceEventHandler(Company3_NeedDataSource);
        }
 
        RadAjaxManager1.DefaultLoadingPanelID = "LoadingPanel1";
        RadAjaxManager1.AjaxSettings.AddAjaxSetting(Ticker, thisView, null);
 
        // End Broken Code
 
        thisView.DataSource = allCompanySales.Where(i => i.CompanyID == ID);
 
        GridBoundColumn boundColumn;
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "DeliveryDate";
        boundColumn.HeaderText = "Date";
        boundColumn.DataFormatString = "{0:MM/dd}";
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "NewCount";
        boundColumn.HeaderText = "New";
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "RenewedCount";
        boundColumn.HeaderText = "Renewed";
 
        boundColumn = new GridBoundColumn();
        thisView.MasterTableView.Columns.Add(boundColumn);
        boundColumn.DataField = "CancelledCount";
        boundColumn.HeaderText = "Cancelled";
 
        listOfGrids.Add(thisView);
        return thisView;
    }
}
Josh
Top achievements
Rank 1
 answered on 07 Jun 2012
0 answers
58 views

Hello, in our project we use RadFilter Control.

This is a code from aspx file.

<telerik:RadFilter runat="server" ID="VehicleGridRadFilter" ShowApplyButton="True"  FilterContainerID="VehiclesRadGrid" >
<FieldEditors>
                        <telerik:RadFilterNumericFieldEditor FieldName="EmployeeID" DataType="System.Int32" />
</telerik:RadFilterNumericFieldEditor>
</FieldEditors>
 
<telerik:RadGrid ID="VehiclesRadGrid" runat="server" AllowSorting="True" AutoGenerateColumns="False"
        BackColor="White" BorderColor="#c3c3c3" BorderStyle="Double" BorderWidth="1px"
        CaptionAlign="Bottom" CellPadding="3" Width="926px" GridLines="none" AllowPaging="true" PageSize="25" OnNeedDataSource="VehiclesRadGrid_NeedDataSource"
        OnItemCommand="VehiclesRadGrid_ItemCommand" IsFilterItemExpanded="false" OnItemDataBound="VehiclesRadGrid_ItemDataBound">
      <MasterTableView DataKeyNames="VehicleID">
            <Columns>
                <telerik:GridBoundColumn DataField="Year" HeaderText="<%$Resources:PageContent,Global_Year %>" SortExpression="Year" DataType="System.Int32"
                    UniqueName="YearColumn" AllowFiltering="True">
                    <ItemStyle HorizontalAlign="Center" Wrap="True" CssClass="cellStyleBoth" />
                </telerik:GridBoundColumn >
 
…..
             </Columns>
       </MasterTableView>
       <ItemStyle CssClass="GridAlt" Wrap="True" />
        <SelectedItemStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
        <PagerStyle CssClass="GridPage" AlwaysVisible="true" Position="TopAndBottom" />
        <HeaderStyle CssClass="GridTitle" />
        <EditItemStyle Wrap="False" />
        <AlternatingItemStyle CssClass="GridAlt1" />
 </telerik:RadGrid>

Year in our model is System.Int32 property.

1)      How we can set Min/Max values for Year Filter? Or Catch momen when user input wrong value in filter?

2)      1-st question received because if user set Filter value to 999999999999999999999, Filter controls set value to 70368744177664, but we receive error javascript console message on page with control ('Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: =0G5=85 1K;> =54>?CAB8<> <0;K< 8;8 =54>?CAB8<> 1>;LH8< 4;O Int32.' when calling method: [nsIDOMEventListener::handleEvent])

We try play with this control on http://demos.telerik.com/aspnet-ajax/filter/examples/customeditors/defaultcs.aspx but if we insert 9999999999999999999999999 to EmployeeID filter, page show http://demos.telerik.com/ErrorPageResources/error.aspx?aspxerrorpath=/aspnet-ajax/filter/examples/customeditors/defaultcs.aspx

Thank you.

Pavel
Top achievements
Rank 1
 asked on 07 Jun 2012
2 answers
116 views
Hi,

is it possible to get the drag-drop feature shown here http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultcs.aspx to work inside Sharepoint connected to a Sharepoint-list? I've looked through the examples you have with the RadGrid in Sharepoint but the drag-drop doesn't seem to be there.

Best regards
Henrik - Sweden
Henrik
Top achievements
Rank 1
 answered on 07 Jun 2012
1 answer
37 views

Hello

I'm using ASP.NET AJAX Q1 2012 version. When I put two RadAsyncUpload on one page, and try to set enabled property on false, i receive some JavaScript error. It's working when there is only one RadAsyncUpload control. 

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
  
        <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server">
        </telerik:RadAsyncUpload>
  
        <telerik:RadAsyncUpload ID="RadAsyncUpload2" runat="server">
        </telerik:RadAsyncUpload>

namespace test1
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RadAsyncUpload1.Enabled = false;
            RadAsyncUpload2.Enabled = false;
        }
    }
}

error

Plamen
Telerik team
 answered on 07 Jun 2012
3 answers
151 views
Can someone please explain when to use RadSkinManager and ASP.NET Themes - I've been reading the documentation and it's not clear which should be used, if not both simultaneously. Can I get a clear explanation of how RadSkinManager works with ASP.NET Themes? This would be very helpful.

Thank you in advance.
Derek
Top achievements
Rank 1
 answered on 07 Jun 2012
1 answer
78 views
Greetings,

Im developing an application that uses RadGrid with a custom user control. Within this control, Im using a 2nd grid to display notes for the selected record in the 1st grid. The 2nd grid is using the the OnNeedDataSource event. How can pass the record ID opened in the 1st grid to the 2nd grid in the user control?
Andrey
Telerik team
 answered on 07 Jun 2012
8 answers
134 views
I am on a team developing an app using mostly the RadGrid and RadComboBox.  We want to provide users with the ability to email pages in the site as an attachement. We of course don't expect or allow any interaction after the page is mailed, just want the html to render what was already displayed, similar to a screen print.   We have done this in the past by using a public image and style folder and adjusting the paths so that when they open the attachment, the code pulls in the images and styles from the public folder on the same site.  We also strip out javascript and anything that could throw an error or cause the display to change. I got pulled in on this project and am brand new to Teleriks controls but the question is can I do the same thing with a page containing these controls?  Upon doing a minimal proof of concept, I did not get very far with this.  Is it possible and if so, how?
whit
Top achievements
Rank 1
 answered on 07 Jun 2012
4 answers
82 views
Is there a way to cancel the postback from the OnClientNodeEdited event handler for the OnNodeEdit server event?  I need to be able to selectively cancel this postback in the client code, but I haven't found a way that works yet.

There is no set_cancel() in the arguments passed.  Setting cancelBubble and returnValue on the window.event don't work.  Calling node.endEdit() or _cancelEvent() both throw an error.

I even tried setting the node's _originalText and _originalTextHtml to its _text value to see if it would keep it from being detected as modified.

Any suggestions would be welcome.
Marbry
Top achievements
Rank 1
 answered on 07 Jun 2012
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?