Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
192 views
A bit of an odd one.

I've a page with a grid on that does all sorts of clever things client-side in the OnRowSelecting event.

Sadly, the client has moved the goal posts and I (under certain circumstances) need to pre-select a row in my server-side code when the page loads.

Now, I know I can rewrite all of the clever JS to perform the same tasks on the server; I just don't want to

So, is there a way of forcing the selection of a row in server-side code that will trigger the client-side OnRowSelecting event? I can, I think, actually use the OnRowSelected event instead, if that's an option.

And, yes, I know I could write a JS function to do stuff and call that using, for example, ResponseScripts.Add(), but I want to access the 'sender' and 'args' parameters that the built-in client-side event exposes.

And thoughts?

--
Stuart
Stuart Hemming
Top achievements
Rank 2
 answered on 12 Oct 2009
2 answers
241 views
I have 3 context menus loaded into my RadTreeView. I associate different menus with my nodes depending on node level. I'm using the OnClientContextMenuItemClicking event to prompt for Delete confirmation when user clicks a delete context menu command.  In my Client-side event handler, I want to determine which context menu was clicked so that I can hide just that menu.  I've found one way, but it seems cumbersome and subject to change if Telerik changes ID naming conventions.  Is there a better way to find the context menu that was clicked?  Here is what I have working right now:

<script type="text/javascript">
   function contextMenuItemClicking(sender, eventArgs) {
       var item = eventArgs.get_menuItem();
       if (item.get_text() == "Delete") {
           if (!confirm("Confirm delete")) {
               eventArgs.set_cancel(true);
               for (var i = 0; i < sender.get_contextMenus().length; i++) {
                   if (sender.get_contextMenus()[i]._clientStateFieldID ==
                       eventArgs.get_node()._resolvedContextMenuID + "_ClientState") {
                       sender.get_contextMenus()[i].hide();
                       break;
                   }
               }
           }
       } 
   }

(...)

            <telerik:RadTreeView ID="radTreeMainView" Runat="server" 
                Height="420px" 
                Skin="Web20" 
                OnClientContextMenuItemClicking="contextMenuItemClicking" 
                oncontextmenuitemclick="radTreeMainView_ContextMenuItemClick"
                >
            </telerik:RadTreeView>

Scott
Top achievements
Rank 1
 answered on 12 Oct 2009
1 answer
158 views

Hi,

I'm having a problem with radgrid and i couldn't find a general solution. Here is the scenario:

I have a search page that binds results to grid. pagesize=10. first query returns 11 elements so grid is 2 pages. i'm selecting second page then search again which returns 1 element. here is the problem, radgrid stuck at second page and i don't want to show "No records to display" message, i just want to reset page to 1. 

I can do it by:

protected void btnSearch_Click(object sender, EventArgs e)  
        {  
            grdBank.CurrentPageIndex = 0;  
            grdBank.Rebind();  
        } 

however, i'm using this grid in more than 100 pages which all have this problem. i don't want to put this code in every page. So i created my own custom pager as described here: http://www.telerik.com/help/aspnet-ajax/grdprogrammaticpagercustomization.html but this also has same problem. 

i tried to reset page by "e.Item.OwnerTableView.CurrentPageIndex = 0;" in "protected override void OnItemEvent(GridItemEventArgs e)" which works as expected but caused another problem that i can't go to page 3 which is also expected...

how can i solve it in pager? on which event should i reset page? 

Thanks

KocSistem
Top achievements
Rank 1
 answered on 12 Oct 2009
1 answer
117 views
Hi

Our client has purchased and made available the RadControls ( RadControls_for_ASP.NET_AJAX_2009_2_826_dev.msi). I am installing on a dev machine which is running Windows 2008 Server with Visual Studio 2008.

The installation fails when 'copying new files' with an error message 'Error Writing to File: Telerik.web.design.dll Verify that you have access to this directory'

I am using the admin account to install, and have removed the previous demo version of the controls.

Can anyone offer some advice?

William
Missing User
 answered on 12 Oct 2009
5 answers
328 views
We are creating the radgrid dynamically in code behind with one bound column and other template columns.
We are not able to find checkbox control in gridDataItem using gridDataItem.FindControl method although text of bound column is available.

Please provide solution for the same.

 Code:
The folowing method is called on page load:
----------------------------------------------------------------------------------------------------------------------
Private Function UpdateGridActionColumns() As GridColumnCollection
 Dim actionCollection As GridColumnCollection
        Dim dsActions As New DataSet
        Dim dtActions As New DataTable
        Try
            actionCollection = New GridColumnCollection(RadGrid1_Functions.MasterTableView)
            dsActions = Me._appObject.GetAllActions().ConvertToDataSet()
            RadGrid1_Functions.MasterTableView.Columns.Clear()


            Dim boundColumn As New GridBoundColumn
            boundColumn.DataField = "APP_FUNCTION_ID"
            boundColumn.UniqueName = "SEC_FUNCTION_ID"
            boundColumn.HeaderText = "Function"
            RadGrid1_Functions.MasterTableView.Columns.Add(boundColumn)

            If dsActions.Tables.Count > 0 Then
                dtActions = dsActions.Tables(0)
                For ctr As Integer = 0 To dtActions.Rows.Count - 1
                    Dim templateColumnID As String = dtActions.Rows(ctr)("Action_Id")
                    Dim templateColumn As GridTemplateColumn = New GridTemplateColumn
                    templateColumn.ItemTemplate = New MyTemplate(templateColumnID)
                    templateColumn.UniqueName = templateColumnID
                    templateColumn.DataField = "Action_Id"
                    templateColumn.HeaderText = dtActions.Rows(ctr)("Action_Name")
                    RadGrid1_Functions.MasterTableView.Columns.Add(templateColumn)
                Next
            End If
            Return actionCollection
        Catch ex As Exception
            Return Nothing
        End Try
End Function
----------------------------------------------------------------------------------------------------------------------
Template column class is:

 Private Class MyTemplate
        Implements ITemplate

        Protected chkTempColumn As CheckBox
        Private colname As String

        Public Sub New(ByVal cName As String)
            MyBase.New()
            colname = cName
        End Sub

        Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn
            chkTempColumn = New CheckBox
            chkTempColumn.ID = "chk" & colname
            AddHandler chkTempColumn.DataBinding, AddressOf Me.chkTempColumn_DataBinding

            Dim table As Table = New Table
            Dim row As TableRow = New TableRow
            Dim cell As TableCell = New TableCell

            table.BorderWidth = 0
            row.BorderWidth = 0
            cell.BorderWidth = 0

            row.Cells.Add(cell)
            table.Rows.Add(row)
            cell.Controls.Add(chkTempColumn)
            container.Controls.Add(table)
            'container.Controls.Add(boolValue)
        End Sub

        Private Sub chkTempColumn_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
            Dim cBox As CheckBox = CType(sender, CheckBox)
            Dim container As GridDataItem = CType(cBox.NamingContainer, GridDataItem)
            Dim dr As DataRow = CType(container.DataItem, DataRowView).Row

            'cBox.Checked = CType(CType(container.DataItem, DataRowView)("Bool"), Boolean)
            Select Case Integer.Parse(dr(colname))
                Case 0
                    cBox.Checked = False
                Case 1
                    cBox.Checked = True
                Case -1
                    cBox.Checked = False
                    cBox.Enabled = False
            End Select
        End Sub
    End Class
----------------------------------------------------------------------------------------------------------------------
Please provide the solution for same.

Please mark a copy of solution to:
chetan.mehta@cognizant.com

Regards
Chetan
Frameworks team, marketRx (A Cognizant company)

P.S: We have purchased Telerik UI suite but raising ticket here since the subscription has expired.
Nikolay Rusev
Telerik team
 answered on 12 Oct 2009
3 answers
740 views
I'd like to put a (in this case) very slim spacer between each line in my grid.
See attached image.

Any ideas?

Jeppe Jespersen
Denmark

Dimo
Telerik team
 answered on 12 Oct 2009
1 answer
101 views
Hi,
When i set the width of the toolbar button in percentage, firefox(v3.5.3) will not be able to display correctly. Any solution?
<CommandItemTemplate> 
                                <telerik:RadToolBar ID="RadToolBar1" runat="server" CausesValidation="False" Skin="Sunset" 
                                    OnClientButtonClicking="OnClientButtonClicking" AutoPostBack="True"  
                                   style="display:block; float: none"
                                    <Items> 
                                      <telerik:RadToolBarButton runat="server"  Text="Add New" 
                                            CommandName="AddNew" Width="20%"
                                        </telerik:RadToolBarButton> 
                                        
                                        <telerik:RadToolBarButton runat="server" Text="Delete" 
                                            CommandName="DeleteFile" Width="20%"
                                        
                                        </telerik:RadToolBarButton> 
                                        <telerik:RadToolBarButton runat="server"  Text="Refresh" 
                                            CommandName="Refresh" Width="20%" > 
                                        </telerik:RadToolBarButton> 
                                       
                                        <telerik:RadToolBarButton runat="server" Text="AutoRefresh OFF" 
                                            CommandName="Autorefresh" AllowSelfUnCheck="True" CheckOnClick="True" Width="20%"
                                        
                                        </telerik:RadToolBarButton> 
                                        <telerik:RadToolBarDropDown runat="server" Text="Filter Files" > 
                                            <Buttons> 
                                                <telerik:RadToolBarButton runat="server" Text="All Files" CommandName="FilterAllFile" Width="20%"
                                                </telerik:RadToolBarButton> 
                                                <telerik:RadToolBarButton runat="server" Text="Ready Files" CommandName="FilterReadyFile"
                                                </telerik:RadToolBarButton> 
                                                <telerik:RadToolBarButton runat="server" Text="Error Files" CommandName="FilterErrorFile"
                                                </telerik:RadToolBarButton> 
                                                <telerik:RadToolBarButton runat="server" Text="Processing Files" CommandName="FilterProcessingFile"
                                                </telerik:RadToolBarButton> 
                                            </Buttons> 
                                        </telerik:RadToolBarDropDown> 
                                    </Items> 
                                </telerik:RadToolBar> 
                            </CommandItemTemplate> 

Yana
Telerik team
 answered on 12 Oct 2009
3 answers
113 views
hi

How do i allow only update but not insert: Thanks

 

<telerik:GridTemplateColumn DataField="SellPrice"

 

DataType="System.Decimal" HeaderText="Sell Price"

 

SortExpression="SellPrice" UniqueName="SellPrice">

 

<EditItemTemplate>

 

 

<asp:TextBox ID="SellPriceTextBox" runat="server"

 

 

Text='<%# Bind("SellPrice") %>'></asp:TextBox>

 

 

 

</EditItemTemplate>

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="SellPriceLabel" runat="server"

 

 

 

Text='<%# Eval("SellPrice") %>'></asp:Label>

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

 

L
Top achievements
Rank 1
 answered on 12 Oct 2009
2 answers
110 views
I was wondering if it was possible to drag items from a RadComboBox, prefferably with filtering and text selection on, into a rad listbox.  I didnt see anything in my searches of the forums, or the demos.  If this is possible would you point me in the direction of an example of some kind?

Thanks,
John
john
Top achievements
Rank 1
 answered on 12 Oct 2009
2 answers
117 views
Hi

I have a RadTreeView that initially loads some nodes (hierarchical) and then some of the nodes when expanded load more nodes through web service. What happens is that the nodes loaded through the WebService go below the nodes that were already loaded under that node, like this

- PreloadedNode
--- PreloadedNode
--- PreloadedNode
--- WebServiceNode
--- WebServiceNode

What I want is to display the WebService nodes above the Preloaded nodes like so

- PreloadedNode1
--- WebServiceNode
--- WebServiceNode
--- PreloadedNode
--- PreloadedNode

Is this possible?

Thanks a lot in advance! :)
John
Top achievements
Rank 2
 answered on 12 Oct 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?