Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
139 views
Hi all,

I have a default page which is ajax enabled. From here I open a report.aspx page which is loaded into a radwindow. The report.aspx page is just a grid with data. When I try and export this data I get the error:

"

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


"

I'm not sure why I'm getting this. Can someone please help me find the solution? Code below: Thanks!

Report.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="quick_transaction_popup.aspx.cs" Inherits="OnTime.OnTime_Reports.Visitors.quick_transaction_popup" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<!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">
    <div>
 
    <telerik:RadScriptManager ID="Report_ScriptManager" runat="server" />
 
            <h3>
                <asp:Literal ID="Literal_View1_Title" runat="server" Text="Transactions: Quick Report - "></asp:Literal>
            </h3>
 
                <asp:PlaceHolder ID="PlaceHolder_Report_SQL" runat="server">
                    <asp:SqlDataSource ID="SqlDataSource_Report" runat="server">
                    </asp:SqlDataSource>
                </asp:PlaceHolder>
 
            <telerik:RadGrid ID="RadGrid_Report" runat="server" AutoGenerateColumns="false"
            AllowMultiRowSelection="false" AllowAutomaticInserts="false"
            GridLines="None" CellPadding="0" AllowSorting="false" Skin="Outlook"
            ItemStyle-VerticalAlign="Top"
            OnExcelMLExportRowCreated="RadGrid_Report_ExcelMLExportRowCreated" Width="100%"
            >
 
                <ExportSettings HideStructureColumns="true" ExportOnlyData="true" FileName="Visitor_TQR" OpenInNewWindow="true"
                 IgnorePaging="true">
                    <Excel Format="ExcelML" />
                </ExportSettings>
 
                <MasterTableView Width="100%" CommandItemDisplay="Top" GridLines="None" AllowAutomaticInserts="false">
 
                <CommandItemSettings ShowAddNewRecordButton="false" ShowExportToWordButton="false" ShowExportToExcelButton="true"
                ShowExportToCsvButton="false" ShowRefreshButton="false"/>
                 
                    <Columns>
 
                         <telerik:GridBoundColumn UniqueName="Report_Logs_DateTime" DataField="Visitor_Logs_DateTime"
                         HeaderText="Time" HeaderStyle-Width="33%" Visible="true" ItemStyle-VerticalAlign="Top"/>
 
                         <telerik:GridBoundColumn UniqueName="Report_Transaction_Type" DataField="Function_Key_Description"
                         HeaderText="Transaction Type" HeaderStyle-Width="33%" Visible="true" ItemStyle-VerticalAlign="Top"/>
 
                         <telerik:GridBoundColumn UniqueName="Report_UserName" DataField="Visitor_UserName"
                         HeaderText="Visitor" HeaderStyle-Width="33%" Visible="true" ItemStyle-VerticalAlign="Top"/>
 
                    </Columns>
                </MasterTableView>
                <ClientSettings>
                    <Selecting AllowRowSelect="false" />
                </ClientSettings>
            </telerik:RadGrid>
 
 
     
    </div>
    </form>
</body>
</html>


Report.aspx.cs
protected void Page_Load(object sender, EventArgs e)
        {
            //Register Javascript for Export Buttons
            string script2 = "function onRequestStart(sender, args)" +
                "{" +
                    "if (args.get_eventTarget().indexOf(\"ExportToExcelButton\") >= 0 ||" +
                    "args.get_eventTarget().indexOf(\"ExportToWordButton\") >= 0 ||" +
                    "args.get_eventTarget().indexOf(\"ExportToCsvButton\") >= 0)" +
                "{" +
                    "args.set_enableAjax(false);" +
                "}" +
                "}";
 
            //I've tried commenting and UN-commenting this line with no luck!
            //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Report_RadGrid_Ajax_Disable", script2, true);
 
            Display_Report_RadGrid();
 
        }
 
        protected void Display_Report_RadGrid()
        {
 
            //Populate Rad Grid
            SqlDataSource_Report = new SQL_Data_Source().getSQLDataSource();
            SqlDataSource_Report.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
            SqlDataSource_Report.SelectCommand = SQL_Customer_Connection.Product_Name + "_rp_Visitor_TQR";
 
            SqlDataSource_Report.SelectParameters.Add("Param_Customer_ID_Ref", TypeCode.String, (string)Session["User_Belongs_To_Customer_Ref_ID"]);
            SqlDataSource_Report.SelectParameters.Add("Param_Company_ID_Ref", TypeCode.String, (string)Session["User_Belongs_To_Company_Ref_ID"]);
 
            SqlDataSource_Report.SelectParameters.Add("Param_Visitor_Auto_ID_Ref", TypeCode.Int32, "22");
            SqlDataSource_Report.SelectParameters.Add("Param_Transaction_Types", TypeCode.String, "0,1,2,3,4,5,6,7,8");
 
            SqlDataSource_Report.SelectParameters.Add("Param_Start_Date", TypeCode.DateTime, "2011-01-01");
            SqlDataSource_Report.SelectParameters.Add("Param_End_Date", TypeCode.DateTime, "2012-01-01");
 
            RadGrid_Report.DataSource = SqlDataSource_Report;
            RadGrid_Report.Rebind();
        }
 
 
        bool ExcelML_isConfigured = false;
 
        protected void RadGrid_Report_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e)
        {
            if (e.RowType == GridExportExcelMLRowType.DataRow)
            {
                //Add custom styles to the desired cells
                 
 
                if (!ExcelML_isConfigured)
                {
                    //Set Worksheet name
                    e.Worksheet.Name = "Visitor_TQR";
 
                    //Set Column widths
                    foreach (ColumnElement column in e.Worksheet.Table.Columns)
                    {
                        switch (e.Worksheet.Table.Columns.IndexOf(column))
                        {
                            case 1:
                                column.Width = Unit.Point(100);
                                break;
                            case 2:
                                column.Width = Unit.Point(150);
                                break;
                            case 3:
                                column.Width = Unit.Point(150);
                                break;
                        }
                    }
 
                    //Set Page options
                    PageSetupElement pageSetup = e.Worksheet.WorksheetOptions.PageSetup;
                    pageSetup.PageLayoutElement.IsCenteredVertical = true;
                    pageSetup.PageLayoutElement.IsCenteredHorizontal = true;
                    pageSetup.PageMarginsElement.Left = 0.5;
                    pageSetup.PageMarginsElement.Top = 0.5;
                    pageSetup.PageMarginsElement.Right = 0.5;
                    pageSetup.PageMarginsElement.Bottom = 0.5;
                    //pageSetup.PageLayoutElement.PageOrientation = PageOrientationType.Landscape;
 
                    //Freeze panes
                    e.Worksheet.WorksheetOptions.AllowFreezePanes = true;
                    e.Worksheet.WorksheetOptions.LeftColumnRightPaneNumber = 1;
                    e.Worksheet.WorksheetOptions.TopRowBottomPaneNumber = 1;
                    e.Worksheet.WorksheetOptions.SplitHorizontalOffset = 1;
                    e.Worksheet.WorksheetOptions.SplitVerticalOffest = 1;
 
                    e.Worksheet.WorksheetOptions.ActivePane = 2;
                    ExcelML_isConfigured = true;
                }
            }
        }
Marin Bratanov
Telerik team
 answered on 20 Jul 2011
4 answers
102 views
I've noticed that if you set PreventCollapse to true, that the control still shows the expand icon. I know you can hide it using CSS, which is what I've done, but I think it would make more sense to hide it when the control is set to not collapse because it's suggesting an action that cannot be performed.

Is there a reason for it not hiding the expand icon or did you guys overlook this issue?

Thanks.
Nikolay Tsenkov
Telerik team
 answered on 20 Jul 2011
1 answer
92 views
I have RadComboBox in my page, i want bind the database table with my RadComboBox .. But Here i don't want to bind it in page_Load, Which event i need to have for binding RadComboBox..

Please Suggest me..
Shinu
Top achievements
Rank 2
 answered on 20 Jul 2011
3 answers
141 views
Hi,

I am trying to 'move' a postback event from a RadListBox to a RadDockZone. My reasoning for this is that the user is drag-and-dropping an item onto the screen. The 'interesting' object is where the item is being dropped, not where it came from. As such, I am trying to stop the postback on the listbox and move it to the dockzone dropped upon.

function OnClientDropping(sender, eventArgs) {
    eventArgs.set_cancel(true);
    sender.clearSelection();
    var droppedID = eventArgs.get_htmlElement().id;
    var listBoxID = sender.get_id();
    var sourceItem = eventArgs.get_sourceItem();
    var sourceItemText = sourceItem.get_text();
    var sourceItemValue = sourceItem.get_value();
    $find(ajaxManagerID).ajaxRequestWithTarget(droppedID, "Test");
}

I cancel the dropping event from the radlistbox, and then attempting to move the request to the dockzone.

Now, I have overriden Page's RaisePostBackEvent to ensure that the event is indeed posting. It is, and it has the UniqueID of the dockZone. Nevertheless, I do not see the RaisePostBackEvent event firing on my RadDockZone (I have my own class of RadDockZone which implements IPostBackEventHandler). Any thoughts on why? I haven't wired up an event to it (could use a suggestion as to which is best), but was just trying to make sure it got there.

EDIT: So I've gone about this a different way. I'm still not entirely happy with my implementation, so I would love to hear Telerik's input, but here is what I've got:

Client-Side Javascript Necessary:

function OnClientDropping(sender, eventArgs) {
    eventArgs.set_cancel(true);
    sender.clearSelection();
    previousZone = null;
 
    var sourceItem = eventArgs.get_sourceItem();
    var droppedID = eventArgs.get_htmlElement().id;
 
    if (droppedID.indexOf("RadDockZone") != -1) {
        if ($find(droppedID).get_docks().length == 0) {
            dockZoneDroppedOnID = droppedID;
 
            var eventData = {};
            eventData["sourceItemText"] = sourceItem.get_text();
            eventData["sourceItemValue"] = sourceItem.get_value();
            eventData["listBoxID"] = sender.get_id();
 
            $find(ajaxManagerID).ajaxRequestWithTarget(droppedID, $.toJSON(eventData));
        }
    }
    else {
        dockZoneDroppedOnID = "";
    }
}
 
var dockZoneDroppedOnID = "";
//Handles drawing the LoadingPanels over the correct elements when callbacks are occurring.
var loadingPanel = "";
var pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
var postBackElement = "";
pageRequestManager.add_initializeRequest(initializeRequest);
pageRequestManager.add_endRequest(endRequest);
 
function initializeRequest(sender, eventArgs) {
    loadingPanel = $find(radAjaxLoadingPanel1ID);
    postBackElement = eventArgs.get_postBackElement().id;
    //When drag and dropping the 'interesting' control isn't where we're coming from but where we're going to.
    if (dockZoneDroppedOnID != "") {
        postBackElement = $find(dockZoneDroppedOnID).get_parent().get_id(); ;
        dockZoneDroppedOnID = "";
    }
    loadingPanel.show(postBackElement);
}
 
function endRequest(sender, eventArgs) {
    loadingPanel = $find(radAjaxLoadingPanel1ID);
    loadingPanel.hide(postBackElement);
}

Server-Side Code:

protected void Page_Load(object sender, EventArgs e)
{
    Logger.Info("Page Load");
    RegenerationManager.Instance.RegenerateDockContents();
 
    if (IsPostBack)
    {
        string eventTarget = Request.Params.Get("__EVENTTARGET");
 
        if (eventTarget.Contains("DockZone"))
        {
            CreationManager.ProcessDragAndDrop(eventTarget, Request.Params.Get("__EVENTARGUMENT"));
        }
    }
}

From here, I detect that an event was targeting my DockZone.

The structure of my controls is like so:

<cc1:CormantRadPane ID="RadPane1" Runat="server">
    <nStuff:StyledUpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional" CssClass="maxHeight" >
        <ContentTemplate>
            <cc1:CormantRadSplitter ID="RadSplitter1" runat="server" Visible="false"/>
            <cc1:CormantRadDockZone ID="RadDockZone1" runat="server" />
       </ContentTemplate>
    </nStuff:StyledUpdatePanel>
</cc1:CormantRadPane>

CreationManager handles the processing of the JSON I passed back, and adds a dock to the dockZone. Since I targeted the dockZone with the update, the UpdatePanel wrapping the dockZone refreshes the area and everything seems to work pretty well.

I'm not so keen on how I parse out the information. Would love a suggestion on how to do it better -- I thought I could do it by implementing IPostBackEventHandler in my class which inherits from RadDockZone, but I have been unsuccessful so far.

EDIT2: Mission....SUCCESSFUL!

To all who are trying to do this: (This is a lot more relevant if you're working underneath a master page)

RadControls expose the client-side method .get_id(). This method returns (at least for me!) the ClientID of the object. In creating my controls I do not set the ClientID, however, so it may act differently if you have.

It is structured something like this: "ctl00_MainContent_RadDock_GUIDHERE"

This is NOT the uniqueID of the control, but it is close. In order for the PostBackEvent of a WebControl to respond it needs to match the unique ID of the control.

I did so like this:

var splitterClientID = pane.get_splitter().get_id();
var indexOfID = splitterClientID.indexOf("RadSplitter");
var uniqueID = splitterClientID.substr(0, indexOfID).replace(/_/g, "$");
var splitterID = splitterClientID.substr(indexOfID);

USEFUL ID: uniqueID.concat(splitterID) -- this rebuilds our old string with underscores replaced
with cash symbols, but will NOT replace any undescores following the control ID declaration.
e.g. saying ctl00_MainContent_RadSplitter_ABC will transform into ctl00$MainContent$RadSplitter_ABC

After making this change I was able to successfully implement IPostBackEventHandler.

Telerik: It'd be sweet if you could expose a client-side method that returns the uniqueID of the control. It is really difficult to get a handle on this for DYNAMICALLY created controls. It is easier when all the controls are known -- you can just use "<%= MyControl.UniqueID %>" but this isn't an acceptable solution for all implementations..

Thanks,

Sean
Pero
Telerik team
 answered on 20 Jul 2011
1 answer
114 views

Hi ,
when i am using the RadTreeview i am facing the following error,

 

Sys.ArgumentException: Cannot deserialize. The data does not correspond to valid JSON.

Parameter name: data

 

The exception is thrown after all page events are executed properly and the Microsoft Ajax Library tries to deserialize the object. (

 

function JavaScriptSerializer$deserialize)

 

 

 

This bug has been found in the following browsers : Cassini, IE8, Firefox, Chrome, Safari, Opera.

 
could any one know the fix for this ? or  Could you please direct me to solve this issue ?
Iam using the telerik's version : Assembly Telerik.Web.UI.dll, v4.0.30319

 

 

 

 

Note: I am using this control in a  update panel

Thanks & Regards,
Srini
Nikolay Tsenkov
Telerik team
 answered on 20 Jul 2011
5 answers
139 views

I cannot retrieve the textbox.text from from Editformsettings of the Radgrid1. The string returns empty all the time. What is wrong with the code after researching seems that the way i am doing it is correct. Any suggestions will be appreciated.


CODEBEHIND:

Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand

 

 

If e.CommandName = "PerformInsert" Then

 

 

 

 

 

 

If (TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode) Then

 

 

 

 

 

 

Dim editItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)

 

 

Dim Mytab As TextBox = DirectCast(editItem.FindControl("tbTabName"), TextBox)

 

 

Dim LocalTab As New SWBC.Weblet.BO.Mortgage.MtgTabs

 

 

        With LocalTab

 

                .TabName = Mytab.Text

 

 

 

 

 

 

 

 

        End With

 

 

 

 

 

    MyTabsList.Add(LocalTab)

 

End If

 

 

 

 

 

 

End If

 

 

 



ASPX Page

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >

 

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="RadGrid1">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />

 

 

 

 

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

</AjaxSettings>

 

 

 

 

 

 

</telerik:RadAjaxManager>

 

 

 

 

 

 

 

 

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" >

 

 

</telerik:RadAjaxLoadingPanel>

 

 

 

 

 

 

 

<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="false" AutoGenerateColumns="true"

 

 

AllowPaging="true" AllowSorting="true" Skin="Vista" Width="50%" GridLines="Both"

 

 

PageSize="50" EnableViewState="true" OnInsertCommand="RadGrid1_InsertCommand" >

 

 

 

 

 

 

<ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true" >

 

 

 

 

 

 

<Csv RowDelimiter="Comma" />

 

 

</ExportSettings>

 

 

 

 

 

 

<ClientSettings AllowDragToGroup="True">

 

 

 

 

 

 

<Selecting AllowRowSelect="True" />

 

 

 

 

 

 

<Scrolling AllowScroll="True" UseStaticHeaders="true" />

 

 

</ClientSettings>

 

 

 

 

 

 

 

 

<MasterTableView AutoGenerateColumns="false" CommandItemDisplay="top" Height="100%" GridLines="Both"

 

 

 

 

 

 

EditMode="PopUp" DataKeyNames="Count" >

 

 

 

 

 

 

<RowIndicatorColumn>

 

 

 

 

 

 

<HeaderStyle Width="20px"/>

 

 

</RowIndicatorColumn>

 

 

 

 

 

 

<CommandItemSettings AddNewRecordText="Add Tab" />

 

 

<ExpandCollapseColumn>

 

 

 

 

 

 

<HeaderStyle Width="20px" />

 

 

</ExpandCollapseColumn>

 

 

 

 

 

 

 

<Columns>

 

 

 

 

 

 

 

<telerik:GridEditCommandColumn HeaderStyle-Width="20px" >

 

 

 

 

 

 

</telerik:GridEditCommandColumn>

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="Count" DataType="System.Int16" HeaderText="Item" ReadOnly="True" SortExpression="Item">

 

 

 

 

 

 

<ItemStyle Width="20px" HorizontalAlign="Center" />

 

 

 

 

 

 

<HeaderStyle Width="20px" HorizontalAlign="Center" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="TabName" DataType="system.string" HeaderText="TabName" ReadOnly="True" SortExpression="TabName">

 

 

 

 

 

 

<ItemStyle Width="120px" HorizontalAlign="Center" />

 

 

 

 

 

 

<HeaderStyle Width="120px" HorizontalAlign="Center" />

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="TabText" HeaderText="TabText" SortExpression="TabText" UniqueName="TabText">

 

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="column" HeaderStyle-Width="50px" ItemStyle-Width="50px">

 

 

 

 

 

 

</telerik:GridButtonColumn>

 

 

 

 

 

 

 

 

</Columns>

 

 

<EditFormSettings InsertCaption="Add New Tab" EditFormType="Template" >

 

 

 

 

 

 

<PopUpSettings Width="640" />

 

 

 

 

 

 

 

<FormTemplate >

 

 

<table id="Table1" cellspacing="1" cellpadding="10" border="0" width="660">

 

 

 

 

 

 

<tr>

 

 

 

 

 

 

<td ></td>

 

 

<td> <asp:HiddenField runat="server" ID="hdCount" Value='<%# Bind( "Count" ) %>' /></td>

 

 

 

 

 

 

</tr>

 

 

 

 

 

 

<tr>

 

 

 

 

 

 

 

<td >Tab Name:</td>

 

 

<td>

 

 

 

 

 

 

 

 

<asp:TextBox runat="server" ID="tbTabName" Text='<%# Bind( "TabName" ) %>'>

 

 

</asp:TextBox>

 

 

 

 

</td>

 

 

</tr>

 

 

 

 

 

 

<tr>

 

 

 

 

 

 

<td valign="top">Tab Text:</td>

 

 

 

<td>

 

 

 

 

 

 

<telerik:RadEditor runat="server" ID="txtBody" Width="525px" >

 

 

 

 

 

 

<Tools>

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=AjaxSpellCheck />

 

 

 

 

 

 

<telerik:EditorTool Name=findandreplace />

 

 

 

 

 

 

<telerik:EditorTool Name=SelectAll />

 

 

<telerik:EditorTool Name=copy />

 

 

 

 

 

 

<telerik:EditorTool Name=Cut Visible=true />

 

 

<telerik:EditorTool Name=paste/>

 

 

 

 

 

 

<telerik:EditorToolStrip Name="paste options" >

 

 

 

 

 

 

<telerik:EditorTool Name=pasteashtml />

 

 

 

 

 

 

<telerik:EditorTool Name=pastefromword />

 

 

 

 

 

 

<telerik:EditorTool Name=pastefromwordnofontsnosizes />

 

 

</telerik:EditorToolStrip>

 

 

<telerik:EditorTool Name=undo />

 

 

 

 

 

 

<telerik:EditorTool Name=redo />

 

 

</telerik:EditorToolGroup>

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=linkmanager />

 

 

<telerik:EditorTool Name=unlink />

 

 

</telerik:EditorToolGroup>

 

 

 

 

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=insertparagraph />

 

 

<telerik:EditorTool Name=inserthorizontalrule />

 

 

<telerik:EditorTool Name=insertdate />

 

 

<telerik:EditorTool Name=InsertTime />

 

 

</telerik:EditorToolGroup>

 

 

 

 

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=formatblock />

 

 

<telerik:EditorTool Name=fontname />

 

 

<telerik:EditorTool Name=fontsize />

 

 

</telerik:EditorToolGroup>

 

 

 

 

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=bold />

 

 

<telerik:EditorTool Name=italic />

 

 

<telerik:EditorTool Name=underline />

 

 

<telerik:EditorTool Name=strikethrough />

 

 

 

 

 

 

 

</telerik:EditorToolGroup>

 

 

 

 

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=justifyleft />

 

 

<telerik:EditorTool Name=justifycenter />

 

 

<telerik:EditorTool Name=justifyright />

 

 

<telerik:EditorTool Name=justifynone />

 

 

 

 

 

 

 

</telerik:EditorToolGroup>

 

 

 

 

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=indent />

 

 

<telerik:EditorTool Name=outdent />

 

 

</telerik:EditorToolGroup>

 

 

 

 

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=insertorderedlist />

 

 

<telerik:EditorTool Name=insertunorderedlist />

 

 

</telerik:EditorToolGroup>

 

 

 

 

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=toggletableborder />

 

 

</telerik:EditorToolGroup>

 

 

 

 

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=forecolor />

 

 

<telerik:EditorTool Name=backcolor />

 

 

<telerik:EditorTool Name=formatstripper />

 

 

</telerik:EditorToolGroup>

 

 

 

 

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=insertsymbol />

 

 

<telerik:EditorTool Name=inserttable />

 

 

 

</telerik:EditorToolGroup>

 

 

 

 

 

 

<telerik:EditorToolGroup >

 

 

 

 

 

 

<telerik:EditorTool Name=converttolower />

 

 

<telerik:EditorTool Name=converttoupper />

 

 

<telerik:EditorTool Name=zoom />

 

 

<telerik:EditorTool Name=ModuleManager />

 

 

<telerik:EditorTool Name=togglescreenmode />

 

 

</telerik:EditorToolGroup>

 

 

</Tools>

 

 

 

 

 

 

</telerik:RadEditor>

 

 

</td>

 

 

 

 

 

 

</tr>

 

 

 

 

 

 

 

</table>

 

 

<table width="623">

 

 

<tr>

 

 

 

 

 

 

<td align="right" colspan="2">

 

 

 

 

 

 

<asp:Button ID="Button1" Text='<%# Iif (TypeOf Container is GridEditFormInsertItem, "Insert", "Update") %>'

 

 

runat="server" CommandName='<%# Iif (TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>'>

 

 

 

 

 

 

</asp:Button>&nbsp;

 

 

 

 

 

 

<asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">

 

 

 

 

 

 

</asp:Button>

 

 

 

 

 

 

</td>

 

 

 

 

 

 

</tr>

 

 

 

 

 

 

</table>

 

 

 

 

 

 

 

 

 

 

 

 

</FormTemplate>

 

 

</EditFormSettings>

 

 

 

 

 

 

</MasterTableView>

 

 

 

 

 

 

</telerik:RadGrid>


 

 

 

 

Iana Tsolova
Telerik team
 answered on 20 Jul 2011
4 answers
113 views
Hello all,
I have a user control that is made this way.
There is a RadListView.
Each item in the list view contains a checkbox.
Each checkbox is added in the list ot the TargetControls of a TooltipManager.

When the user click on the checkbox the tooltip correctly show but the checkbox is not checked. I think is due to ajax not updating the checkbox.

There's a way to solve this?

Thanks,
Mattia
Mattia
Top achievements
Rank 1
 answered on 20 Jul 2011
1 answer
86 views
I have a RadGrid with nested tables and I have set the ShowHeader of the nested tables to false.

However, at the time of exporting, the headers are displayed.

How would that be possible to hide the nested table headers when exporting to Excel, Word and Pdf?

Many thanks,
Shinu
Top achievements
Rank 2
 answered on 20 Jul 2011
1 answer
97 views
Hi,

We are facing a performance issue (5 - 6 sec load time) with a Grid when we set HierarchyLoadMode="Client" and HierarchyDefaultExpanded="true". Can you please suggest ways to improve the performance ?

Regards,
Kalyan
Genti
Telerik team
 answered on 20 Jul 2011
3 answers
75 views
Hello,
I am using various filters in my RadGrid, including a Google-like filter, date filter, radcombobox dropdown filters, and custom radcombobox filters which include checkboxes so the users can select multiple values.  All of these filters work fine....independently.  The problem is that if I apply my customized filter, then attempt to apply any of the other filters (which use tableView.filter to fire the command), my custom filter values are completely overwritten.

Is there anyway to keep this from happening?
Here is a sample of my code:
Default.aspx 
  
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" 
        AllowPaging="True" AllowSorting="True" CellSpacing="0" GridLines="None" 
        Skin="WebBlue" AutoGenerateColumns="True" EnableLinqExpressions="false"
        OnPreRender="RadGrid1_PreRender" OnItemCommand="RadGrid1_ItemCommand"
        Height="620px" onneeddatasource="RadGrid1_NeedDataSource" PageSize="20" >
 <Columns>
<telerik:GridBoundColumn UniqueName="Date" DataField="Date" DataType="System.DateTime" 
                    FilterControlAltText="Filter Date column" HeaderText="Date" 
                    SortExpression="Date">
                    <FilterTemplate>
                        <telerik:RadDatePicker ID="RadDatePicker1" runat="server" ClientEvents-OnDateSelected="FromDateSelected" DbSelectedDate='<%# startDate %>'>
                        </telerik:RadDatePicker><br /><br />
                        <telerik:RadDatePicker ID="RadDatePicker2" runat="server" ClientEvents-OnDateSelected="ToDateSelected" DbSelectedDate='<%# endDate %>'>
                        </telerik:RadDatePicker>  
                        <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                             <script type="text/javascript">
                                 function FromDateSelected(sender, args) {
                                     var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                     var ToPicker = $find('<%# ((GridItem)Container).FindControl("RadDatePicker2").ClientID %>');
  
                                     var fromDate = FormatSelectedDate(sender);
                                     var toDate = FormatSelectedDate(ToPicker);
  
                                     tableView.filter("Date", fromDate + " " + toDate, "Between");
  
                                 }
                                 function ToDateSelected(sender, args) {
                                     var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                     var FromPicker = $find('<%# ((GridItem)Container).FindControl("RadDatePicker1").ClientID %>');
  
                                     var fromDate = FormatSelectedDate(FromPicker);
                                     var toDate = FormatSelectedDate(sender);
  
                                     tableView.filter("Date", fromDate + " " + toDate, "Between");
                                 }
                                 function FormatSelectedDate(picker) {
                                     var date = picker.get_selectedDate();
                                     var dateInput = picker.get_dateInput();
                                     var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat());
  
                                     return formattedDate;
                                 }
                             </script>
                            </telerik:RadScriptBlock>   
                    </FilterTemplate>                       
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="WinLoss" 
                    FilterControlAltText="Filter WinLoss column" HeaderText="WinLoss" 
                    SortExpression="WinLoss" UniqueName="WinLoss">
                    <FilterTemplate>
                        <telerik:RadComboBox ID="winloss_combo" runat="server" EmptyMessage="All" AppendDataBoundItems="true" AllowCustomText="true">  
                        <Items>
                        <telerik:RadComboBoxItem runat="server" Text="" Visible="false" />
                        <telerik:RadComboBoxItem runat="server" Text="Won" />
                        <telerik:RadComboBoxItem runat="server" Text="Loss" />
                        <telerik:RadComboBoxItem runat="server" Text="Awaiting Award" />
                        <telerik:RadComboBoxItem runat="server" Text="No Bid" />
                        <telerik:RadComboBoxItem runat="server" Text="Cancelled"/>
                        </Items>                              
                            <ItemTemplate>
                            <div onclick="StopPropagation(event)">
                                   <asp:CheckBox ID="chk1" runat="server" onclick="wlClick(this)" />
                                   <asp:Label runat="server" ID="lbl1" AssociatedControlID="chk1"><%# Container.Text%></asp:Label>
                            </div>                                
                            </ItemTemplate>
                            <FooterTemplate>
                            <hr />
                            <asp:Button runat="server" ID="wlBtn" Text="Submit" CommandName="WinLossFilter"/>                            </FooterTemplate>
                        </telerik:RadComboBox>
                          
                        <telerik:RadScriptBlock ID="winloss_scriptblock" runat="server">
                             <script type="text/javascript">
                                 function wlClick(chk) {
                                     var text = ""; 
                                     var values = "";
                                     var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                     var combo = $find('<%# ((GridItem)Container).FindControl("winloss_combo").ClientID %>');
                                     //get the collection of all items 
                                     var items = combo.get_items();
                                     //enumerate all items 
                                     for (var i = 0; i < items.get_count(); i++) {
                                         var item = items.getItem(i);
                                         var skipEmptyItem = i + 1;
                                         //get the checkbox element of the current item 
                                         var chk1 = $get(combo.get_id() + "_i" + skipEmptyItem + "_chk1");
                                         if (chk1.checked) {
                                             text += item.get_text() + ",";
                                             values += item.get_value() + ",";
                                         }
                                     }
                                     //remove the last comma from the string 
                                     text = removeLastComma(text);
                                     values = removeLastComma(values);
                                     if (text.length > 0) {
                                         //set the text of the combobox
                                         combo.set_text(text);
                                     }
                                     else {
                                         //all checkboxes are unchecked
                                         //so reset the controls 
                                         combo.set_text("");
                                     }
                                     document.getElementById("<%= wltext.ClientID %>").value = text;
                                 }
                               function removeLastComma(str) {
                                     return str.replace(/,$/, "");
                                 }
                                 function StopPropagation(e) {
                                     // Cancel bubbling. 
                                     e.cancelBubble = true;
                                     if (e.stopPropagation) {
                                         e.stopPropagation();
                                     }
                                 }
                                    </script>
                            </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridBoundColumn>
</Columns>
 </telerik:RadGrid>

Default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RadGrid1.DataBind();
            }
  
        }
 protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
  
            RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
  
        }
 protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
        }
 protected void RadGrid1_PreRender(object sender, System.EventArgs e)
        {
            foreach (GridFilteringItem item in RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem))
            {               
                //this maintains the appropriate checkboxes are checked and sets the value of the combo box
                RadComboBox combo = (RadComboBox)item.FindControl("winloss_combo");
                 
                foreach (RadComboBoxItem comboItem in combo.Items)
                {
                    if (wltext.Value.Contains(comboItem.Text.ToString()))
                    {
                        CheckBox chk = (CheckBox)comboItem.FindControl("chk1");
                        chk.Checked = true;
                    }
                    else
                    {
                        CheckBox chk = (CheckBox)comboItem.FindControl("chk1");
                        chk.Checked = false;
                    }
                }
                combo.Text = wltext.Value;
}
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
              
            //string filterexp = RadGrid1.MasterTableView.FilterExpression;
  
            if (e.CommandName == RadGrid.FilterCommandName)
            {
                Pair filterPair = (Pair)e.CommandArgument;
  
                switch (filterPair.Second.ToString())
                {
                    case "Date":
                        this.startDate = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("RadDatePicker1") as RadDatePicker).SelectedDate;
                        this.endDate = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("RadDatePicker2") as RadDatePicker).SelectedDate;
                        break;
                    default:
                        break;
                }
            }
            if (e.CommandName == "WinLossFilter")
            {
              string query = string.Empty;
            string endquery = string.Empty;
            string checkedText = string.Empty;
            if (wltext.Value != null)
                checkedText = wltext.Value;
  
            string str = "WinLoss," + checkedText;
            if (str.Split(',').Length > 2)
            {
                query = "(";
                endquery = ")";
            }
  
            query = query + "([WinLoss] = ";
            for (int i = 1; i < str.Split(',').Length; i++)
            {
                String value = str.Split(',')[i];
                int val = str.Split(',').Length;
query = query + "'" + value + "')";
                if (i < str.Split(',').Length - 1)
                {
                    query = query + " OR ([WinLoss] = ";
                }
            }
            query = query + endquery;
               RadGrid1.MasterTableView.FilterExpression = query ;
            RadGrid1.Rebind();
            }
           }

I am on a time-crunch so any assistance is appreicated!
Thanks,
Alicia
Vasil
Telerik team
 answered on 20 Jul 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?