Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
141 views
I've been following the example here to allow a control in my CommandItemTemplate to export the grid to Excel.

http://www.telerik.com/community/code-library/aspnet-ajax/general/export-radgrid-content-to-excel-word-csv-pdf-with-ajax-enabled.aspx

When the page initially loads, the button works as expected and the performs the post-back which allows the data in the grid to be exported. However, if I were to press another button (not the export button) that DOES cause an Ajax response, then when I click the export button, the export button no longer causes a post-back. It's like it has reverted back to being ajaxified. 

This is in my RadGrid.ItemCreated event where I Register the Post Back on my export buttons

if (e.Item is GridCommandItem)
{
    ImageButton btnExport = (e.Item as GridCommandItem).FindControl("btnExport") as ImageButton;
    LinkButton btnExportLink = (e.Item as GridCommandItem).FindControl("btnExportLink") as LinkButton;
    RadScriptManager scriptManager = (RadScriptManager)Master.FindControl("RadScriptManager1");
    if (scriptManager != null)
    {
        scriptManager.RegisterPostBackControl(btnExport);
        scriptManager.RegisterPostBackControl(btnExportLink);
                        
    }
}

If I click a different button that causes an ajax request it breaks the exporting button. Code below that breaks the exporting.

void btnGo_Command(object sender, CommandEventArgs e)
{
    WeekNumber = Convert.ToInt32(ddlWeek.SelectedValue);
    Year = Convert.ToInt32(ddlYear.SelectedValue);
             
    SetWeekSelectWarningMessage(WeekNumber);
    SetMissingTotalsCount();
    SetPendingTotalsCount();
    grdTimecards.Rebind();
}
Kostadin
Telerik team
 answered on 06 Nov 2012
11 answers
796 views
Hello!
I have a RadGrid inside of RadWindow...
I need to select a Radgrid row in clientside...
How can I do that? 

I´m trying to get the radgrid like that: 
var masterTable = $find("<%=radgridID.ClientID%>").get_masterTableView();

but always getting null... 

Any help?


Bhavesh
Top achievements
Rank 2
 answered on 06 Nov 2012
1 answer
93 views
Hi,
Is there anyway to get the icons for the editor command buttons? Specifically, I am creating a custom version of the image manager and would like to use the icon that comes with the standard version but I can't find it in my files.
Thanks,
Matt


P.S. When I say that I am making a custom version, I just mean the button; I'm not customizing the image manager dialog.
Bozhidar
Telerik team
 answered on 06 Nov 2012
7 answers
326 views
Hi,

I am implementing RadTreeview Context menu. It working fine when user right click on it.. but I wanted to display the context menu when user leftclick on it..

Can you please provide some code related to displaying contextmenu when user leftclick on the RadTreeview..?
James
Top achievements
Rank 1
 answered on 06 Nov 2012
2 answers
689 views
Hi there, I have a radtreeview which has a context menu which works perfectly on right click. When a user right clicks on a node in the tree the context menu will appear with options such as "delete [course name]", "edit [course name]", and "add [course name]". Where [course name] is is where the name of the node they are clicking on will go which also works perfectly. My tree view is like this:

ALL COURSES [ROOT]
COURSE GROUP NAME
COURSE
COURSE

Each level on the tree has a slightly different context menu as some have more options than the others. So far I have managed to get a context menu to appear on left click, but all this does is make the biggest context menu appear no matter which node is clicked on and where the course name should be [course name] is displayed instead of the actual course name. But when I right click and then left click the context menu works fine but right click is needed before hand.

Here is part of my asp tree code:
<telerik:RadTreeView ID="UsersTreeView" runat="server" Height="100%" Width="400px"
                OnNodeEdit="UsersTreeView_NodeEdit" OnNodeExpand="UsersTreeView_NodeExpand"
                OnNodeCollapse="UsersTreeView_NodeCollapse" AllowNodeEditing="True" EnableDragAndDrop="True"
                OnContextMenuItemClick="TreeView_ContextMenuItemClick" OnClientContextMenuShowing="UsersTreeView_onClientContextMenuShowing"
                OnClientContextMenuItemClick="UsersTreeView_onClientContextMenuItemClicking"  OnClientNodeClicking="UsersTreeView_onNodeClicking" 
                MultipleSelect="True" OnNodeDrop="UsersTreeView_HandleDrop" >
                <ContextMenus>
                    <telerik:RadTreeViewContextMenu ID="UserGroupContextMenu" runat="server">

AND here is the JavaScript being used:
function UsersTreeView_onClientContextMenuShowing(sender, args) {
    sender.unselectAllNodes();
    var treeNode = args.get_node();
    treeNode.set_selected(true);
    //enable/disable menu items
    UsersTreeView_setMenuItemsState(args.get_menu().get_items(), treeNode);
}

function UsersTreeView_onClientContextMenuItemClicking(sender, args) {
    var menuItem = args.get_menuItem();
    var treeNode = args.get_node();
    menuItem.get_menu().hide();

    switch (menuItem.get_value()) {
        case "add":
        //case "addroot":
        case "edit":
        //case "user_viewcourses":
        case "user_assigncourses":
        case "group_assigncourses":
        case "group_assigncoursessub":
        //case "moveroot":
        case "delete":
            break;
    }
}

AND currently for left click I am using this:
    function UsersTreeView_onNodeClicking(sender, args) {
            var domEvent = args.get_domEvent();
            var menu = $find("<%= UserGroupContextMenu.ClientID %>");
            args.set_cancel(true);
            menu.show(domEvent);
        }

Now I do realize that with my left click code this is needed somewhere:
UsersTreeView_setMenuItemsState(args.get_menu().get_items(), treeNode);

Its used within the default right click code to decide the correct context menu needed but I've tried adding it to my left click code and just cant seem to get it working. I have searched like mad round the forums and Google but for my specific problem I have been unable to find an answer, for all I know it could be impossible to do? 

Thanks, James
James
Top achievements
Rank 1
 answered on 06 Nov 2012
5 answers
138 views
Hello,

I have a master page with an asp menu.  On a content page I have a RadListBox that is hiding part of the menu.  I've tried setting the position to relative and the z-index higher in a div surrounding the menu but nothing seems to make a difference.  This is in IE7.  Any suggestions?

Thanks,
Casey

Simon
Top achievements
Rank 1
 answered on 06 Nov 2012
5 answers
120 views
I'm getting problems showing appointment with a recursive rule.

This is the code of the scheduler from the aspx:

<telerik:RadScheduler ID="scheduler" runat="server" SelectedView="MonthView" DataKeyField="ID" DataStartField="Start"
     DataEndField="End" DataSubjectField="Subject"  OverflowBehavior="Expand">
</telerik:RadScheduler>


And this is the code that I used to insert the appointment:

DateTime startAppointment = new DateTime(2012, 10, 22, 0, 0, 0);
DateTime endAppointment = new DateTime(2012, 10, 22, 10, 0, 0);
TimeSpan startRecurrence = new TimeSpan(00, 00, 00);
TimeSpan endRecurrence = new TimeSpan(10, 00, 00);
 
Telerik.Web.UI.Appointment appointment = new Telerik.Web.UI.Appointment("1", startAppointment, endAppointment, "demo");
 
RecurrenceRange range = new RecurrenceRange();
range.Start = startAppointment;
range.EventDuration = endRecurrence - startRecurrence;
range.MaxOccurrences = Int32.MaxValue;
 
RecurrenceDay dias = RecurrenceDay.EveryDay;
WeeklyRecurrenceRule rrule = new WeeklyRecurrenceRule(1, dias, range);
appointment.RecurrenceRule = rrule.ToString();
scheduler.InsertAppointment(appointment);

If I insert the appointment and I check it at runtime the value of "rrule.Occurrences.Count()" it returns 3000 but the scheduler only shows 21. What's the problem? Why the scheduler doesn't show all the occurrences?

Best Regards
Plamen
Telerik team
 answered on 06 Nov 2012
1 answer
138 views
I would like to find a user control that I am using in my RadGrid Edittemplate, but I cannot.

I am able to find it in the ItemDataBound event, but I cannot find it at ItemCommand where I need to access a control within it.

This is how I access the usercontrol in ItemDataBound event:

 

 

Protected Sub rg_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs)

 

 

 

 If TypeOf (e.Item) Is GridEditFormItem And Not rg.MasterTableView.IsItemInserted Then

 

 

 

   Dim e_item As GridEditFormItem = CType(e.Item, GridEditFormItem)

 

 

 

   Dim uc As UserControl = CType(CType(e.Item, GridEditFormItem).FindControl("EditFormControl"), UserControl)

 

 

 

End If

 

 

 

End Sub

This works but does not in ItemCommand.

 

Andrey
Telerik team
 answered on 06 Nov 2012
1 answer
65 views
Hi,
I am trying to set the pagesize is code, the value I store in session for SEO paging but if I set the page size I can't navigate past page 1

Anyone have ideas on what I am doing wrong.   The Pager is inside a RadListView control

Pavlina
Telerik team
 answered on 06 Nov 2012
1 answer
405 views
Hi,

I've recently added functionality to one of my radgrids so that a Filter will be applied when the user presses Enter in the Filter text box. 
I have the CurrentFilterFunction set to "Contatins" on most columns and set the AutoPostbackOnFilter property to True.
I've also kept the Filter menu so that the user can choose another filter option.

One issue I've noticed is that if the user types in the the filter text box and then clicks on the menu to select another option, the default filter is immediately applied, which is a little annoying as then the grid has to apply the filter option chosen in the menu.

I've tried a few different ways to prevent this from happening without full success. One workaround was to set  the AutoPostbackOnFilter property to false and then set the FilterDelay to a high value. This works on all columns except datetime columns. 

<MasterTableView DataSourceID="ProjectsDS" ClientDataKeyNames="ID">
                <Columns>
                    <telerik:GridClientSelectColumn UniqueName="projectsSelect" Visible="false" />
                    <telerik:GridBoundColumn Visible="True" DataField="ID" UniqueName="ID" HeaderText="ID"
                        AutoPostBackOnFilter="False" CurrentFilterFunction="EqualTo" FilterDelay="60000" />
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Name" AutoPostBackOnFilter="False"
                        CurrentFilterFunction="Contains"  FilterDelay="60000" />
                    <telerik:GridBoundColumn DataField="CampaignName" HeaderText="Campaign" UniqueName="CampaignName">
                        <FilterTemplate>
                            <telerik:RadComboBox ID="FilterCombo" runat="server" AutoPostBack="false" AppendDataBoundItems="true"
                                DataSourceID="CampaignDS" DataTextField="Name" DataValueField="ID" OnClientSelectedIndexChanged="SelectedIndexChanged"
                                SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("CampaignID").CurrentFilterValue %>'>
                                <Items>
                                    <telerik:RadComboBoxItem Text="No filters." Value="" />
                                </Items>
                            </telerik:RadComboBox>
                            <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                                <script type="text/javascript">
                                    function SelectedIndexChanged(sender, args) {
 
                                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("CampaignID", args.get_item().get_value(), "EqualTo");
                                    }
                                    function clientItemClicking(sender, args) {
                                        if (args.get_item().get_value() === "NoFilter") {
                                            var target = args.get_targetElement();
                                            var filterBox = target.parentNode.getElementsByTagName("input")[0];
                                            filterBox.value = "";
                                        }
                                    }                                  
                                </script>
                            </telerik:RadScriptBlock>
                        </FilterTemplate>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CampaignID" HeaderText="CampaignID" UniqueName="CampaignID"
                        Display="false" />
                    <telerik:GridBoundColumn DataField="FrameworkName" HeaderText="Framework" UniqueName="FrameworkName"
                        AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" FilterDelay="60000"/>
                    <telerik:GridBoundColumn DataField="ProjectBaseName" HeaderText="Template" UniqueName="ProjectBaseName"
                        AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" FilterDelay="60000"/>
                    <telerik:GridBoundColumn DataField="StatusDisplayValue" HeaderText="Status" UniqueName="StatusDisplayValue"
                        AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" FilterDelay="60000"/>
                    <telerik:GridDateTimeColumn DataField="StartDate" HeaderText="Start Date" UniqueName="StartDate"
                        DataFormatString="{0:d}" AutoPostBackOnFilter="True" CurrentFilterFunction="EqualTo" FilterDelay="60000">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridDateTimeColumn DataField="EndDate" HeaderText="End Date" UniqueName="EndDate"
                        DataFormatString="{0:d}" AutoPostBackOnFilter="True" CurrentFilterFunction="EqualTo">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridBoundColumn DataField="ExternalID" HeaderText="External ID" UniqueName="ExternalID"
                        AutoPostBackOnFilter="False" CurrentFilterFunction="Contains" FilterDelay="60000"/>
                    <telerik:GridTemplateColumn DataField="IsArchived" HeaderText="Archived" UniqueName="IsArchived"
                        Visible="false" GroupByExpression="IsArchived Group By IsArchived">
                        <HeaderTemplate>
                            <asp:CheckBox ID="chkArchivedSelectAll" OnCheckedChanged="chkArchivedSelectAll_CheckedChanged"
                                AutoPostBack="true" runat="server" TextAlign="Right" Text=" Archived" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="IsArchived" Checked='<%# Bind("IsArchived") %>' runat="server" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>

Is there a way to cancel the default Filter when the user clicks on the menu but also allow the user to press enter to apply the filter? I have noticed that on all of the demos of this functionality on this site, the Filter menu is removed from columns that have AutoPostBackOnFilter set to True. Is there an issue with using both together?

Thanks.
Marin
Telerik team
 answered on 06 Nov 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
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
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?