Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
1.4K+ views
Hello friends,

I am using 
GridClientSelectColumn to select the rows and want to access one of the columns data.
I tried the code below but i am getting error 

"Error Cannot convert type 'Telerik.Web.UI.GridItemCollection' to 'Telerik.Web.UI.GridDataItem'"  

protected
 void Button1_Click(object sender, EventArgs e)
{
    foreach(GridDataItem item in RadGrid1.SelectedItems)
   {
      GridDataItem item = (GridDataItem)RadGrid1.SelectedItems;
      String str=item["ColumnUniqueName"].Text;//access the value here
    }
}


Thanks
Sourabh
Top achievements
Rank 1
 answered on 19 Apr 2012
1 answer
124 views
Im using radgrid in a custom module in DNN Community Edition 06.01.04 which uses Teletik.Web.UI 2011.3.1115.35.
However I cant get radgrid's deletes, change page... commands to work.
Im using LinqDataSource
I get this error:

DotNetNuke.Services.Exceptions.PageLoadException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. ---> System.ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.     at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)     at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I have tried everything I could possibly find.
Please help me
Antonio
Top achievements
Rank 1
 answered on 19 Apr 2012
1 answer
150 views
I have a grid with a column that shows whether a file has been downloaded or not (via an image in a grid column)

When the user clicks the Checkout toolbar button, I call an .ashx file, which downloads the file to the user's desktop and updates the the database that the file's been checked out.  The issue I'm having is that when I try and refresh the grid by calling the grid.rebind method (on either the client or server side), not all the logic in the .ashx file gets executed (well, the database is updated, but the file isn't downloaded).

How can I refresh the grid on the client side after *successfully* calling the ashx method (where successfully means the file is downloaded *and* the database is updated)?

Here's the relevant code:

function CheckOut(){
 
    var isExternal = false;
    var rgGrid = $find("<%= rgAttachmentVersion.ClientID %>");
 
    if ( rgGrid._selectedIndexes[0] == null ) {
        rgGrid = $find("<%= rgExternalAttachment.ClientID %>");
        isExternal = true;
    }
 
    var selectedVersionId;
    if ( isExternal ) {
        selectedVersionId = rgGrid._clientKeyValues[rgGrid._selectedIndexes[0]].ID + "&isExternal=true";
    } else if ( rgGrid._selectedIndexes[0].indexOf(":") > 0 ) {
        selectedVersionId = rgGrid._clientKeyValues[rgGrid._selectedIndexes[0]].ID;
    } else {
        selectedVersionId = rgGrid.MasterTableView.getCellByColumnUniqueName(rgGrid.MasterTableView.get_dataItems()[rgGrid._selectedIndexes[0]], "OpenVersion").innerHTML;
    }
         
    var finalUrl = "~/VersionCheckoutHandler.ashx?id=" + selectedVersionId + "&callback=false" + "&rand=" + Math.random(); // add random number to make sure the browser does nto cache it
    var xhReq = new XMLHttpRequest();
    xhReq.open("GET",$Url.resolve(finalUrl),false);
    xhReq.send(null);
             
    if ( xhReq.responseText == "FILEDOWNLOADERROR" )
    {
        alert("An error has occurred. Please contact your system administrator.");
    }
    else if ( xhReq.responseText == "VERSIONALREADYCHECKEDOUT")
    {
        alert("This version is currently checked out.");
        refreshAttachmentList();
    }
    else if ( xhReq.responseText == "UNABLETOCHECKOUTREMOTEREPOSITORY")
    {
        alert("This version is unable to be checked out from the remote repository.");
    }
    else
    {
        triggerIsPostBack = true;
        window.location = $Url.resolve("~/VersionCheckoutHandler.ashx?id=" + selectedVersionId + "&callback=true");
        triggerIsPostBack = false;       
    }
}


I have a client-side call that rebinds the grid (below) successfully from other methods, but when I call that after calling the CheckOut function, the file isn't saved locally (even though the grid rebinds).

function refreshAttachmentList() {
    try{displayLogoffWarning = false;} catch(ex) {}
    try {
        $find("<%= rgAttachmentVersion.MasterTableView.ClientID %>").fireCommand('<%=RadGrid.RebindGridCommandName %>');
    } catch (ex) { }
    try {
        $find("<%= rgExternalAttachment.MasterTableView.ClientID %>").fireCommand('<%=RadGrid.RebindGridCommandName %>');
    } catch (ex) { }
 
}
Vasil
Telerik team
 answered on 19 Apr 2012
0 answers
80 views
Hi when i try to export all my appointments as an ical file the file comes back blank, below is my code does anyone have any ideas?
<%@ Control Language="C#" %>
<%@ Import namespace="System" %>
<%@ Import namespace="System.Collections.Generic" %>
<%@ Import namespace="System.Linq" %>
<%@ Import namespace="System.Web" %>
<%@ Import namespace="System.Web.UI" %>
<%@ Import namespace="System.Web.UI.WebControls" %>
<%@ Import namespace="Telerik.Sitefinity" %>
<%@ Import namespace="Telerik.Sitefinity.GenericContent.Model" %>
<%@ Import namespace="Telerik.Sitefinity.Modules.Events" %>
<%@ Import namespace="Telerik.Sitefinity.Events.Model" %>
<%@ Import namespace="Telerik.Sitefinity.Taxonomies" %>
<%@ Import namespace="Telerik.Sitefinity.Taxonomies.Model" %>
<%@ Import namespace="Telerik.Sitefinity.Model" %>
 
<script language="c#" runat="server">
 
protected void  Page_Load(object sender, EventArgs e)
{
    Scheduler1.ReadOnly = true;
    Scheduler1.Height = 680;
    Scheduler1.DataSource = GetSourceItems();
    Scheduler1.Width = 600;
    Scheduler1.FirstDayOfWeek = DayOfWeek.Monday;
    Scheduler1.OverflowBehavior = OverflowBehavior.Expand;
}
 
protected virtual IList<Event> GetSourceItems()
{
    var list = new List<Event>();
    list = App.WorkWith().Events().Where(c => c.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live).Get().ToList();
    return list;   
}
 
public void Scheduler1_AppointmentCreated(object sender, Telerik.Web.UI.AppointmentCreatedEventArgs e)
{
    var EManager = EventsManager.GetManager();
    var c = (HyperLink)e.Container.FindControl("eventDetailsLink");
    var data = EManager.GetEvent(new Guid(e.Appointment.ID.ToString()));
    c.Text = data.Title;
    c.NavigateUrl = "/what's-on" + data.Urls.Where(u => u.RedirectToDefault == false).SingleOrDefault().Url;
 
    var TestID = new Guid("5A5214E8-1186-4422-AC72-B62465F6C1DB");   
    var CraftID = new Guid("90B70923-CA5B-431A-8231-AB855E50C237");
    var SummerID = new Guid("AB021AF6-D57C-45F4-A1A2-771AF0DA2BC5");
 
    if (data.GetValue<IList<Guid>>("Category").Contains(TestID))
    {
        e.Appointment.BackColor = System.Drawing.Color.Yellow;
    }
 
    if (data.GetValue<IList<Guid>>("Category").Contains(CraftID))
    {
        e.Appointment.BackColor = System.Drawing.Color.Beige;
    }
 
    if (data.GetValue<IList<Guid>>("Category").Contains(SummerID))
    {
        e.Appointment.BackColor = System.Drawing.ColorTranslator.FromHtml("#ff00ff");
    }
 
}
 
private void schedLoad_AppointmentCanceling(object sender, Telerik.Web.UI.AppointmentCancelingEditEventArgs e)
{
    e.Cancel = true;
}
 
private void WriteCalendar(string data)
{
 
    HttpResponse response = Page.Response;
    response.Clear();
    response.Buffer = true;
    response.ContentType = "text/calendar";
    response.ContentEncoding = Encoding.UTF8;
    response.Charset = "utf-8";
    response.AddHeader("Content-Disposition", "attachment;filename=\"RadSchedulerExport.ics\"");
    response.Write(data);
    response.End();
}
 
protected void Button2_Click(object sender, ImageClickEventArgs e)
{   
    WriteCalendar(RadScheduler.ExportToICalendar(Scheduler1.Appointments));
}
 
</script>
 
<telerik:RadScheduler runat="server" ID="Scheduler1"
                        SelectedView="MonthView"
                        DataKeyField = "Id"
                        DataSubjectField = "Title"
                        DataStartField = "EventStart"
                        DataEndField = "EventEnd"
                        IsReadOnly="True"
                        OnAppointmentCreated="Scheduler1_AppointmentCreated">
    <AppointmentTemplate>
        <asp:HyperLink id="eventDetailsLink" runat="server" />
    </AppointmentTemplate>
</telerik:RadScheduler>
 
<asp:ImageButton ID="bttn1" runat="server" ImageUrl="Export.gif" AlternateText="Export to iCalendar" onclick="Button2_Click" />

Daniel
Top achievements
Rank 1
 asked on 19 Apr 2012
3 answers
66 views
When I try creating a "New Skin" the site is redirecting to: http://stylebuilder.telerik.com/ErrorPageResources/error.aspx?aspxerrorpath=/New.aspx.
Tan
Top achievements
Rank 1
 answered on 19 Apr 2012
1 answer
152 views

Hello,

I would like to assign the Floating Toolbar with a behavior similar to the PageTop mode: will open on the top of the page, floating (pinned) by default, but will allow unpin and user reposition as option.
I set the Toolbar Mode to "Floating" and added the following code in
OnClientLoad:

function OnClientLoad(editor, args) {

 

// Pin the Floating Toolbar

var wnd = editor.get_toolAdapter().get_window();

wnd.add_show(function () {wnd.togglePin();});

// Activate The Toolbar

editor.get_toolAdapter()._showToolbarHolder(true);

// Set Focus to the Editor

editor.setFocus()

// Move the Floating Toolbar to the Top

editor.get_toolAdapter().get_window().moveTo(0, 0);

}
 

However, it seems togglePin() function prevents the reposition of the Toolbar (Toolbar reposition works fine when togglePin() is commented out), can I integrate both functionalities?

Also (very different issue), is there a way to make the editor inherit all styles from the location it is opened (assuming div content area is used)? I know I can assign a class that includes all required styles but I would like the styles to be automatically inherited in the editor content area.

Thanks in advance!

Rumen
Telerik team
 answered on 19 Apr 2012
5 answers
597 views
How to make accept radcombobox input in Upper Case Letter
Ivan Zhekov
Telerik team
 answered on 19 Apr 2012
1 answer
65 views
Hello All,
       I am working this timezone ((UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi), but i am set the radscheduler time zone in eastern time (US & Canada) through radscheduler.timezoneoffset. i created one appointment with start date is 4/17/2012 12:00 AM and end date is 4/18/2012 12:00 AM. this is one day only, but in radscheduler it's showing two days in month view. could you tell me how to resolve this please.

Thanks.
Achutha Sundar
Genady Sergeev
Telerik team
 answered on 19 Apr 2012
1 answer
136 views
I am trying to Ajaxify RadGrid control and label in code behind. Here is my code. But it doesn't work. Could you please let me know what could be the problem. I am trying to refresh the Label control when RadGrid changed.

Thank you for any help.

                        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                            <AjaxSettings>
                                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                            </AjaxSettings>
                        </telerik:RadAjaxManager>
  
                        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
                            <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false">
                                <MasterTableView>
                                    <Columns>
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                        </telerik:RadAjaxPanel>
            <div id="div1" runat="server">
                <table id="table1" runat="server" >
                    <tr>
                        <td align="center">
                            <asp:Label ID="lblName" runat="server" Font-Bold="true"> </asp:Label>
                        </td>
                    </tr>
                </table>
            </div>
  
Code behind.
  
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                   RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadGrid1, lblName, null);
                }
            }
        }
Pavlina
Telerik team
 answered on 19 Apr 2012
2 answers
87 views
How can I disable the focus being set in a timeslot when clicked? It is mighty slow even on IE9, and I don't need it.
When having a few dozens appointment in the control, it could take several seconds for the control to set the focus with the style, then raise the OnClientTImeSlotClick event.

I just need the event OnClientTimeSlotClick to be raised, but with no change in the style of the time slot.
Changing the style itself, will not help, because still will be applied by the browser, I will like to remove the application of the style all together while leaving the raising of the event OnClientTimeSlotClick intact.
Plamen
Telerik team
 answered on 19 Apr 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?