Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
95 views
Our business is open Monday-Thursday 9:00am-5:00pm, Friday 9:00am-8:00pm, Saturday 8:00am-8:00pm and closed Sunday.

I see a start and end time for the scheduler, but is it possible to bind the start and end times to a dataset that has the days of the week with start and end times? This way, appointments can only be scheduled during our business hours, and not when we are closed.
Steve
Top achievements
Rank 1
 answered on 18 Nov 2013
11 answers
595 views
Greetings!

Can anyone suggest a method with which I can change a cell's BackColor when its value is edited? Using textchanged, keydown or some other event will do. The problem I have is that the grid is autogenerated and most of the column names are unknown. 

I set my cells to be editable in PreRender like so:
For Each item As GridItem In RadGridViewExcelGridTest.MasterTableView.Items
    If TypeOf item Is GridEditableItem Then
        Dim editableItem As GridEditableItem = CType(item, GridDataItem)
        editableItem.Edit = True
    End If
Next
 
RadGridViewExcelGridTest.Rebind()

And my edit mode is InPlace. I noticed the Batch edit mode has its own ClientSetting called "ClientEvents-OnBatchEditCellValueChanged", but for reasons my edit mode has to be InPlace.

The way it works now is that the grid loads as completely editable. A user can update multiple cells on multiple rows - so I'd like to provide a visual cue to let the user know which items have been edited (and have not yet been saved). I noticed on this demo a little triangle shows when you click out of a cell that was edited - and that would be fine. I just didn't see the mechanism that produces that result. My situation would also be slightly different, as my cells are always in edit mode (i.e., textbox vs label) - but the principle
would be the same. 

I tried doing this on my ItemCreated (excluding the known column names, that are either not visible or not editable):
If TypeOf e.Item Is GridEditableItem Then
    Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
    For Each column As GridColumn In item.OwnerTableView.RenderColumns
        If (column.UniqueName <> "Project" And column.UniqueName <> "DepartmentNumber" And column.UniqueName <> "ProjectNumber" And column.UniqueName <> "Alias") Then
            Dim EditBox As New TextBox()
            EditBox.Text = item(column).Text
            AddHandler EditBox.TextChanged, AddressOf EditBox_TextChanged
            EditBox.AutoPostBack = True
            item(column).Controls.Clear()
            item(column).Controls.Add(EditBox)
        End If
    Next
End If

But I then get an error message that the "Editor cannot be initialized for column: " followed by the first column that should be editable (and this error appears to get thrown on the Rebind() in my PreRender, for what it's worth).
Daniel
Telerik team
 answered on 18 Nov 2013
2 answers
107 views
Hi,

I am very new to all this... And I think what I want to accomplish is doable, but I cannot seem to get it working right.

I have a page with a searchbox at the top and a 3 pane splitter, the top on contains an asp:panel with a radlistview inside it, this is linked to sqldatasource1 which is a stored procedure.  The middle pane contains just a radgrid whose datasource is sqldatasource2, also a stored procedure. The bottom pane is another asp:panel with a radlistview who has sqldatasource3, another stored procedure.

Right now I have a radajaxmanager whose AJAXcontrol id is the searchbox.

When the searchbox fires, in VB.net codebehind it takes the text of the search box, places it in a hidden field and then the sqldatasources are all set to their stored procedure names (whose parameters reference the hidden field) and then does a databind() on each.

The three queries take vastly different amounts of time and what I want is for the radajax loadingpanel to disappear from each control as it has its data bound.  Right now they all cease at the same time and it takes the sum of the 3 loading times.

How can I do this?  I feel like it might involve splitting the binding to three separate functions in the codebehind, but when I've tried that, the ajax seems to stop at the first (quickest) one, and only that pane is loaded.

From a lot of searching, I've found that I cannot have them load in parallel, which is fine, but I'd like to not have to wait for all 3 to load to view the first.

I'd like the effect to be similar to this: 
http://demos.telerik.com/aspnet-ajax/splitter/examples/showcontentduringload/defaultcs.aspx

where it is clear that one loads before the other.

Let me know if I can provide anything more to help.

Thanks!!
Viktor Tachev
Telerik team
 answered on 18 Nov 2013
1 answer
370 views
Hi,

Sorry if the information is a little slim, but I have taken over managing an application and I'm not familiar with everything on it yet.

I am populating a grid with in a VB web application, and upon selecting a row of data a toolbarbutton becomes selectable to allow you to go to show more detail.

This works fine when running the application locally in visual studio, however once it is compiled and published onto a web server, I get a 'Error: Sys.WebForms.PageRequestManagerServerErrorException: Specified argument was out of the range of valid values.
Parameter name: ItemHierarchicalIndex' message when selecting a row of data in the grid.

This only happens in Internet Explorer, Chrome and Firefox seem to work ok.

Any ideas on where I need to look would be appreciated.

Thanks

Mark
Eyup
Telerik team
 answered on 18 Nov 2013
1 answer
125 views
Hello,
I am binding radgridview using client side binding. It works properly for sorting, paging, filtering. But, when I change pagesize of gridview (10 to 20 or 50) then it could not bind GridTemplateColumn for new arrived records.
Then I used the demo given on this link :
http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/programmatic/defaultcs.aspx
And added page size and changed columns as per my Database into gridview for binding, but I got same issue here also.
Here, one more issue occurs that when we assign horizontal align to Item-Style then it also doesn’t reflect after pagesize changing.
Eyup
Telerik team
 answered on 18 Nov 2013
1 answer
77 views
The text from a RadTextBox does not appear to get back to the server from an iOS 7 device unless the user clicks someplace else before clicking on the submit button.  Is this a known issue?  WI believe we are currently using 2012 Q3 SP2.  Has it been fixed since then?
Dimitar
Telerik team
 answered on 18 Nov 2013
0 answers
92 views
Nevermind... you can delete this topic. Stupid question. Need to test a working  solution before asking.
Sorry
Massimiliano
Top achievements
Rank 1
 asked on 18 Nov 2013
2 answers
84 views
Hi

Our company is in the process of upgrading our rad controls from a rather old version to the latest version. On of the controls that's upgraded is a custom control created which derives from the RadNumericTextBox.

In this control there are 2 overrides which are no longer relevant, namely:

  - InitScript
  - RenderHiddenElement

I can't seem to find any document on these, so I'm not sure where to move this code to in the upgraded version. Can anyone provide me with some insight in these? And, if possible, what the best way to re-implement them in the latest version would be?

Many thanks

Tim
Tim
Top achievements
Rank 1
 answered on 18 Nov 2013
2 answers
89 views
Subject says it all, I want to call a method that will write a log entry any time a user exports a RadGrid to Excel.  I am currently using the 

GridExporting event in the code behind of each ASPX page and it works fine. What I am looking to do is set up something more global, such that if any grid is ever exported, add the log entry. It may be more of a general .net overloading/inheritance question but figured I would start here.  

Nick
Top achievements
Rank 1
 answered on 18 Nov 2013
1 answer
141 views
I'm following the demo/example here and finding that several things aren't working for me.  Hopefully I'm just doing it wrong and my newbie errors can be quickly pointed out.

http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/edit-form-types/defaultcs.aspx

I want a modal popup for editing, using a UserControl, and to use the same control at the top of the page for adding new records.  I'm using VS2012, asp.net webforms 4.5, RadControls Q3 2013, and a very basic n-tier approach using EF in a separate assembly, for data access.

Here's my aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/ControlCenter/MasterAdmin.master" AutoEventWireup="true" CodeFile="ConfigSMTP.aspx.cs" Inherits="ControlCenter_ConfigSMTP" %>
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<%@ register src="~/Controls/EditConfigSMTP.ascx" tagprefix="My" tagname="EditConfigSMTP" %>
 
 
<asp:content ID="ConfigSMTPHead" ContentPlaceHolderID="head" Runat="Server">
</asp:content>
<asp:content ID="ConfigSMTPContent" ContentPlaceHolderID="BodyContent" Runat="Server">
    <table style="width:100%;">
        <tr>
            <td style="width:20%;">Edit SMTP Address List</td>
            <td style="width:80%;"> </td>
        </tr>
        <tr>
            <td colspan="2">
                <telerik:radajaxmanager id="ConfigSMTPAjaxManager" runat="server">
                    <ajaxsettings>
                        <telerik:ajaxsetting ajaxcontrolid="ConfigSMTPGrid">
                            <updatedcontrols>
                                <telerik:ajaxupdatedcontrol controlid="ConfigSMTPGrid" loadingpanelid="ConfigSMTPLoadingPanel" />
                            </updatedcontrols>
                        </telerik:ajaxsetting>
                    </ajaxsettings>
                </telerik:radajaxmanager>
            </td>
        </tr>
        <tr>
            <td colspan="2">Use the form below to configure the outgoing SMTP address for email.</td>
        </tr>
        <tr>
            <td colspan="2">
                <My:editconfigsmtp runat="server" id="EditConfigSMTP" />
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                <telerik:radajaxloadingpanel id="ConfigSMTPLoadingPanel" runat="server" skin="Default">
                </telerik:radajaxloadingpanel>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <!-- SEARCH RESULTS -->
                <telerik:radgrid
                    id="ConfigSMTPGrid"
                    runat="server"
                    allowsorting="True"
                    autogeneratecolumns="False"
                    cellpadding="5"
                    cellspacing="5"
                    datasourceid="ConfigSMTPDataSource"
                    gridlines="None"
                    width="100%"
                    onitemdatabound="ConfigSMTPGrid_ItemDataBound"
                    skin="Metro"
                    ondeletecommand="ConfigSMTPGrid_DeleteCommand"
                    oninsertcommand="ConfigSMTPGrid_InsertCommand"
                    onupdatecommand="ConfigSMTPGrid_UpdateCommand" onprerender="ConfigSMTPGrid_PreRender">
                    <mastertableview datakeynames="ID" datasourceid="ConfigSMTPDataSource">
                        <editformsettings>
                            <popupsettings width="700px" height="500px" modal="true" />
                        </editformsettings>
                        <columns>
                            <telerik:grideditcommandcolumn uniquename="ConfigSMTPEditCommandColumn" editimageurl="../Images/edit_icon.gif" cancelimageurl="../Images/close_delete.gif">
                            </telerik:grideditcommandcolumn>
                            <telerik:gridboundcolumn datafield="ID" datatype="System.Int32" filtercontrolalttext="Filter ID column" headertext="ID" readonly="True" sortexpression="ID" uniquename="ID" visible="False">
                            </telerik:gridboundcolumn>
                            <telerik:gridboundcolumn datafield="SMTPServer" filtercontrolalttext="Filter SMTPServer column" headertext="SMTP Server" sortexpression="SMTPServer" uniquename="SMTPServer">
                            </telerik:gridboundcolumn>
                            <telerik:gridboundcolumn datafield="Description" filtercontrolalttext="Filter Description column" headertext="Description" sortexpression="Description" uniquename="Description">
                            </telerik:gridboundcolumn>
                            <telerik:gridboundcolumn datafield="CreateDate" datatype="System.DateTime" filtercontrolalttext="Filter CreateDate column" headertext="Created" sortexpression="CreateDate" uniquename="CreateDate">
                            </telerik:gridboundcolumn>
                            <telerik:gridboundcolumn datafield="IsDefault" datatype="System.Byte" filtercontrolalttext="Filter IsDefault column" headertext="Default" sortexpression="IsDefault" uniquename="IsDefault">
                                <itemstyle horizontalalign="Center" />
                            </telerik:gridboundcolumn>
                        </columns>
                        <editformsettings usercontrolname="~/Controls/EditConfigSMTP.ascx" editformtype="WebUserControl">
                            <editcolumn uniquename="ConfigSMTPEditCommandColumn"></editcolumn>
                        </editformsettings>
                    </mastertableview>
                </telerik:radgrid>
                <asp:entitydatasource
                    id="ConfigSMTPDataSource"
                    runat="server"
                    connectionstring="name=MyEntities"
                    defaultcontainername="MyEntities"
                    enabledelete="True"
                    enableflattening="False"
                    enableinsert="True"
                    enableupdate="True"
                    entitysetname="ConfigSMTP"
                    entitytypefilter="ConfigSMTP">
                </asp:entitydatasource>
            </td>
        </tr>
    </table>
</asp:content>


...the code-behind:

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess.Model;
using DataAccess.Validation;
using Proxy.Data;
using Telerik.Web.UI;
 
public partial class ControlCenter_ConfigSMTP : System.Web.UI.Page
{
    private int _currentDefault;
    private readonly string _redirect = "ConfigSMTP.aspx";
 
    public int CurrentDefault
    {
        get { return _currentDefault; }
        set { _currentDefault = value; }
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
    }
 
    protected void ConfigSMTPGrid_PreRender(object sender, EventArgs e)
    {
    }
 
    protected void ConfigSMTPGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        //alternative to binding in aspx file
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            //UserControl control = e.Item.FindControl(GridEditFormItem.EditFormUserControlID) as UserControl;
            //GridDataItem parentItem = (e.Item as GridEditFormItem).ParentItem;
            //TextBox box = (TextBox)control.FindControl("TextBox1");
            //box.Text = parentItem["Country"].Text;
        }
    }
 
    protected void ConfigSMTPGrid_InsertCommand(object sender, GridCommandEventArgs e)
    {
        //get entity from grid
        GridEditableItem editedItem = e.Item as GridEditableItem;
        ConfigSMTP smtpEdit = editedItem.DataItem as ConfigSMTP;
 
        //get edit form control
        UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
 
    }
 
    protected void ConfigSMTPGrid_UpdateCommand(object sender, GridCommandEventArgs e)
    {
        //get entity from grid
        GridEditableItem editedItem = e.Item as GridEditableItem; //e.Item is ALWAYS NULL.
        ConfigSMTP smtpEdit = editedItem.DataItem as ConfigSMTP;
 
        //get edit form control
        UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
 
        //update values
        smtpEdit.SMTPServer = (userControl.FindControl("SMTPServer") as TextBox).Text;
        smtpEdit.Description = (userControl.FindControl("Description") as TextBox).Text;
        smtpEdit.IsDefault = Byte.Parse((userControl.FindControl("IsDefault") as TextBox).Text);
 
        //commit
        ConfigSMTPProxy px = new ConfigSMTPProxy();
        px.Save(smtpEdit);
    }
 
    protected void ConfigSMTPGrid_DeleteCommand(object sender, GridCommandEventArgs e)
    {
        //get entity from grid
        GridEditableItem editedItem = e.Item as GridEditableItem;
        ConfigSMTP smtpEdit = editedItem.DataItem as ConfigSMTP;
 
        //get edit form control
        UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
 
    }
}


...the UserControl:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="EditConfigSMTP.ascx.cs" Inherits="Controls_EditConfigSMTP" %>
<table style="width:100%;">
    <tr>
        <td colspan="2">
            <asp:validationsummary ID="ConfigSMTPValidationSummary" runat="server" cssclass="validation" ShowModelStateErrors="true" />
        </td>
    </tr>
    <!-- SEARCH FORM -->
    <tr>
        <td class="fieldLabel">SMTP Address<span class="required">*</span></td>
        <td>
            <asp:textbox id="SMTPServer" cssclass="input" clientidmode="Static" runat="server" width="400px" text='<%# DataBinder.Eval(Container, "DataItem.SMTPServer") %>'></asp:textbox>
        </td>
    </tr>
    <tr>
        <td class="fieldLabel">Description</td>
        <td>
            <asp:textbox id="Description" cssclass="input" clientidmode="Static" runat="server" textmode="MultiLine" columns="55" rows="5" text='<%# DataBinder.Eval(Container, "DataItem.Description") %>'>
            </asp:textbox>
        </td>
    </tr>
    <tr>
        <td> </td>
        <td>
            <asp:checkbox id="IsDefault" cssclass="input" text="Set As Default" runat="server" />
        </td>
    </tr>
    <tr>
        <td colspan="2"> </td>
    </tr>
    <tr>
        <td colspan="2" class="submit">
            <asp:Button ID="UpdateButton" Text="Update Record" runat="server" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'></asp:Button>
            <asp:Button ID="InsertButton" Text="Add Record" runat="server" CommandName="PerformInsert" Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>'></asp:Button>
              
            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
        </td>
    </tr>
</table>


...control code-behind:

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess.Model;
using DataAccess.Validation;
using Proxy.Data;
using Telerik.Web.UI;
 
public partial class Controls_EditConfigSMTP : System.Web.UI.UserControl
{
    private object _dataItem = null;
 
    public object DataItem
    {
        get { return this._dataItem; }
        set { this._dataItem = value; }
    }
     
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (this.DataItem != null)
            {
                ConfigSMTP entity = (ConfigSMTP)this.DataItem;
 
                if (entity.IsDefault == 1)
                    this.IsDefault.Checked = true;
            }
        }
    }
}

So, there are a few issues. 

Firstly, clicking "edit" in a row doesn't yield a modal popup, it's inline with the record.  I can live without that and it's the least of my problems, but it'd be nice to have since I was doing it that way prior to switching the project from stock to the RadControls.

The biggest issue is that while the Insert, Update, and Delete commands are firing, the GridEditableItem is always null.  Since I'm never able to access it, none of the commands actually work.  The only difference from the example is that I'm binding entities, not a DataTable...which I figured I could safely assume works the same?  The entities are "self-tracking" and the initial RadGrid binding is working as expected.  I'm able to bind, page, and sort in other RadGrids in the project which don't require editing.

Any ideas?  Thanks!
Angel Petrov
Telerik team
 answered on 18 Nov 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?