Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
125 views
Hi,

I had this code to add some custom page size on RadGrid:

  protected void RadGridInvoiceList_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridPagerItem)
        {
            RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
            PageSizeCombo.Items.Clear();

            PageSizeCombo.Items.Add(new RadComboBoxItem("10", "10"));
            PageSizeCombo.Items.Add(new RadComboBoxItem("20", "20"));
            PageSizeCombo.Items.Add(new RadComboBoxItem("50", "50"));
            PageSizeCombo.Items.Add(new RadComboBoxItem("100", "100"));
            PageSizeCombo.Items.Add(new RadComboBoxItem("200", "200"));
            PageSizeCombo.Items.Add(new RadComboBoxItem("300", "300"));
            PageSizeCombo.Items.Add(new RadComboBoxItem("400", "400"));
            PageSizeCombo.Items.Add(new RadComboBoxItem("500", "500"));
            PageSizeCombo.Items.Add(new RadComboBoxItem("1000", "1000"));

            PageSizeCombo.Items.FindItemByValue(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;

            PageSizeCombo.DropDownWidth = Unit.Pixel(60);
            PageSizeCombo.AutoPostBack = true;
        }
}

.....

protected void RadGridInvoiceList_Load(object sender, EventArgs e)
    {
        GridItem[] pagers = this.RadGridInvoiceList.MasterTableView.GetItems(GridItemType.Pager);

        foreach (GridItem pager in pagers)
        {
            RadComboBox comboBox = (RadComboBox)pager.FindControl("PageSizeComboBox");

            comboBox.SelectedIndexChanged += delegate(object _source, RadComboBoxSelectedIndexChangedEventArgs _e)
            {
                RadGridInvoiceList.MasterTableView.PageSize = Convert.ToInt32(_e.Value);
                RadGridInvoiceList.Rebind();
            };
        }
    }

For some reason after upgrading to 2010. Q1 stop working. I've also try the latest Build Release but the behaviour is the same. Dows the ajax refresh but the pagesize remains the same.

Thanks
Eduardo Barbosa


Pavlina
Telerik team
 answered on 15 Apr 2010
4 answers
184 views
Any suggestion on how I would access all the rows in the radgrid, not just the rows on page #1? I tried:

RadGrid1.MasterTableView.Items.Count

This gives me 10 rows because that is how many are listed per page but I need to get at the datatable source. The user has a search form that generates the grid. After the grid I have a button to save the search results to another table. When they click the button though I can't access the datatable because it is generated in the RadGrid1_NeedDataSource method.

If I can't write the contents of the datatable to my sql table then I am just going to write it when the search happens regardless of whether the user wants to save it or not and then when they click save I'll set a flag on the table. Hope this makes some sense, any suggestions appreciated...



Radoslav
Telerik team
 answered on 15 Apr 2010
6 answers
1.5K+ views
I'm testing out Telerik in a vs2010/mvc2 application. I've created an mvc2 application from a blank template, then added telerik by using telerik_convert to...

I'm currently trying to add a RadEditor to one of my views. I've changed 2 lines in the root web.config file, but nothing in the views\web.config file.
Under httphandlers (aspx to axd):
            <add path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
Under handlers (aspx to axd):
            <add name="Telerik_Web_UI_DialogHandler_axd" path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode,runtimeVersionv2.0" />

My routing should be ok:
       public static void RegisterRoutes(RouteCollection routes)  
        {  
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");  
  
            routes.MapRoute(  
                "Default",                                              // Route name  
                "{controller}/{action}/{id}",                           // URL with parameters  
                new { controller = "Default", action = "Index", id = "" }  // Parameter defaults  
            );  
        }  


The code from the view:
            <div class="editor-label"
                <%= Html.LabelFor(model => model.Content) %> 
            </div> 
            <div class="editor-field"
                <form> 
                <
                  RadEditor1.Content = Model.Content; 
                %> 
                <telerik:RadScriptManager ID="RadScriptManager1" runat="server"/> 
                 <telerik:RadEditor runat="server" ID="RadEditor1" DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd"/> 
                <%= Html.ValidationMessageFor(model => model.Content) %> 
                </form> 
            </div> 


The editor shows, but firebug reports:  "Telerik is not defined" and nothing works within the editor.

edit: I have the entire project + db zip'ed upp if needed.
Hans Petter Evju
Top achievements
Rank 1
 answered on 15 Apr 2010
1 answer
582 views
Hi,

I am trying to include a jQuery UI library and am having trouble, I'm guessing, with the load sequence of the scripts.

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        <Scripts> 
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> 
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> 
        </Scripts> 
    </telerik:RadScriptManager> 
 
    <script type="text/javascript"
    window.$ = $telerik.$; 
    </script> 
 

the above is from my master page, this allows me to use basic jQuery scripts on my page, and is working fine.

However, when I try to add the following scripts to my page, I am getting javascript errors when the page loads.

    <script type="text/javascript" src="/scripts/JQueryUI/jquery.ui.core.js"></script> 
    <script type="text/javascript" src="/scripts/JQueryUI/jquery.ui.widget.js"></script> 
    <script type="text/javascript" src="/scripts/JQueryUI/jquery.ui.tabs.js"></script> 
 

The exact errors depend on how/where I add the scripts to the page, but are basically combinations of either 'Jquery is undefined' or '$ is undefined'.

I have tried adding the scripts to the master page's head, the custom control's RadCodeBlock, I have also tried adding them to the RadScriptManager's script block and straight onto the master page's body after the 'window.$ = $telerik.$;' script. Finally I have also tried adding it to the script manager register startup script in c# on the page load for the master page.

How/when should I add these scripts to the page to make them work?

The only solution I can currently think of is to (re)include the JQuery library to the master page's head tag and to completely give up on using the Telerik built in library. This is a last option as I presume this would require clients downloading the main library twice.

Cesare






Simon
Telerik team
 answered on 15 Apr 2010
1 answer
134 views
Sorry for the title but I hope I got your attention, and yes you have cheated :-)

With respect to this article - http://demos.telerik.com/aspnet-ajax/tabstrip/examples/applicationscenarios/loadondemand/defaultcs.aspx

I'm trying to do a similar thing, except my tabs have spaces in the names. Hence when I click on a tba the page errors in this code block because its passing back the tab name as previously set up, and its look for a page with the tab name ie with a space.

        Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As RadMultiPageEventArgs) Handles RadMultiPage1.PageViewCreated  
            Dim userControlName As String = e.PageView.ID & "VB.ascx"   PAGE ERRORS HERE
            Dim userControl As Control = Page.LoadControl(userControlName)  
            userControl.ID = e.PageView.ID & "_userControl"  
            e.PageView.Controls.Add(userControl)  
        End Sub 

I have tried setting the ID property but it looks like it Read Only. You have only got this code to work by using Single words for the tab names (hence the cheat) .

How can I achieve this.

Andy

Yana
Telerik team
 answered on 15 Apr 2010
5 answers
306 views

Dear all,

i am currently using Telerik control for my financial site.

During development of this site i am facing following problem:

  1. in the Rad Grid control i am using Rad Context menu.Now i want to know how can i open a RAD popup window,aginst a click on a particular item of context menu
  2. As well i want to track its ID against which a popup has been opened.

Thanks.
Denny.

Radoslav
Telerik team
 answered on 15 Apr 2010
2 answers
132 views
Hi everyone

Since the RadGrid doesn't automatically postback when a user selects multiple items from the RadGrid using the SHIFT key, you have to do it manually. I've implemented this behaviour by subscribing to the the RadGrid's client-side OnRowSelected event. All I do in the mentioned event handler is calling the RadAjaxManager's ajaxRequest method (also on the client) to trigger the postback:
function RowSelected(sender, args) { 
    var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>"); 
    ajaxManager.ajaxRequest('StrgShiftCombinationPressed'); 

Should be that simple, but I have the following issue: Everytime I select multiple items with the SHIFT key, one item (actually, the last one) doesn't show up as selected after the postback. For example, if I select 4 items with the SHIFT key, first all the selected items are selected, but after the postback (and after the loading panel disappears), only 3 elements are selected.

To see what's going on on the server-side, I added an event handler for the RadGrid's server-side OnSelectedIndexChanged event. In the event handler, the grid.SelectedItems collection counts also one element less than selected (e.g. 4 items are selected with the SHIFT key, but grid.SelectedItems.Count evaluates to only 3). Also, if I select only one row with the SHIFT key pressed, the RadAjaxManager's server-side OnAjaxRequest is fired, but not the RadGrid's OnSelectedIndexChanged event (I have to mention, that I added the following AjaxSetting to the RadAjaxManager: radAjaxManager.AjaxManager.AjaxSettings.AddAjaxSetting(((MyMaster)this.Master).ajaxManager,  radGrid) ). When I select 2 items with the SHIFT key pressed, the OnSelectedIndexChanged is fired!

This issue has been bothering me for quite a long time, and I would be very thankful if somebody could successfully point me where I'm doing something wrong.

Thanks in advance.

Greetings,
Mallory
Pavlina
Telerik team
 answered on 15 Apr 2010
1 answer
95 views

Hi,
I have a RADGRID with a DATABIND client-side.
The databind event is raised with a JS SETTIMEOUT function:
setTimeout('bindGrid()', 5000);

and in a bindGrid I have a regular call to my web service:
WS.GetDocumentsSelected(startIndex, pageSize, sortField, sortOrder, filtroT, filtroM, mozione, updateGrid, koMessage);

where filtroT, filtroM, mozione are a custom filter.
The return of WS is a below code

function updateGrid(result) {   
        var tableView = $find("<%=RadGrid1.ClientID %>").get_masterTableView();   
        tableView.set_dataSource(result);   
        tableView.dataBind();   
}  

It's work fine, but I have a problem with selected row:

If I selected the second row, e.g., and I execute a sort command, my row selected persist in the second row.
The same problem occours with paging-change and a filter changed.

I try to save my selected-row id in hidden-field and in data bound function set the selection manually with the follow code:

function RadGrid1_RowDataBound(sender, args) {  
        var dkvs = document.getElementById("<%=DataKeyValueSelected.ClientID%>");   
        if (dkvs && dkvs.value && (args.get_dataItem()["Id_doc"] == dkvs.value)) {   
           //args.get_dataItem().set_selected(true);   
           sender.get_masterTableView().get_dataItems()[parseInt(args.get_item()._itemIndexHierarchical)].set_selected(true);   
        } else {   
           //args.get_dataItem().set_selected(false);   
           sender.get_masterTableView().get_dataItems()[parseInt(args.get_item()._itemIndexHierarchical)].set_selected(false);   
        }  

 

after data bound the paging-change and a sort works fine, but if after row selected I remove my filter, I have all alternating item selected (after the selected row - see attached) .....

Maria Ilieva
Telerik team
 answered on 15 Apr 2010
11 answers
105 views
I have system has widgets (controls)
is the widget in the page and this widget has menu bar the image of the menu item in a wrong position

please check the image
Yana
Telerik team
 answered on 15 Apr 2010
4 answers
99 views
Hello,Telerik.
When I use Telerik gird,meet trouble below.
Scenerio is:
 I have a List page which provides all kinds of querying condition by textbox or combobox(dropdownlist).
After I filter some data,  I click one row I wanted  that open a radWindow which provides  function of  editing selected row.
after I close the opened window, I return the list page.
How can I keep the textbox or combobox(dropdownlist) status that I just typed or selected , and only refresh the grid.
sometimes, I met "Retry/Cancel" popup when I use "window.location.reload(true)" .now I update "window.location.reload(true)" to
"window.location.href=window.location.href", Only do this, cannot keep the previous state of textbox or combobox(dropdownlist)
How to solve it?
Thanks
Best Regards
Yavor
Telerik team
 answered on 15 Apr 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?