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

I have my radgrid set to use Ajax. I would like to run some javascript after every edit or insert on my grid.

I have tried binding to the onGridCreated and onRowCreated events but they fire too often.

If there any way to say "after a row has been inserted or updated run this javascript" ?

Thanks
Sam
Maria Ilieva
Telerik team
 answered on 10 Aug 2011
1 answer
223 views
I am using the RadtreeView control in a ASP.Net webform. Depending on the data, I might display a tree with 1 branch or a Hierarchy tree with many branches and sub branches. Then the user will click on the node they want to select and the form will capture which node the user selected.

Everything works fine if the control shows only 1 branch with many nodes. 

However, if the tree is showing a hierarchy with many branches and many nodes under each branch, and the user clicks on their choice of node, the return value is always a 0, 1 or 2. There are 3 main branches in the hierarchy so I assume the return value is the value of the main branch of the node that was selected.

How can I get the RadTreeView to always return the index number of the node I selected? Here is the click event that captures the user selection:

 
        protected void RadTreeView1_ContextMenuItemClick(object sender, Telerik.Web.UI.RadTreeViewContextMenuEventArgs e)
        {
                    HierarchyItem = e.Node.Index;
                    if (HierarchyItemSelected != null)
                        HierarchyItemSelected(thisEventArgs.Empty);
            }
        }



Nikolay Tsenkov
Telerik team
 answered on 10 Aug 2011
4 answers
555 views
Hi all

Im new with this Telerik controls and I need your help.
Im working with RadWindow like popup, I show this popup for edit a item from radgrid, and I want close this radwindow from a button inside  radwindow. I dont want use javascript, then I need close with C#, there are some way to do this?

Thank you for you attention
Hugo
Top achievements
Rank 1
 answered on 10 Aug 2011
1 answer
123 views
I imnplement culture dynamically for all the controls.
But I didn't found the way to change the culture for RadSplitter.

How I can do this?

Dobromir
Telerik team
 answered on 10 Aug 2011
3 answers
96 views
I have a RadScheduler that includes the following ...
OnClientAppointmenMoveStart="RadSchedulerAppointmentMoveStart"
OnClientAppointmentMoveEnd="RadSchedulerAppointmentMoveEnd"
OnClientAppointmentResizeStart ="RadSchedulerAppointmentResizeStart"
OnClientAppointmentResizeEnd="RadSchedulerAppointmentResizeEnd"
And in the JS handler for the ResizeStart event I have an alert.

When I run the page I note that the cursor doesn't change when I haver over the resize handle at the bottom of an appointment and that if I try grabbing it either, nothing happens (the JS alert doesn't fire) or the appointment moves. I guess this latter is 'cos I've grabbed slightly off the resize handle.

I can do nothing to resize the appointment.

FWIW, this is true in IE8 and IE6.

-- 
Stuart
Plamen
Telerik team
 answered on 10 Aug 2011
1 answer
56 views
I am having a RadUpload control with a Progress Area.

I have put client side validation to check valid file extension , file name entered etc.

I have a text box in the form (along with radupload and progress area), input of it has to be validated against the database. if the input is valid only it should upload the chosen document.
I have put a CustomValidator (server side) to do this validation.

What happens now even if the input is NOT valid, it uploads the documnt (progress area is shown) and then it shows the validation message.

Is there any way that I can supress this if invalid data is entered.

Thanks in advance.

 
Peter Filipov
Telerik team
 answered on 10 Aug 2011
4 answers
143 views
I have a aspx user control page that has a LinkButton . The page uses some radajax controls too.
In Firefox(FF 3.6 and 4), if I rapidly keep clicking on the linkbutton .NET will come up with an "Invalid postback or callback argument" error. This error does not seem to happen when I click in IE. Normal single clicks on the linkbutton work fine, but it's when I click on the button repeatedly while the page is in the process of posting back that I run into trouble.
I was suggested to use "EnableEventValidation = false" but it ended up with some security hole. So, i was looking for some alternative solution other than "EnableEventValidation" property.
Daniel
Telerik team
 answered on 10 Aug 2011
1 answer
81 views
Hi,
I'm having a small problem with RadDock controls defined inside a formview, and I am not sure if it's my fault or if it's a bug.

In general, the controls inside a FormView's ItemTemplate and EditItemTemplate can have the same ID without any issues. In my case, I have a RadDock inside a formview with the controls defined inside the <ContentTemplate> of the RadDock. This leads to an error when I access the page that says: The type 'ASP.pages_mypage_aspx' already contains a definition for 'control'.

So:
Formview => ItemTemplate => RadDock => ContentTemplate => Control with ID X
Formview => EditItemTemplate => RadDock => ContentTemplate => Control with ID X

Is there a workaround for this that doesn't involve renaming the controls within the RadDocks?

Thanks.
Slav
Telerik team
 answered on 10 Aug 2011
1 answer
45 views
Hi,

I'm working on a treeview with Client Side Api.

On ClientNodeDropping event I check (business rule) if the source node can be dropped over the destination node.

If the source node can be dropped, everything is OK, the ClientNodeDropped event is fired and the destination node is expanded.

If the source node cannot be dropped, I cancel the event, the ClientNodeDropped event is not fired BUT the destination node is still expanded: Why? How to cancel this behavior?

Regards,
Frederic Dobon
Plamen
Telerik team
 answered on 10 Aug 2011
3 answers
155 views
I have a page with numerous grids for which drag and drop is enabled to reorder items within the grid.  One grid, which I've adapted the code from other working grids, will not refresh the grid on screen even though the codebehind correctly changes the underling data

Below are my *.aspx file and *.vb file -- I've pulled the problematic grid out into it's own file and it persists in misbehaving on its own as well.  I've about exhausted my creative ideas for solving the problem.

Any ideas?

Thanks,


Brad Smith





Imports System.Data.SqlClient
Imports Telerik.Web.UI
Imports dsMeetingDataDatasetTableAdapters
Imports dsMeetingDataDataset
Imports System.Data.Sql
 
Partial Class _admin_frmTest
    Inherits System.Web.UI.Page
    Dim myadapter As New PresentationsTableAdapter
 
 
    Protected Sub PAge_Load() Handles MyBase.Load
         
 
    End Sub
 
    Protected Sub rgInterests_itemcommand(ByVal sender As Object, ByVal e As GridCommandEventArgs)
        'gets grid item
        Dim index As Integer = Convert.ToInt32(e.CommandArgument)
        Dim item As GridDataItem = Me.rgInterests.Items(index)
 
        'gets Session interest ID
        Dim intSessIntID As Integer = Server.HtmlDecode(item("SessionInterestID").Text)
 
        Dim bllSI As New bllSessionsInterests
 
        Select Case e.CommandName
 
            Case "DeleteMe"
                'Me.lblDebug.Text = "Delete Sess Int ID: " & intSessParID
                bllSI.DeleteSessionInterest(intSessIntID)
                Me.rgInterests.DataBind()
 
        End Select
        bllSI = Nothing
 
 
 
    End Sub
 
    Protected Sub rgInterests_itemcreated(ByVal sender As Object, ByVal e As GridItemEventArgs)
        If e.Item.ItemType = GridItemType.AlternatingItem Or e.Item.ItemType = GridItemType.Item Then
            Dim item As GridDataItem
            item = e.Item
            Dim ibtn As ImageButton
 
            'does the delete
            ibtn = item("Delete").FindControl("ibtnDelete")
            ibtn.CommandArgument = e.Item.ItemIndex.ToString()
 
        End If
    End Sub
 
 
 
    Protected Sub rgInterests_itemdatabound(ByVal sender As Object, ByVal e As GridItemEventArgs)
 
        If TypeOf e.Item Is GridDataItem Then
 
            Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
            Dim button As ImageButton = dataItem("Delete").FindControl("ibtnDelete")
            button.Attributes.Add("onClick", "return confirm('Are you sure you want to remove this interest?');")
 
        End If
 
    End Sub
 
 
 
    Protected Sub rgInterests_RowDrop(ByVal sender As Object, ByVal e As GridDragDropEventArgs)
 
        If e.DestDataItem IsNot Nothing AndAlso e.DestDataItem.OwnerGridID = rgInterests.ClientID Then
            'reorder items in pending grid
            Dim destItem As Integer = e.DestDataItem.GetDataKeyValue("SessionInterestID")
            Dim destIndex As Integer = e.DestDataItem.ItemIndex
            Dim originItem As Integer = e.DraggedItems(0).GetDataKeyValue("SessionInterestID")
            Dim originIndex As Integer = e.DraggedItems(0).ItemIndex
 
            'do move
            Dim intSessionID = lblSessionID.Text
            Dim bllSessionsInterests As New bllSessionsParticipants
 
            'Me.lblDebug.Text = "Move Up for Session Par ID: " & intPresParID & " PresentationID: " & intPresentationID
            DoMove(originItem, destIndex + 1)
            DoMove(destItem, originIndex + 1)
            rgInterests.Rebind()
 
            e.DestDataItem.Selected = True
 
        End If
    End Sub
 
 
 
    Public Sub DoMove(ByVal intIDToMove As Integer, ByVal intOrderFieldValue As Integer)
 
        'loads constring from web.config
        Dim strConString As String = ConfigurationManager.ConnectionStrings("MeetingDataConnectionString").ConnectionString
        Dim conData As New SqlConnection(strConString)
 
        conData.Open()
 
        Dim strSQL As String
        strSQL = "Update Sessions_Interests set SessionInterestPriority=@neworder where SessionInterestID=@SessIntID;"
        Dim objCmd As New SqlCommand(strSQL, conData)
 
        Dim paramNewOrd As New SqlParameter("@neworder", Data.SqlDbType.Int)
        paramNewOrd.Value = intOrderFieldValue
        objCmd.Parameters.Add(paramNewOrd)
 
        Dim paramSessIntID As SqlParameter
        paramSessIntID = New SqlParameter("@SessIntID", Data.SqlDbType.Int)
        paramSessIntID.Value = intIDToMove
        objCmd.Parameters.Add(paramSessIntID)
 
        Response.Write(objCmd.ExecuteNonQuery())
        conData.Close()
        conData.Dispose()
 
        paramNewOrd = Nothing
        paramSessIntID = Nothing
        objCmd = Nothing
 
    End Sub
 
End Class










<%@ Page Language="VB" AutoEventWireup="false" CodeFile="frmTest.aspx.vb" Inherits="_admin_frmTest" %>
 
<%@ 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">
<head id="Head1" runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <title>Session form</title>
</head>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function onInterestRowDropping(sender, args) {
            if (sender.get_id() == "<%=rgInterests.ClientID %>") {
                var node = args.get_destinationHtmlElement();
                if (!isChildOf('<%=rgInterests.ClientID %>', node) && !isChildOf('<%=rgInterests.ClientID %>', node)) {
                    args.set_cancel(true);
                }
            }
        }
 
        function isChildOf(parentId, element) {
            while (element) {
                if (element.id && element.id.indexOf(parentId) > -1) {
                    return true;
                }
                element = element.parentNode;
            }
            return false;
        }
    </script>
</telerik:RadCodeBlock>
<body class='darkforeclass'>
    <form id="form2" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX='True' >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgInterests">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgInterests" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadGrid ID="rgInterests" runat="server" DataSourceID="sqlDSInterests" GridLines="None"
        OnItemCommand="rgInterests_itemcommand" OnItemCreated="rgInterests_itemcreated"
        AllowPaging='True' OnItemDataBound="rgInterests_itemdatabound" OnRowDrop="rgInterests_RowDrop"
        PagerStyle-AlwaysVisible="False" PageSize='4' Skin="Simple" Width="625px" Height='150px'
        AutoGenerateColumns="False">
        <ClientSettings AllowRowsDragDrop="True">
            <Selecting AllowRowSelect="True" EnableDragToSelectRows="False" />
            <ClientEvents OnRowDropping="onInterestRowDropping" />
        </ClientSettings>
        <PagerStyle Mode="NextPrevAndNumeric" />
        <MasterTableView DataKeyNames="SessionInterestID" Width="100%" GridLines="None">
            <NoRecordsTemplate>
                No Interests listed.</NoRecordsTemplate>
            <Columns>
                <telerik:GridBoundColumn DataField="SessionInterestID" DataType="System.Int32" HeaderText="SessionInterestID"
                    ReadOnly="True" SortExpression="SessionInterestID" UniqueName="SessionInterestID"
                    Visible='False'>
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="InterestID" DataType="System.Int32" HeaderText="InterestID"
                    SortExpression="InterestID" UniqueName="InterestID" Visible='False'>
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="SessionInterestPriority" DataType="System.Int32"
                    HeaderText="#" SortExpression="SessionInterestPriority" UniqueName="SessionInterestPriority"
                    Visible='True'>
                    <ItemStyle Width='20px' />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="SessionID" DataType="System.Int32" HeaderText="SessionID"
                    SortExpression="SessionID" UniqueName="SessionID" Visible='False'>
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn HeaderText="Interest" SortExpression="Interest" UniqueName="Interest">
                    <ItemTemplate>
                        <asp:Label ID="lblInterest" runat="server" CssClass='tinylinkclass'><%#Eval("Interest") %></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle Width='550px' />
                    <ItemStyle HorizontalAlign='left' Width='550px' />
                    <FooterStyle Width="550px" />
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName='Delete'>
                    <ItemTemplate>
                        <asp:ImageButton ID='ibtnDelete' runat='server' CommandName='DeleteMe' ImageUrl='images/trash.gif' /></td>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <FilterMenu EnableTheming="True" Skin="Hay">
            <CollapseAnimation Duration="200" Type="OutQuint" />
        </FilterMenu>
    </telerik:RadGrid>
    <div class="buttonbarclass">
        <asp:LinkButton ID="btnAddSessionInterest" runat="server" CommandName="AddSessionInterest"
            CssClass="noultinylinkclass"><img style="border:0px;vertical-align:middle;" alt="" src="images/add16.png" />  Add Session Keyword</asp:LinkButton>
          
    </div>
    <telerik:RadWindow ID="rwSessionInterest" runat="server" Behaviors="Close, Move"
        Height="400px" Left="250px" Modal="true" NavigateUrl="" OffsetElementID="rwSessionInterest"
        OpenerElementID="<%#btnAddSessionInterest.clientid%>" ReloadOnShow="True" Title="New Session KW"
        Width="650px">
    </telerik:RadWindow>
    <asp:Label runat='server' ID='lblSessionID' Text='567'></asp:Label>
    <asp:TextBox ID="tbOrganizationName" runat="server" Visible="False"></asp:TextBox>
    <asp:TextBox ID="tbOrganizerID" runat="server" Visible="False"></asp:TextBox>
    <asp:Label runat='server' ID='lblSubmitterID' Visible='false'></asp:Label>
    <asp:SqlDataSource ID='sqldsInterests' runat='server' ConnectionString="<%$ ConnectionStrings:MeetingDataConnectionString %>"
        SelectCommand="SELECT Sessions_Interests.SessionInterestID, Sessions_Interests.SessionID, Sessions_Interests.InterestID, Sessions_Interests.SessionInterestPriority, b.interest FROM Sessions_Interests INNER JOIN Interests AS b ON Sessions_Interests.InterestID = b.InterestID WHERE Sessions_Interests.SessionID=@MySessionID ORDER BY Sessions_Interests.SessionInterestPriority">
        <SelectParameters>
            <asp:ControlParameter ControlID="lblSessionID" Name="MySessionID" PropertyName="Text" />
        </SelectParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>
Tsvetina
Telerik team
 answered on 10 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
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?