Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
194 views
Hello,
I'm get stucked with the ajax application I'm developing... I've got a master table with a detail table, the detail table shows the groups a user is binded to and I've got a button for removing the user from group... the problem is that the DataBind in the page load suppresses the gvUtenti_ItemCommand...

Here're my ASPX :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GestioneUtenti.aspx.cs" 
    EnableEventValidation="true" Inherits="IFWebLight.Web.Management.Content.GestioneUtenti" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server" style="height: auto; width: auto"
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
    </telerik:RadScriptManager> 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /> 
    <telerik:RadAjaxManager runat="server" ID="radAjax" DefaultLoadingPanelID="RadAjaxLoadingPanel1"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="gvUtenti"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="gvUtenti" /> 
                    <telerik:AjaxUpdatedControl ControlID="gvGruppoUtenti" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="gvGruppoUtenti"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="gvGruppoUtenti" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <telerik:RadScriptBlock runat="server" ID="scriptBlock"
 
        <script type="text/javascript"
                <!-- 
            function onRowDropping(sender, args) { 
                if (sender.get_id() == "<%=gvUtenti.ClientID %>") { 
                    var node = args.get_destinationHtmlElement(); 
                    if (!isChildOf('<%=gvGruppoUtenti.ClientID %>', node) && !isChildOf('<%=gvUtenti.ClientID %>', node)) { 
                        args.set_cancel(true); 
                    } 
                } 
                else { 
                    var node = args.get_destinationHtmlElement(); 
                    if (!isChildOf('trashCan', node)) { 
                        args.set_cancel(true); 
                    } 
                    else { 
                        if (confirm("Are you sure you want to delete this order?")) 
                            args.set_destinationHtmlElement($get('trashCan')); 
                        else 
                            args.set_cancel(true); 
                    } 
                } 
            } 
 
            function isChildOf(parentId, element) { 
                while (element) { 
                    if (element.id && element.id.indexOf(parentId) > -1) { 
                        return true; 
                    } 
                    elementelement = element.parentNode; 
                } 
                return false; 
            } 
 
            function LoadUtentiGrid(sender) { 
                alert(sender); 
            } 
 
 
           
             --> 
        </script> 
 
    </telerik:RadScriptBlock> 
    <div> 
        <div style="width: 49%; float: left"
            <telerik:RadGrid ID="gvUtenti" runat="server" BackColor="LightSteelBlue" AllowFilteringByColumn="True" OnItemCommand="gvUtenti_ItemCommand" 
                AutoGenerateColumns="False" GridLines="None" ShowGroupPanel="True" AllowPaging="True" OnPageIndexChanged="RadGrid1_PageIndexChanged" 
                AllowMultiRowSelection="true" AllowSorting="True" OnRowDrop="gvUtenti_Drop" OnDetailTableDataBind="gvUtenti_DetailDataBind"
                <MasterTableView GroupLoadMode="Client" ClientDataKeyNames="Codice" > 
                    <ExpandCollapseColumn Visible="True"
                    </ExpandCollapseColumn> 
                    <Columns> 
                        <telerik:GridBoundColumn HeaderText="Codice" HeaderButtonType="TextButton" DataField="Codice"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn HeaderText="Descrizione" HeaderButtonType="TextButton" DataField="Descrizione"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn HeaderText="PWD" HeaderButtonType="TextButton" DataField="PWD"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn HeaderText="Filiale" HeaderButtonType="TextButton" DataField="Filiale"
                        </telerik:GridBoundColumn> 
                    </Columns> 
                    <DetailTables   > 
                        <telerik:GridTableView Name="gvGruppi" > 
                            <Columns> 
                                <telerik:GridBoundColumn HeaderText="Gruppo" HeaderButtonType="TextButton" DataField="DescrizioneGruppo"
                                </telerik:GridBoundColumn> 
                                      <telerik:GridButtonColumn ButtonType="PushButton" Text="prova" CommandName="CancellaGruppo" > 
                             
                            </telerik:GridButtonColumn> 
                            </Columns> 
                        </telerik:GridTableView> 
                    </DetailTables> 
                </MasterTableView> 
                 
                <ClientSettings AllowRowsDragDrop="true"
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" /> 
                    <ClientEvents OnRowDropping="onRowDropping" /> 
                </ClientSettings> 
            </telerik:RadGrid> 
        </div> 
        <div style="width: 50%; float: right"
            <div> 
                <asp:Label Text="Gruppi" runat="server"></asp:Label> 
                <telerik:RadComboBox ID="cbGruppi" runat="server" Width="250px" Height="150px" EmptyMessage="Selezionare un gruppo" 
                    EnableLoadOnDemand="true" ShowMoreResultsBox="false" AutoPostBack="true" EnableVirtualScrolling="false" 
                    OnSelectedIndexChanged="cbGruppi_IndexChanged"
                    <WebServiceSettings Method="GetGruppi" Path="../WS/IFManagement.svc" /> 
                </telerik:RadComboBox> 
            </div> 
            <div style="height: 400px"
                <telerik:RadGrid ID="gvGruppoUtenti"  runat="server" 
                    BackColor="LightSteelBlue" AutoGenerateColumns="False" ShowGroupPanel="True" 
                    AllowPaging="True" AllowMultiRowSelection="true" AllowSorting="True"
                    <MasterTableView>  <%--OnDeleteCommand="OnGridCancel"--%> 
                        <ExpandCollapseColumn Visible="True"
                        </ExpandCollapseColumn> 
                        <Columns> 
                            <telerik:GridBoundColumn HeaderText="Utente" DataField="User"
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn HeaderText="Descrizione" HeaderButtonType="TextButton" DataField="Descrizione"
                            </telerik:GridBoundColumn> 
                            <telerik:GridButtonColumn ButtonType="PushButton" Text="prova" CommandName="Delete" CommandArgument="A"
                             
                            </telerik:GridButtonColumn> 
 
                        </Columns> 
                    </MasterTableView> 
                    <ClientSettings AllowRowsDragDrop="true"
                        <%-- <DataBinding SelectMethod="GetDataAndCount" Location="../WS/IFManagement.svc" 
                        SortParameterType="Linq"  FilterParameterType="Linq"></DataBinding> 
                         <ClientEvents OnCommand="pLoad()" />--%> 
                    </ClientSettings> 
                </telerik:RadGrid> 
            </div> 
        </div> 
    </div> 
 
    <script language="javascript" type="text/javascript"
           <!-- 
        function pLoad() { 
 
            var dataSource = null
 
            var tableView = $find('gvGruppoUtenti').get_masterTableView(); 
 
            if (tableView.get_dataItems().length == 0) { 
                alert('ok'); 
                $find('gvGruppoUtenti').get_masterTableView().set_dataSource(dataSource); 
                $find('gvGruppoUtenti').get_masterTableView().dataBind(); 
            } 
            else { 
                alert('dati'); 
            } 
 
        }  
              
             --> 
    </script> 
 
    </form> 
</body> 
</html> 
 

and my .Cs (important parts) file

    private IFManagement clientManagement; 
        private List<UtenteGruppo> m_ListaUtenteGruppo; 
        private List<Utente> m_ListaUtente; 
        private int idxPage; 
 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            clientManagement = new IFManagement(); 
 
            if (IsPostBack) 
            { 
                if (Cache["lug"] != null) 
                { 
                    m_ListaUtenteGruppo = (List<UtenteGruppo>)Cache["lug"]; 
 
                    gvGruppoUtenti.DataSource = m_ListaUtenteGruppo
                    gvGruppoUtenti.DataBind(); 
                } 
                if (Cache["lu"] != null) 
                { 
                    m_ListaUtente = (List<Utente>)Cache["lu"]; 
 
                    gvUtenti.DataSource = m_ListaUtente
                    gvUtenti.DataBind(); //(*)
                } 
                
            } 
            else 
                LoadUtenti(); 
        } 
 
 
 private void LoadUtenti() 
        { 
            if (m_ListaUtente == null) 
            { 
                m_ListaUtente = clientManagement.GetListaUtenti(); 
                Cache["lu"] = m_ListaUtente; 
            } 
 
            gvUtenti.DataSource = m_ListaUtente
            gvUtenti.DataBind(); 
 
            Cache["a"] = gvUtenti; 
 
            gvGruppoUtenti.MasterTableView.EnableNoRecordsTemplate = true
            gvGruppoUtenti.MasterTableView.NoDetailRecordsText = "vuoto"
 
        } 
 
 
 protected void gvUtenti_DetailDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e) 
        { 
            GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem; 
            Utente u = dataItem.DataItem as Utente; 
 
            if (null != u) 
            { 
                e.DetailTableView.DataSource = u.GruppiAppartenenza; 
            } 
            else 
                e.DetailTableView.DataSource = null
        } 
 
 
 protected void gvUtenti_ItemCommand(object source, GridCommandEventArgs e) 
        { 
            if (e.CommandName == "CancellaGruppo") 
            { 
                int iRewardID = 0
 
            } 
 
        } 

If I do the (*) in pageload the gvUtenti_ItemCommand will be suppressed... what am I doing wrong? I was so happy of having moved to SL and not having to do anymore with postbacks...but past returns!
Thanks

Paolo


Tsvetoslav
Telerik team
 answered on 03 Mar 2010
7 answers
193 views
Hi,

I have four radgrids on the same page and each of these have a "GridClientSelectColumn". In order to persist the selected rows in the grid on sorting/paging/filtering/grouping, i refered to the approach given at the following link-
http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-client-sorting-paging-grouping-filtering.html

This seems to work fine for a single grid but as I have 4 grids so whenever i select any of the items (say the one with the row index 1) in any one of these 4 grids and perform sorting, filtering etc on that grid itself, in the remaining 3 grids also the items with the same index (in this case, those with the rowindex 1) become selected.
Please suggest what changes i need to make to the approach given at the above mentioned link to fix this.
Please reply soon as i need to fix this ASAP.

Thanks In Advance,
Abhishek Chauhan
Abhishek Chauhan
Top achievements
Rank 1
 answered on 03 Mar 2010
4 answers
164 views
Hi,  I have a main rotator in a content page that rotates 5 banner images.   Then on the master page I have a 2nd rotator which displays products that match the main rotator.    I databind each rotator separately but from the same datasource and they either start off out of sync or after a while they get out of sync.

The ScrollDuration and the FrameDuration are set the same.

Are there any examples on how I can sync the 2nd rotator in the master page to the one in the content page,  like when the frame changes on the main rotator it changes the frame on the 2nd?

Thanks for any help
-Keith
Fiko
Telerik team
 answered on 03 Mar 2010
5 answers
189 views
Hello,

There is something wrong with the positioning of the "Right Scroll" button in the Safari on Windows. You can see it on your sample projects here - http://demos.telerik.com/aspnet-ajax/rotator/examples/default/defaultcs.aspx - it is being positioned within content area. You can also checked attached screenshot.

Please let me know how this can be fixed.

Thank you,
Andrei
Fiko
Telerik team
 answered on 03 Mar 2010
3 answers
238 views
Hi, in the documantion I read I can use multiple RadEditors on my page. I want to show only one toolbar at the time and it should show at the top op the editors.Not of the page.There is an option PageTop, this option shows the toolbar at the top of the page. The problem is, I designed my page using a masterpage and the RadSplitters. So I have a PageTop secion, content section and PageFooter.

Is it possible to configure the editor to show only on toolbar, but this toolbar should show at the top of the content section, not of the page, because then it wil overwrite the menu of my page.


Rumen
Telerik team
 answered on 03 Mar 2010
4 answers
403 views
Hello,

      I create a RadGrid programmaticly and define the bound fields, one of which is a GridHyperLinkColumn  below:
GridHyperLinkColumn siteLink = new GridHyperLinkColumn(); 
string[] siteLinkUrlFields = new String[1]; 
siteLinkUrlFields[0] = "SiteURL"; 
siteLink.DataNavigateUrlFields = siteLinkUrlFields
siteLink.DataTextField = "Title"
siteLink.HeaderText = "Site Name"
siteLink.UniqueName = "SiteName"
siteLink.SortExpression = "Title"
siteLink.Target = "_blank"
grid.MasterTableView.Columns.Add(siteLink); 
       Now I'm gonna double click on a row that a new window will show up based on the hyperlink's target site. I have already set grid.ClientSettings.ClientEvents.OnRowDblClick = "RowDblClick";

       How to accomplish the client script to get the navigatorUrl of the hyperlink and redirect. Hence, another approach is provided to users if they don't want to click on the hyperlink.

       I think the client script should be like this:

       function RowDblClick(sender, eventArgs)
       {
              var dataItem = eventArgs.get_dataItem();
              ........................................
              ........................................
              window.open();
       }

Any suggestion is appreciated.
TIA
BR
Brett
Top achievements
Rank 2
 answered on 03 Mar 2010
1 answer
180 views
Hi,
I'm developing my page using RadGrid with the layout as shown in this ListView/DataListView example. Additionally, I'd like to add my custom control (an aggregate of several RadTextBox, RadListBox, and RadDate as well as Button, which will add a new row to my grid on clicked) as a footer item of my RadGrid, declaratively. How do I do that?

Thanks!
Vien
Vien
Top achievements
Rank 1
 answered on 03 Mar 2010
3 answers
151 views
I see mention of this functionality in places, however i can not seem to get it to work correctly.

I want the sliding pane to automatically scroll up or down when drag-dropping tree nodes.

I've tried various comboniations of persistscrollproperties and scrolling on the slidingpane, obviously with various incorrect assumptions. What could i be missing?

Thanks for your help.


 

 

<telerik:RadSlidingPane ID="TreePane" Title="Workflow" runat="server" Width="300px"  DockOnOpen="True" BorderWidth="3px" BorderStyle="Solid" EnableEmbeddedBaseStylesheet="False"  Height="100%">  
<telerik:RadTreeView ID="rtvRadTreeView1" runat="server" EnableDragAndDrop="True" EnableDragAndDropBetweenNodes="True"   OnClientContextMenuItemClicking="ClientNodeClicking" OnClientNodeClicking="ClientNodeClicking" clientNodeCollapsed="ClientNodeCollapsed" OnClientNodeExpanded="ClientNodeExpanded"  OnClientNodeClicked="OnClientNodeClicked_ClientNodeClicked" OnClientContextMenuItemClicked="rtvRadTreeView1_OnClientContextMenuItemClicked" PersistLoadOnDemandNodes="False" ShowLineImages="False" DataSourceID="dsTree"  DataFieldParentID="ParentID" DataFieldID="pk" DataValueField="pk" DataTextField="Title"  OnClientLoad="rtvRadTreeView1_OnClientLoad" >

 

 

 

 

 

 

 

 

 

 

 

 

 

Yana
Telerik team
 answered on 03 Mar 2010
2 answers
168 views
Hi,

I am using the GridSettingsPersister with AutoLoad of the contents.
I want grid settings to work this way for the user.

1. 1rst time: The user's default settings are loaded.
2. If the user has changed his settings (from his defaults), leaves the page and returns, his last settings should be in effect
3. The user can always save or load his settings for the grid.

Having tried all(?) the server site grid events ( "ColumnCreated" looks like the one to use - rewrote the GridSettingsPersister to get values pr. column HeaderText for this), I cannot get the column order to take effect - column width is set ok but the order setting only take effect when I explicitly Ajax load the saved settings and then the order only takes effect after I make another  Ajax call that changes the contents of the grid. For 1. and 2. above , Ajax is not used (intial load of the page)  but the order never takes effect.
The Debugger shows the right order values being set - the correct order is just not shown on the screen.

Is this there a way around this or is this intrinsinct to the design when using autoload?

(If you read the original GridSettingPerister author's comments, he also states that he could not get it to work with autoloaded contents, but suggested trying ColumnCreated)
EnableViewState fale or true has no effect on this.

Correction:
Adding his to _PreRender makes the Ajax Loading of usersettings happen at once, the rest is the same:

SupportItemGrid1.DataSource =

null;

 

SupportItemGrid1.Rebind();



Best Regards

Gunnar Skogen


Gunnar Skogen
Top achievements
Rank 1
 answered on 03 Mar 2010
2 answers
99 views
We recently updated to RadControls for ASP.NET AJAX Q3 2009 and we're now getting an error when click on the Table Wizard link on the editor.

Any ideas or something we're missing with the latest Q3 release?

Here is a portion of the exception:
InnerException: {"The ToolName property must be set!"} System.Exception {System.ArgumentException}
Message: "Exception of type 'System.Web.HttpUnhandledException' was thrown." string

Thanks!
Allen

Allen Smothers
Top achievements
Rank 2
 answered on 03 Mar 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?