Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
99 views
What event do I tie into to set the properties for this control programmatically?
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandradasyncupload/defaultcs.aspx?product=upload
should I use a grid databinding event or an asynch prerender or oninit event?
Can you show a code sample based on the example?
Atlas
Top achievements
Rank 1
 answered on 19 Aug 2010
3 answers
219 views
Hi

I've followed this example and the documentation here to create a grid with 2 rows in the header for just some of the columns. I've declared the grid control in the .aspx control, and declared the mixture of normal bound columns and template columns in the Page_Init function of the code behind.

It displays fine, but when I do a postback (eg sort) then it adds more columns to the grid. I've tried checking for IsPostback, but that just makes the template column contents disappear. What am I missing?

Here is the .aspx page:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false"
        AllowSorting="true" Skin="Vista">
    <MasterTableView DataKeyNames="HOLE_ID, HOLE_SORT">
        <HeaderStyle HorizontalAlign="Center" />
        <ItemStyle HorizontalAlign="Center" />
        <AlternatingItemStyle HorizontalAlign="Center" />
        <NoRecordsTemplate>
            <div style="width:100%; text-align:center; height:21px; padding:4px 4px 4px 10px;">
                <asp:Label ID="lblNoRecords" runat="server" Text="No data exists for this Hole."></asp:Label>
            </div>
        </NoRecordsTemplate>
    </MasterTableView>
    <ClientSettings>
        <Scrolling AllowScroll="true" />
    </ClientSettings>
</telerik:RadGrid>



Code behind excerpt:

Private colHeaderGroupList as List(of String) = GetColumnHeaderGroups()
Private colHeaderList as List(of MyColumnData) = GetColumnHeaderData()
 
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
    If Page.IsPostBack = False Then
        LoadColumns()
    End If
End Sub
 
Private Sub LoadColumns()
    'clear columns
    RadGrid1.MasterTableView.Columns.Clear()
    'add standard column
    Dim col1 As GridBoundColumn = New GridBoundColumn()
    RadGrid1.MasterTableView.Columns.Add(col1)
    With col1
        .DataField = "HOLE_NO"
        .HeaderText = "Hole"
        .SortExpression = "HOLE_SORT"
    End With
    'add elements as template columns to use double row headers
    For Each colHeader As String In colHeaderGroupList
        'add column to grid
        Dim templateCol As GridTemplateColumn = New GridTemplateColumn()
        RadGrid1.MasterTableView.Columns.Add(templateCol)
        'get just the columns for this group
        Dim thisGroup as List(of MyColumnData) = (From x in colHeaderList
                                  Where x.Group = colHeader
                                  Select x).ToList()
        'create templates for column
        templateCol.HeaderTemplate = New MyDynamicHeaderTemplate(thisGroup)
        templateCol.ItemTemplate = New MyDynamicItemTemplate(thisGroup)
    Next
End Sub
 
Private Class MyDynamicHeaderTemplate
.
.
.
End Class
 
Private Class MyDynamicItemTemplate
.
.
.
End Class


Kind Regards,
Jeremy
Jeremy
Top achievements
Rank 1
 answered on 19 Aug 2010
1 answer
122 views
Hello Telerik Team,

I have upgraded my trial License to the Developers License ( Version: 2010.2.713.40)
I am getting Microsoft JScript runtime error: Object expected near:
 

 

var multiPage = $find("<%= tabMultiPage.ClientID %>");

in the below function:

  

function deleteTab(tabText)
           {
               var tabStrip = $find("<%= tabContainer.ClientID %>");
               var multiPage = $find("<%= tabMultiPage.ClientID %>");
               var tab = tabStrip.findTabByText(tabText);
               var pageView = tab.get_pageView();
                 
               var tabToSelect = tab.get_nextTab();
               if (!tabToSelect)
                   tabToSelect = tab.get_previousTab();
                     
               tabStrip.get_tabs().remove(tab);
               multiPage.get_pageViews().remove(pageView);
                 
               if (tabToSelect)
                   tabToSelect.set_selected(true);
               multiPage.commitChanges();
               tabStrip.commitChanges();   
           }

I have my web.config changes as shown below:

<add key="Telerik.TabStrip.Skin" value="Outlook" />
<add key="Telerik.Grid.Skin" value="Default" />
<add key="Telerik.TabStrip.EnableEmbeddedSkins" value="false" />
<add key="Telerik.TabStrip.EnableEmbeddedBaseStylesheet" value="false" />

It would be great if you can help me in this regard.
Please let me know if you need any more info.

Thanks,
Vishal

 

 

 

 

Vishal
Top achievements
Rank 1
 answered on 19 Aug 2010
2 answers
92 views
hello,
I'm having a problem with the drag and drop function from your listview example in IE.  It works fine in all browsers except IE (7,8).  When I click on the drag handle, the dragged item does not display in front of everything.  I've been tinkering with the css for hours to get this to display correctly in IE to no avail.  I'm using the same class names as in your example.  Are there specific classes that I should be modifying?  The element that is being dragged is behind some elements and in front of others.  The problem is when I try to drag the item onto the target area.  Since the dragged item is behind the target area, i'm not able to drop it on that area.  I realize that IE has many issues with z-index, but there has to be something that i'm missing.  What is the class (from your example:http://demos.telerik.com/aspnet-ajax/listview/examples/itemdragdrop/defaultcs.aspx) that handles the dragged item that displays when you click on the drag handle and start dragging?  I've been working on this for over 4 hours.....
If this helps at all, the listview is placed inside a fieldset.  The dragged item displays behind that fieldset.

thanks for your time,
Mo
Top achievements
Rank 1
 answered on 19 Aug 2010
2 answers
120 views
I have a grid with multicolumn sorting enabled.  The user needs to be able to see what the currently selected sort order is.  I've created a button and attached the following javascript to execute via the onclientclick event.

It identifies the grid and the mastertableview with no trouble, but nothing is returned by the get_sortExpressions(), so the resulting message is empty.

What am I missing?

Thanks!

    function showSortOrder() {
      var grid = $find("<%=gridResults.ClientID %>")
      alert("Grid = " + grid);
      var mstrvw = grid.get_masterTableView();
      alert("mstrvw = " + mstrvw);
      var sortExpressions = grid.get_masterTableView().get_sortExpressions();
      alert("sortExpressions = " + sortExpressions);
      // alert("sortExpressions length = " + sortExpressions.length);
        
      var msg = "The current sort order is\n";
//      for (i = 0; i < sortExpressions.length; i++)
//        {
//          var expression = sortExpressions[i];
//          var fieldName = expression.get_fieldName();
//          var sortOrder = expression.get_sortOrder();
//          msg = msg + fieldName + " (" + sortOrder + ")\n"
//        }
      //      alert(msg);
      alert(msg + sortExpressions.toString());
    }
Steve LaForge
Top achievements
Rank 1
 answered on 18 Aug 2010
4 answers
309 views
I would like to clear the text of the combobox when the user presses the button to open the dropdown, but not when it opens of its own accord.  Is there a click event for the button that I can use, or some other way of achieving this?

John
John Hadjioannou
Top achievements
Rank 1
 answered on 18 Aug 2010
2 answers
152 views
Situation,
  I have a hierarchy grid where in the nested grid a link pops up a modal pop-up so the user can edit all of the contents of the object, the nested grid only shows a selected portion.  upon saving all is good except the nested grid, I cannot seem to figure out how to refresh it, unless I reload the entire page which I guess would work but not preferable.  would like to just refresh the nested grid but will settle for the whole grid if need be.


Aspx Code:

<asp:UpdatePanel ID="upnlGrid" runat="server" UpdateMode="Conditional"> 
<ContentTemplate> 
    <telerik:RadGrid ID="UnitList" runat="server" AutoGenerateColumns="False"  
        DataSourceID="UnitDataSource" GridLines="None"   
         Skin="Windows7"> 
<MasterTableView datakeynames="Id" datasourceid="UnitDataSource"> 
    <DetailTables> 
        <telerik:GridTableView runat="server" DataKeyNames="Id"  
            CssClass="GridBackground"> 
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px" /> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px" /> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridTemplateColumn DataField="Title" HeaderText="Title"  
                    UniqueName="LTitle"> 
                    <ItemTemplate> 
                        <asp:LinkButton ID="lbtnLTitle" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Id")%>' runat="server" OnClick="lbtnLTitle_Click" Text='<%# DataBinder.Eval(Container.DataItem, "Title") %>'></asp:LinkButton> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridBoundColumn DataField="Presenter" HeaderText="Presenter"  
                    UniqueName="LPresenter"> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Location" HeaderText="Location"  
                    UniqueName="LLocation"> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Hours" HeaderText="Hours"  
                    UniqueName="LHours"> 
                </telerik:GridBoundColumn> 
                <telerik:GridCheckBoxColumn DataField="IsActive" DataType="System.Boolean"  
                    HeaderText="Active" UniqueName="LIsActive"> 
                </telerik:GridCheckBoxColumn> 
            </Columns> 
        </telerik:GridTableView> 
    </DetailTables> 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
<ExpandCollapseColumn visible="True"> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
    <Columns> 
        <telerik:GridTemplateColumn DataField="Title" HeaderText="Title"  
            UniqueName="UTitle"> 
             <ItemTemplate> 
                        <asp:LinkButton ID="lbtnUTitle" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Id")%>' runat="server" OnClick="lbtnUTitle_Click" Text='<%# DataBinder.Eval(Container.DataItem, "Title") %>'></asp:LinkButton> 
                    </ItemTemplate> 
        </telerik:GridTemplateColumn> 
        <telerik:GridBoundColumn DataField="OfferDept" HeaderText="Offer Dept."  
            UniqueName="UOfferDept"> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Semester" HeaderText="Semester"  
            UniqueName="USemester"> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Type" HeaderText="Type" UniqueName="UType"> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="StudentVuNetId" HeaderText="Student Id"  
            UniqueName="UStudentVuNetId"> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Hours" HeaderText="Hours"  
            UniqueName="UHours"> 
        </telerik:GridBoundColumn> 
        <telerik:GridCheckBoxColumn DataField="IsActive" DataType="System.Boolean"  
            HeaderText="Active" UniqueName="UIsActive"> 
        </telerik:GridCheckBoxColumn> 
    </Columns> 
</MasterTableView> 
    </telerik:RadGrid> 
    <asp:ObjectDataSource ID="UnitDataSource" runat="server"  
        SelectMethod="GetAllUnits"  
        TypeName="Vanderbilt.CpmmProg.CommonUtils.UnitManagement"> 
    </asp:ObjectDataSource> 
</ContentTemplate> 
</asp:UpdatePanel>   


C# Code:
protected void Page_Load(object sender, EventArgs e) 
        { 
             
            //attach the event to build the nested grid 
            UnitList.DetailTableDataBind += new GridDetailTableDataBindEventHandler(UnitList_DetailTableDataBind); 
             
            if (!Page.IsPostBack) 
            { 
                //do some stuff not related to grid at all 
            } 
        } 
 
 
        protected void UnitList_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e) 
        { 
            int unitId = (int)e.DetailTableView.ParentItem.GetDataKeyValue("Id"); 
            e.DetailTableView.DataSource = UnitManagement.GetUnitLectures(unitId); 
        } 
 
        protected void lbtnLTitle_Click(object sender, EventArgs e) 
        { 
            int Id = Int32.Parse(((LinkButton)sender).CommandArgument.ToString().Trim()); 
             
            //TODO Get data for lecture, populate the updatePanel for editing lectures 
            Lecture lec = LectureManagement.GetLecture(Id); 
            tbTitle.Text = lec.Title; 
            tbPresenter.Text = lec.Presenter; 
            tbLocation.Text = lec.Location; 
            tbHours.Text = lec.Hours.ToString(); 
            tbCourseAdminVuNetId.Text = lec.CourseAdminVuNetId; 
            rdtpTime.SelectedDate = lec.DateAndTime; 
            hfEditLecId.Value = lec.Id.ToString(); 
            cbIsActive.Checked = lec.IsActive; 
            //TODO show modal popup. 
            hfEditLectureDummy_ModalPopupExtender.Show(); 
        } 
 
 
 
        protected void lbtnUTitle_Click(object sender, EventArgs e) 
        { 
             //redirect to another page 
        } 
 
        protected void btnEditCancel_Click(object sender, EventArgs e) 
        { 
            //hide the modal popup 
            hfEditLectureDummy_ModalPopupExtender.Hide(); 
        } 
 
        protected void btnEditSave_Click(object sender, EventArgs e) 
        { 
            //get the lecture 
            //save the lecture to persistence 
 
            //hide modal popup 
            hfEditLectureDummy_ModalPopupExtender.Hide(); 
 
            //update the updatepanel 
            upnlGrid.Update(); 
        } 


thanks,
jms
jms
Top achievements
Rank 1
 answered on 18 Aug 2010
2 answers
84 views
Hi

I would like to know if the add button that appears in the radgrid can be used in other parts of a web page? For instance when you edit a row in the radGrid or Add a new record, I would like to be able to have an add button next to some of the drop downs that may appear in the details section of the radGrid. I would like to use the add button of the current skin

Thanks
drizzo
Dan
Top achievements
Rank 1
 answered on 18 Aug 2010
2 answers
158 views
Hi there

We are creating a site which uses the Docks and Zones from Telerik.

So far we have based our testing on an example provided to use from you guys - 162243_savedockstatedbloadingpanel.vb

Initially we were only concerned with loading dock states from the db - which works very well.

We are now trying to use the 'Add Dock' functionality but have hit a couple of problems....

1> There is a function in the Telerik example:

 

 

Public Function GetZones() As ArrayList

 

 

 

Dim zones As New ArrayList()

 

zones.Add(RadDockZone1)

zones.Add(RadDockZone2)

 

 

Return zones

 

 

 

End Function

 


Although this works in the example when we try to replicate it in our tests this does not populate the drop down list??

2> The save function.....

Protected

 

 

Sub ButtonAddDock_Click(ByVal sender As Object, ByVal e As EventArgs)

 

 

 

Dim dock As RadDock = CreateRadDock()

 

 

 

'find the target zone and add the new dock there

 

 

 

Dim dz As RadDockZone = DirectCast(FindControl(DropDownZone.SelectedItem.Text), RadDockZone)

 

dz.Controls.Add(dock)

CreateSaveStateTrigger(dock)

 

 

'Load the selected widget in the RadDock control

 

dock.Tag = DroptDownWidget.SelectedValue

LoadWidget(dock)

 

 

ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "MoveDock", String.Format("function _moveDock() {{" & vbCr & vbLf & vbTab & vbTab & vbTab & " " & vbTab & "Sys.Application.remove_load(_moveDock);" & vbCr & vbLf & vbTab & vbTab & vbTab & vbTab & " $find('{1}').dock($find('{0}'),{2});" & vbCr & vbLf & vbTab & vbTab & vbTab & " }};" & vbCr & vbLf & vbTab & vbTab & vbTab & " Sys.Application.add_load(_moveDock);", dock.ClientID, DropDownZone.SelectedValue, dz.Docks.Count), True)

 

 

 

End Sub

 


 ...throws an error on this line:

Dim dz As RadDockZone = DirectCast(FindControl(DropDownZone.SelectedItem.Text), RadDockZone)

 

 
saying it cant find the RadDockZone.

Again this works fine on your example but not in our tests.

If I hard code the above line. for example: Dim dz As RadDockZone = RadDockZone1

then it finds the zone but then throws an exception when '$find('{1}').dock($find('{0}'),{2});" ' is called.

It would appear the 2 issues are related and are not due to bad or wrong coding. I think its a page lifecycle issue but cant seem to get to the bottom of it.

Can you help please as we are 90% towards achieving the required functionality.

Shown below is the ASPX and ASPX.VB files...............

-------------------------------------------------------------------------------------------------------
TESTCONTROLPANEL.ASPX

<%

 

@ Page Title="" Language="vb" AutoEventWireup="true" MasterPageFile="~/App_Templates/IFM.Master" CodeBehind="Test Control Panel.aspx.vb" Inherits="IFM_Code_Testing.Test_Control_Panel" ClassName="Test_Control_Panel" %>

 

<%

 

@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

 

<%

 

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

<

 

 

asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

 

 

 

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

 

 

 

<script type="text/javascript">

 

 

 

var currentLoadingPanel = null;

 

 

 

var currentUpdatedControl = null;

 

 

 

function RequestStart(sender, args) {

 

currentLoadingPanel = $find(

 

"LoadingPanel1");

 

currentUpdatedControl =

 

"TableLayout";

 

currentLoadingPanel.show(currentUpdatedControl);

}

 

 

function ResponseEnd() {

 

 

 

//hide the loading panel and clean up the global variables

 

 

 

if (currentLoadingPanel != null)

 

currentLoadingPanel.hide(currentUpdatedControl);

currentUpdatedControl =

 

null;

 

currentLoadingPanel =

 

null;

 

}

 

 

</script>

 

 

 

</telerik:RadCodeBlock>

 

</

 

 

asp:Content>

 

<

 

 

asp:Content ID="Content2" ContentPlaceHolderID="ControlPanelHolder" runat="server">

 

<

 

 

div id="ControlPanel">

 

 

 

<asp:Panel ID="TitlePanel" runat="server" >

 

 

 

<asp:Image ID="Image2" runat="server" ImageUrl="~/images/collapse_blue.jpg"/>&nbsp;&nbsp;

 

 

 

<asp:Label ID="Label1" runat="server">Show Control Panel</asp:Label>

 

 

 

</asp:Panel>

 

 

 

<asp:Panel ID="ContentPanel" runat="server" CssClass="ContentPanel" >

 

 

 

<div class="module">

 

Select Module:

 

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

 

 

 

<asp:DropDownList runat="server" ID="DroptDownWidget" Width="150">

 

 

 

<asp:ListItem Text="ExchangeRates.ascx" Value="~/Controls/ExchangeRates.ascx" Selected="True"></asp:ListItem>

 

 

 

<asp:ListItem Text="Horoscopes.ascx" Value="~/Controls/Horoscopes.ascx"></asp:ListItem>

 

 

 

<asp:ListItem Text="News.ascx" Value="~/Controls/News.ascx"></asp:ListItem>

 

 

 

<asp:ListItem Text="Weather.ascx" Value="~/Controls/Weather.ascx"></asp:ListItem>

 

 

 

</asp:DropDownList>

 

 

 

<br />

 

Select Docking Zone:

 

 

<asp:DropDownList ID="DropDownZone" runat="server" >

 

 

 

<asp:ListItem Text="RadDockZone1" Value="RadDockZone1" Selected="True"></asp:ListItem>

 

 

 

<asp:ListItem Text="RadDockZone2" Value="RadDockZone2"></asp:ListItem>

 

 

 

<asp:ListItem Text="RadDockZone3" Value="RadDockZone3"></asp:ListItem>

 

 

 

 

</asp:DropDownList>

 

 

 

<br />

 

 

 

<br />

 

 

 

<asp:Button runat="server" CssClass="button" ID="ButtonAddDock" Text="Add Dock (AJAX)"

 

 

 

OnClick="ButtonAddDock_Click" />

 

 

 

</div>

 

 

 

</asp:Panel>

 

 

 

<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server"

 

 

 

TargetControlID="ContentPanel"

 

 

 

ExpandControlID="TitlePanel"

 

 

 

CollapseControlID="TitlePanel"

 

 

 

Collapsed="true"

 

 

 

AutoExpand="false" TextLabelID="Label1" ExpandedText="Hide Control Panel" CollapsedText="Show Control Panel" ImageControlID="Image2" CollapsedImage="~/images/collapse_blue.jpg" ExpandedImage="~/images/expand_blue.jpg">

 

 

 

</asp:CollapsiblePanelExtender>

 

 

 

 

</div>

 

</

 

 

asp:Content>

 

<

 

 

asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">

 

</

 

 

asp:Content>

 

<

 

 

asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

 

<

 

 

asp:Panel ID="Panel1" runat="server">

 

 

 

<telerik:RadDockLayout runat="server" ID="RadDockLayout1" OnSaveDockLayout="RadDockLayout1_SaveDockLayout"

 

 

 

OnLoadDockLayout="RadDockLayout1_LoadDockLayout" EnableEmbeddedSkins="true">

 

 

 

<table id="TableLayout">

 

 

 

<tr>

 

 

 

<td>

 

 

 

<telerik:RadDockZone runat="server" ID="RadDockZone1" Width="280" MinHeight="600">

 

 

 

</telerik:RadDockZone>

 

 

 

</td>

 

 

 

<td>

 

 

 

<telerik:RadDockZone runat="server" ID="RadDockZone2" Width="280" MinHeight="600">

 

 

 

</telerik:RadDockZone>

 

 

 

</td>

 

 

 

<td>

 

 

 

<telerik:RadDockZone runat="server" ID="RadDockZone3" Width="280" MinHeight="600">

 

 

 

</telerik:RadDockZone>

 

 

 

</td>

 

 

 

</tr>

 

 

 

</table>

 

 

 

</telerik:RadDockLayout>

 

 

 

</asp:Panel>

 

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="RequestStart"

 

 

 

ClientEvents-OnResponseEnd="ResponseEnd">

 

<%

 

-- <AjaxSettings>

 

<telerik:AjaxSetting AjaxControlID="ButtonAddDock" EventName="Click">

<UpdatedControls>

<telerik:AjaxUpdatedControl ControlID="Panel1" />

</UpdatedControls>

</telerik:AjaxSetting>

</AjaxSettings>--

 

 

%>

 

 

 

</telerik:RadAjaxManager>

 

 

</

 

 

asp:Content>

 


--------------------------------------------------------------------------------------------------------

TESTCONTROLPANEL.ASPX.VB...........

Public

 

 

Class Test_Control_Panel

 

 

 

Inherits System.Web.UI.Page

 

 

 

Private _conn As New SqlConnection(ConfigurationManager.ConnectionStrings("CONNSTRING").ConnectionString)

 

 

 

Private _userID As Integer = 999999

 

 

 

 

Private ReadOnly Property CurrentDockStates() As List(Of DockState)

 

 

 

Get

 

 

 

Dim dockStatesFromDB As String = ""

 

_conn.Open()

 

 

Dim command As New SqlCommand("select state from IFM_User_Page_Layout where UserID='" + _userID.ToString() + "'", _conn)

 

dockStatesFromDB = command.ExecuteScalar().ToString()

_conn.Close()

 

 

Dim _currentDockStates As New List(Of DockState)()

 

 

 

Dim stringStates As String() = dockStatesFromDB.Split("|"c)

 

 

 

For Each stringState As String In stringStates

 

 

 

If stringState.Trim() <> String.Empty Then

 

_currentDockStates.Add(

 

DockState.Deserialize(stringState))

 

 

 

End If

 

 

 

Next

 

 

 

Return _currentDockStates

 

 

 

End Get

 

 

 

End Property

 

 

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

 

 

 

If Not IsPostBack Then

 

 

 

End If

 

 

 

End Sub

 

 

 

Public Function GetZones() As ArrayList

 

 

 

Dim zones As New ArrayList()

 

zones.Add(RadDockZone1)

zones.Add(RadDockZone2)

 

 

Return zones

 

 

 

End Function

 

 

 

Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)

 

 

 

Dim i As Integer = 0

 

 

 

While i < CurrentDockStates.Count

 

 

 

If CurrentDockStates(i).Closed = False Then

 

 

 

Dim dock As RadDock = CreateRadDockFromState(CurrentDockStates(i))

 

CreateSaveStateTrigger(dock)

 

 

'Load the selected widget

 

LoadWidget(dock)

RadDockLayout1.Controls.Add(dock)

 

 

End If

 

System.

 

Math.Max(System.Threading.Interlocked.Increment(i), i - 1)

 

 

 

End While

 

 

 

End Sub

 

 

 

Protected Sub RadDockLayout1_LoadDockLayout(ByVal sender As Object, ByVal e As DockLayoutEventArgs)

 

 

 

For Each state As DockState In CurrentDockStates

 

e.Positions(state.UniqueName) = state.DockZoneID

e.Indices(state.UniqueName) = state.Index

 

 

Next

 

 

 

End Sub

 

 

 

Protected Sub RadDockLayout1_SaveDockLayout(ByVal sender As Object, ByVal e As DockLayoutEventArgs)

 

 

 

Dim stateList As List(Of DockState) = RadDockLayout1.GetRegisteredDocksState()

 

 

 

Dim serializedList As New StringBuilder()

 

 

 

Dim i As Integer = 0

 

 

 

While i < stateList.Count

 

serializedList.Append(stateList(i).ToString())

serializedList.Append(

 

"|")

 

System.

 

Math.Max(System.Threading.Interlocked.Increment(i), i - 1)

 

 

 

End While

 

 

 

Dim dockState As String = serializedList.ToString()

 

 

 

If dockState.Trim() <> [String].Empty Then

 

_conn.Open()

 

 

Dim command As New SqlCommand([String].Format("update IFM_User_Page_Layout set state='{0}' where UserID='" + _userID.ToString() + "'", dockState), _conn)

 

command.ExecuteNonQuery()

_conn.Close()

 

 

End If

 

 

 

End Sub

 

 

 

Private Function CreateRadDockFromState(ByVal state As DockState) As RadDock

 

 

 

Dim dock As New RadDock()

 

dock.DockMode =

 

DockMode.Docked

 

dock.ID =

 

String.Format("RadDock{0}", state.UniqueName)

 

dock.ApplyState(state)

dock.Commands.Add(

 

New DockCloseCommand())

 

dock.Commands.Add(

 

New DockExpandCollapseCommand())

 

 

 

Return dock

 

 

 

End Function

 

 

 

Private Function CreateRadDock() As RadDock

 

 

 

Dim docksCount As Integer = CurrentDockStates.Count

 

 

 

Dim dock As New RadDock()

 

dock.DockMode =

 

DockMode.Docked

 

dock.UniqueName =

 

Guid.NewGuid().ToString()

 

dock.ID =

 

String.Format("RadDock{0}", dock.UniqueName)

 

dock.Title =

 

"Dock"

 

dock.Text =

 

String.Format("Added at {0}", DateTime.Now)

 

dock.Width =

 

Unit.Pixel(300)

 

dock.Commands.Add(

 

New DockCloseCommand())

 

dock.Commands.Add(

 

New DockExpandCollapseCommand())

 

 

 

Return dock

 

 

 

End Function

 

 

 

Private Sub CreateSaveStateTrigger(ByVal dock As RadDock)

 

dock.AutoPostBack =

 

True

 

dock.CommandsAutoPostBack =

 

True

 

 

 

Dim updatedControl As New AjaxUpdatedControl()

 

updatedControl.ControlID =

 

"Panel1"

 

 

 

Dim setting1 As New AjaxSetting(dock.ID)

 

setting1.EventName =

 

"DockPositionChanged"

 

setting1.UpdatedControls.Add(updatedControl)

 

 

Dim setting2 As New AjaxSetting(dock.ID)

 

setting2.EventName =

 

"Command"

 

setting2.UpdatedControls.Add(updatedControl)

RadAjaxManager1.AjaxSettings.Add(setting1)

RadAjaxManager1.AjaxSettings.Add(setting2)

 

 

End Sub

 

 

 

 

Protected Sub ButtonAddDock_Click(ByVal sender As Object, ByVal e As EventArgs)

 

 

 

Dim dock As RadDock = CreateRadDock()

 

 

 

'find the target zone and add the new dock there

 

 

 

Dim dz As RadDockZone = DirectCast(FindControl(DropDownZone.SelectedItem.Text), RadDockZone)

 

dz.Controls.Add(dock)

CreateSaveStateTrigger(dock)

 

 

'Load the selected widget in the RadDock control

 

dock.Tag = DroptDownWidget.SelectedValue

LoadWidget(dock)

 

 

ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "MoveDock", String.Format("function _moveDock() {{" & vbCr & vbLf & vbTab & vbTab & vbTab & " " & vbTab & "Sys.Application.remove_load(_moveDock);" & vbCr & vbLf & vbTab & vbTab & vbTab & vbTab & " $find('{1}').dock($find('{0}'),{2});" & vbCr & vbLf & vbTab & vbTab & vbTab & " }};" & vbCr & vbLf & vbTab & vbTab & vbTab & " Sys.Application.add_load(_moveDock);", dock.ClientID, DropDownZone.SelectedValue, dz.Docks.Count), True)

 

 

 

End Sub

 

 

 

Private Sub LoadWidget(ByVal dock As RadDock)

 

 

 

If String.IsNullOrEmpty(dock.Tag) Then

 

 

 

Return

 

 

 

End If

 

 

 

Dim widget As Control = LoadControl(dock.Tag)

 

dock.ContentContainer.Controls.Add(widget)

 

 

End Sub

 

 

 

 

 

End

 

 

Class

 



Geoff
Top achievements
Rank 1
 answered on 18 Aug 2010
1 answer
97 views
Good Day All

My datasource is a List as defined like this

public List<EAV> GetRecords(List<string> ParentRecords, List<string> ChildRecords)
{
    List<EAV> Final = new List<EAV>();
 
    for (int i = 0; i < ParentRecords.Count; i++)
    {
        //Put a check for child records exists and add
        Final.Add(new EAV(ParentRecords[i], ChildRecords[0]));
        //Start looping from 2nd J = 1 instead of 0
        for (int J = 1; J < ChildRecords.Count; J++)
        {
            //remove ParentRecords[i]
            Final.Add(new EAV("", ChildRecords[J]));
        }
    }
 
    return Final;
}

And as you can see it brings back a list. Now this will arrange everything in hiearchial form but i need to be able to collapse and uncollase the results , but now it shows in a Grid as normal data as depicted in the image below


Thanks



Schlurk
Top achievements
Rank 2
 answered on 18 Aug 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?