Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
126 views
I have a situation where I drag from a RadListBox to a RadTreeView.  It is quite similar to this Telerik example.

When a RadListBoxItem is dropped, it fires the OnClientDropping event.  The event argument has a get_sourceItem() method where I can access the RadListBoxItem and its attributes.  The event argument also has a get_destinationItem() method, but it is coming up null.  I'm guessing this is because the destination item is a RadTreeNode and not a RadListBoxItem.

I need to compare a custom attribute in the source and destination items before I allow the drop to occur.  How can I get a reference to the destination RadTreeNode and check its custom attributes inside the OnClientDropping event handler?

Thanks!


Jon Shipman
Top achievements
Rank 1
 answered on 04 Nov 2010
5 answers
272 views
In IE8 the filter boxes are not aligned with the columns. I converted IE8 to compatibility mode and everything worked fine. I am wondering if there is a work around or did telerik provide a solution to this problem. If anyone has a quick fix it would be appreciated!
Daniel
Telerik team
 answered on 04 Nov 2010
11 answers
608 views
Hi Telerik,

I am using a RadGrid with a NestedViewTemplate. Within that NestedViewTemplate is another RadGrid.
All data is binding correctly using Advanced DataBinding techniques. My problem is the nested grid just will not fire the "ItemCommand" event.

If I say add a button within the template this will fire correctly. It's just any commands sent from the inner grid that wont fire.

I've tried adding an ItemCommand eventhandler directly to the inner grid but still nothing. So in the code below the "AddPayment" command fires as it's a button seperate from the grid. But no matter what I've tried (GridButtonCol, Button within a Template Col etc)
no ItemCommand is fired for RadGrid: Payments.

<telerik:RadGrid ID="InvoiceGrid" runat="server" >
    <MasterTableView Name="Master" AutoGenerateColumns="false" EditMode="EditForms" AllowPaging="true" ShowHeader="true" PageSize="10" DataKeyNames="InvoiceId">
        <NestedViewSettings>
            <ParentTableRelation><telerik:GridRelationFields DetailKeyField="InvoiceId" MasterKeyField="InvoiceId" /></ParentTableRelation>
        </NestedViewSettings>
        <NestedViewTemplate>          
           <fieldset style="padding:10px;">
                <legend style="padding:5px;"><b><asp:Label runat="server" ID="InvoiceHeadings" Text="Invoice Payments"></asp:Label></b></legend>
                <div id="InvoicePaymentsGrid" runat="server">
                <asp:Button runat="server" ID="AddNewPayment" Text="Add Payment" CommandName="AddPayment" />
                 <telerik:RadGrid runat="server" ID="Payments">                     
                     <MasterTableView Name="PaymentsMaster" AutoGenerateColumns="false" AllowPaging="true" ShowHeader="true" PageSize="10" DataKeyNames="PaymentId">
                        <Columns>
                            <telerik:GridBoundColumn DataField="PaymentMethod" HeaderText="Payment Method">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Comments" HeaderText="Comments"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="Payment Date" DataField="DateCreated" DataFormatString="{0:dd/MM/yyyy HH:mm}" UniqueName="DateCreated" ReadOnly="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn HeaderText="Amount" DataField="Amount" DataFormatString="{0:C}" UniqueName="Amount" ReadOnly="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn UniqueName="test">
                                <ItemTemplate>
                                    <asp:Button runat="server" ID="Test" CommandName="Test" Text="Test" />
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridButtonColumn ButtonType="ImageButton" Text="Edit" UniqueName="EditOverride" CommandName="EditPayment">
                                <HeaderStyle Width="20px" />
                            </telerik:GridButtonColumn>
                            <telerik:GridButtonColumn ButtonType="ImageButton" ConfirmText="Are you sure you want to delete this Invoice?" CommandName="DeletePayment" Text="Delete" UniqueName="Delete">
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </telerik:GridButtonColumn>
                        </Columns>                            
                    </MasterTableView>
                 </telerik:RadGrid>               
                 </div>            
            </fieldset>                       
        </NestedViewTemplate>        
        <Columns>
            <telerik:GridBoundColumn DataField="InvoiceNumber" HeaderText="Invoice Number" UniqueName="InvoiceNumber"></telerik:GridBoundColumn>  
            <telerik:GridBoundColumn HeaderText="Amount" DataField="Amount" DataFormatString="{0:C}" UniqueName="Amount" ReadOnly="true">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn HeaderText="Amount Paid" UniqueName="AmountPaid">
                <ItemTemplate><asp:Label runat="server" ID="AmountPaidLabel" ></asp:Label></ItemTemplate>
            </telerik:GridTemplateColumn>          
            <telerik:GridTemplateColumn HeaderText="Subscription" UniqueName="Subscription">
                <ItemTemplate><asp:Label runat="server" ID="SubscriptionLabel" ></asp:Label></ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn HeaderText="Description" UniqueName="Description" DataField="Description">                
            </telerik:GridBoundColumn>  
            <telerik:GridBoundColumn HeaderText="Date Created" DataField="DateCreated" DataFormatString="{0:dd/MM/yyyy HH:mm}" UniqueName="DateCreated" ReadOnly="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Date Updated" DataField="DateUpdated" DataFormatString="{0:dd/MM/yyyy HH:mm}" UniqueName="DateUpdated" ReadOnly="true">
            </telerik:GridBoundColumn>      
            <telerik:GridButtonColumn HeaderText="" ItemStyle-HorizontalAlign="Center" ButtonType="ImageButton" Text="View Invoice" UniqueName="ShowPdf" CommandName="ShowPdf"
                HeaderStyle-Width="20px" ItemStyle-Width="20px" FooterStyle-Width="20px">
            </telerik:GridButtonColumn>
            <telerik:GridButtonColumn HeaderText="" ItemStyle-HorizontalAlign="Center" ButtonType="ImageButton" Text="Email Invoice" UniqueName="Email" CommandName="Email"
                HeaderStyle-Width="20px" ItemStyle-Width="20px" FooterStyle-Width="20px">
            </telerik:GridButtonColumn>
            <telerik:GridButtonColumn ButtonType="ImageButton" Text="Edit" UniqueName="EditOverride" CommandName="Edit">
                <HeaderStyle Width="20px" />
            </telerik:GridButtonColumn>
            <telerik:GridButtonColumn ButtonType="ImageButton" ConfirmText="Are you sure you want to delete this Invoice?" CommandName="Delete" Text="Delete" UniqueName="Delete">
                <HeaderStyle Width="20px"></HeaderStyle>
            </telerik:GridButtonColumn>
        </Columns>     
    </MasterTableView>
</telerik:RadGrid>

  private void InvoiceGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridNestedViewItem)
            {                              
                RadGrid paymentsGrid = (RadGrid)e.Item.FindControl("Payments");
                paymentsGrid.NeedDataSource += new GridNeedDataSourceEventHandler(PaymentsGrid_NeedDataSource);                
            }
            else if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {                
                FormatGridEditForm(e);
            }
            else if (ControlHelper.IsItem(e.Item) && e.Item.OwnerTableView.Name == "Master")
            {
                FormatInvoiceGridRow(e.Item);
            }
        }


        private void PaymentsGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            RadGrid paymentsGrid = source as RadGrid;
            GridNestedViewItem nestedItem = paymentsGrid.NamingContainer as GridNestedViewItem;
            int invoiceId = Utilities.ToInt(nestedItem.ParentItem.GetDataKeyValue("InvoiceId"));
            List<Payment> payments = MembershipDataMethods.SelectPayments(invoiceId, true);
            paymentsGrid.DataSource = from p in payments orderby p.DateCreated descending select p;           
        }
Jerry T.
Top achievements
Rank 1
 answered on 04 Nov 2010
1 answer
40 views
Dear Telerik Team !

I ran into trouble with your grid. Firstly I will explain the required scenario.
I've got master page - it contains page toolbar. I've got content page - it must contain grid. This grid will use custom pager logic: I will use OnNeedDataSource and get required records from DB myself. Grid displays first page, but after clicking random page - I can see only empty grid. Having played around for a while I discovered that after post back OnNeedDataSource  event does not fire. Could you please help me - it's an urgent task and I still can't figure out what is wrong. I have to add that if I use the same code withour master/content pages everything works as expected.

Here is the grid:
<telerik:RadGrid ID="m_grid" runat="server" Skin="Black" AllowSorting="false" AllowPaging="True"
    PageSize="30" AllowCustomPaging="true"  OnNeedDataSource="RadGrid1_NeedDataSource">
    <PagerStyle Mode="NumericPages" />
    <ClientSettings>
      <Resizing AllowColumnResize="true" AllowRowResize="false" />
      <Scrolling AllowScroll="True" EnableVirtualScrollPaging="True" UseStaticHeaders="true" SaveScrollPosition="True" />
      <Selecting AllowRowSelect="true" />
    </ClientSettings>
  </telerik:RadGrid>

OnNeedDataSource handler is very simple the problem page does not call it.
Looking forward to hearing from you asap.
Marin
Telerik team
 answered on 04 Nov 2010
1 answer
89 views
I am trying to uncheck all nodes in a treeview using the clientside API.  I noticed that in the documentation, there is an unselectAllNodes() method, is there a way to do this to uncheck nodes too?

Edit:

This did what I needed: 
var tree = $find("<%= radTreeView.ClientID %>");
        var i;
        for (i = 0; i < tree.get_allNodes().length; i++) {
            var node = tree.get_allNodes()[i];
            var checkbox = node.get_checkBoxElement();
            checkbox.checked = false;
        }


var tree = $find("<%= radTreeViewTopics.ClientID %>");
        var i;
        for (i = 0; i < tree.get_allNodes().length; i++) {
            var node = tree.get_allNodes()[i];
            var checkbox = node.get_checkBoxElement();
            checkbox.checked = false;
 

Yana
Telerik team
 answered on 04 Nov 2010
2 answers
103 views
It is strange, I followed the example online and it is not functioning as expected. I have three textboxes when GRid is in edit mode and two of them are supposed to be currency and the other just plain text. But the RadInputManager is forcing the Plain textbox to be currency as well. This even after the datatype was set to string. Help please
Ryan Lege
Top achievements
Rank 1
 answered on 04 Nov 2010
3 answers
128 views
hi there i would like to override couple of sitemap css like lets say
RadSiteMap .rsmItem {
       clear:left;
} now want to get ride of clear:left

how can i do that ....

Ronak
 
Kalina
Telerik team
 answered on 04 Nov 2010
2 answers
104 views
Hi,
  I realize this may be an odd question, but here is my situation, i have two tables:
table1:
stateid, statename

table2:
CountyId, CountyName, stateId

I'm trying to have a structure like this:

Statename
 --> CountyName

my challenge is how to relate the two table to get the parentId. 

I think the answer is simple but for some reason I just can't get the sql right.

Regards,
Cal
Cal
Top achievements
Rank 1
 answered on 04 Nov 2010
2 answers
57 views
For this code:

http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/outlookstyle/defaultcs.aspx

Is it possible to remove the field name : from the group header text (so the grouping only shows the value, i.e. "Saturday,March 28, 2010").

Thanks,

Richard
Richard
Top achievements
Rank 1
 answered on 04 Nov 2010
1 answer
57 views
I am using RADGRID for listing related things and grid is loaded dynamically.

I have issue with filter control of RADGrid. It works fine for the first time and after pagin/sorting it stops working and giving this error
"'null' is null or not an object". While debugging I found that this is some viewstate related issue but I am not able to solve it.

Pls suggest on this.

Regards,
M G
Maria Ilieva
Telerik team
 answered on 04 Nov 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?