Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
150 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
3 answers
82 views
Hi,

Telerik in webpage is loading very slowly when i am drilling down further on the final node.Can i able to limit that ?
I have tree like below.

Root Node:
    Node 1
    Node 2
    Node 3
        Node 3.1
        Node 3.2
            Node 3.2.1

For example In the node 3.2.1,its having 30 items ,if the item count is > 20 , i need to create a new node called "showallitems" and display all the 20 items under "showallitems".
        
Please help me.

Regards,
Xavier
Plamen
Telerik team
 answered on 10 Aug 2011
3 answers
208 views
The coding method you show in your examples $find("<%= RadGrid1.ClientID %>")  errors out when I try it.  Can I use jQuery to do the same thing  $("#RadGrid1").  If this works can you update your examples to show jQuery code in place of the old version?

Thanks.
Tsvetina
Telerik team
 answered on 10 Aug 2011
2 answers
189 views
Hello,

  I have a radmenu in the master page. In one of my content pages, I have a timer. The timer checks for a value in the database and based on that value, I would like to change the backcolor and ImageUrl of the menu item(actually,would like the menu item to glow) which means that there is a new message. Right now, I am doing it like this which is of course not working

Am i missing something ?

code- behind
in the timer tick event.( content page)

  Radmenu1.items(5).items(2).backcolor = drawing.color.red
 Radmenu1.items(5).items(2).ImageUrl ="Images/Newmessage.png"

How do I make the menu item glowing? Is there a way to do that?

Appreciate the help
Thanks

Kate
Telerik team
 answered on 10 Aug 2011
1 answer
203 views
Hello, 

I would like to tweak some of the UI components on the cells when items are being edited / inserted.

I'm able to identify when an item is being edited through TreeListDataItem.IsInEditMode property, but I cannot find the way to know if the item is being inserted.

So the question will be: how to know within the ItemCreated event if an item is in insert mode?

Thanks in advance
Tsvetina
Telerik team
 answered on 10 Aug 2011
1 answer
80 views
I've created an ascx control like this:
<telerik:RadAjaxPanel runat="server" ID="rpan">
    <div style="width: 400px;">
    <telerik:RadToolBar runat="server" ID="rToolBar"
        OnClientButtonClicking="onItemClicking" onbuttonclick="rToolBar_ButtonClick">
    </telerik:RadToolBar>
    </div>

    <telerik:RadTreeView runat="server" ID="rTree"
        Skin="Vista"
        DataFieldID="ID"
        DataFieldParentID="idParent"
        DataTextField="Cd_Menu"
        DataValueField="link"
        OnClientDoubleClick="OnDoubleClick"
        OnNodeEdit="RadTreeView1_NodeEdit"
        EnableDragAndDrop="false"
        EnableDragAndDropBetweenNodes="false"
        OnNodeDrop="RadTreeView1_HandleDrop"
        OnClientNodeClicked="onNodeClicked"
        OnClientNodeClicking="onNodeClicking"
        OnClientNodeDropping="onNodeDropping"
        OnClientNodeDragging="onNodeDragging"
        OnNodeDatabound="rTree_NodeDataBound">
    </telerik:RadTreeView>
</telerik:RadAjaxPanel>


I also have an aspx page with a RadMenu created at runtime with databinding.
I tried to add the ascx control inside a RadMenuItem server side:

Telerik.Web.UI.RadMenuItem subRmi = new Telerik.Web.UI.RadMenuItem();
subRmi.ItemTemplate = new FavouritesTemplate(this.Page);

I have declared this class inside the same aspx page:
class FavouritesTemplate : ITemplate
    {
        private Page _page = null;

        public FavouritesTemplate(Page page)
        {
            this._page = page;
        }

        public void InstantiateIn(System.Web.UI.Control container)
        {
            Favourites fav = ((Favourites)this._page.LoadControl("~/Web.UserControls/Favourites.ascx"));
            fav.ID = "favourites";
            container.Controls.Add(fav);
        }
    }

The ascx control inside the RadMenuItem is shown correctly but doesn't work properly.
Clicking on a RadToolBarButton the whole aspx page do postback instead of only the ascx content (because of RadAjaxPanel)

Putting the same ascx control directly inside the aspx page (not inside the the RadMenuItem) works as expected (partial postback of the ascx content)

Maria Ilieva
Telerik team
 answered on 10 Aug 2011
1 answer
112 views
As we have fixed image formats for some images I would like to control the cropping from outside the control with javascript and disable the crop option from the toolbar or maybe the whole toolbar. Is this possible?

Rumen
Telerik team
 answered on 10 Aug 2011
3 answers
776 views
Hi,

i have a radgrid created programatically in code (.cs) file.
now i want to prompt user when trying to delete records in grid..done in below example.
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx

now as my grid is generated dynamically so i didnt able to add ItemDataBound event throgh code as i added itemupdated event...

grid.ItemUpdated +=

new GridUpdatedEventHandler(grid_ItemUpdated);

 



can you please suggest how to solve it.

thanks in advance.
Gabe Silvarajoo
Top achievements
Rank 2
 answered on 10 Aug 2011
1 answer
99 views
I'm using your example to print a pane with stylesheets. (http://www.telerik.com/help/aspnet-ajax/splitter-panes-printing.html)

Inside this panel I have several listviews that contain buttons  (Add, Edit and Delete)
I want to supress these buttons when I print.  What do I need to put in the stylesheet to do this?
 
Dobromir
Telerik team
 answered on 10 Aug 2011
1 answer
120 views
Hi Forum!

I connected a radchart to a sqldatasucer, from that datasource i'll get 11 rows and 2 columns where the frist column is name and second is value. it all goes right, but the x-axis is only showing the first 7 rows. I wwent to the plot area -> x-axis and saw property called max value, i dont think this is the property that is confining my rows but still, when i try to change its value it automaticly goes back to 7. Can anyone help me?

Many thanks,
   FEST
Peshito
Telerik team
 answered on 10 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?