Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
526 views
Hi,
The following code can be used to get all the items in RadGrid [client side].

var masterTable = $find("<%= Radgrid1.ClientID %>").get_masterTableView();
var rows = masterTable.get_dataItems();

How can I get / traverse all the items in a grouping in RadGrid? [client side]. 

Thanks for your help.
http://www.megasearches.com/ 

Radoslav
Telerik team
 answered on 01 Jul 2015
1 answer
95 views

Sorry I wasn't in web development for years... so this mobile design trend is completely new to me.

Anyways, supposed I want to go with a 3 column design.  I want to be able to "minimize" the left column in XS or SM mode (so that I can make the column reappear by either clicking a tiny column, or swipe from the left bezel to screen.  Is this possible?

Magdalena
Telerik team
 answered on 01 Jul 2015
4 answers
226 views
Hi,

I'm converting a Radgrid to a TreeList (user wants to be able to expand/collapse) and I just discovered that the TreeList doesn't use the DataKeyNames the same way the RadGrid does. (I want to access some properties that are part of the query, but not shown in the TreeList).

I also discovered that the ClientDataKeyNames does work, so now I'm faced with converting some server-side code to client-side code.
But I can't get it to work.

On server-side I had this in the ItemDataBound event: (this was for the RadGrid)

If (e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("OPLEIDING_GEBIED_NIVEAU") > 0) Then
    CType(dataBoundItem.FindControl("chkIsBeroepsdeel"), CheckBox).Visible = False
End If

I've been trying to convert this to client-side code using the ItemCreated event:

function ItemCreated(sender, eventArgs) {
    var item = eventArgs.get_item();
 
    if (item.get_dataKeyValue("OPLEIDING_GEBIED_NIVEAU") > 0) {
        item.findControl("chkDoorrekenen").style.display = 'none';
    }
}
but this gives me an error message: 

JavaScript runtime error: Object doesn't support property or method 'findControl'

How can I do this client side?

Cheers,
CJ



Eyup
Telerik team
 answered on 01 Jul 2015
5 answers
159 views

Hello Telerik,

 

I am using ASP.Net Ajax Ribbon Bar control.

 

I am facing problem of flickering ribbon bar while refreshing.

My page completely loads in approximately 1 sec. Until the page is fully loaded, the Ribbon bar is partially created as attached image (on_page_loading.png).

And once the page is loaded, ribbon bar is completely created as attached image(after_page_load.png)

This happens at the time of page refresh as well as page postback.

I want ribbon bar to be created at once or at least appear only after it is completely created.

Please advise.

Ivan Zhekov
Telerik team
 answered on 01 Jul 2015
18 answers
123 views

Hi,

 I'm using a subclassed RadHtmlField field control on page layouts in a SharePoint 2013 environment to include the editor. Most of what I need works except for the following:

1. When I toggle to the full screen mode, selecting the 'Insert Link' option opens up the 'Select an Asset' SharePoint dialog. This all works fine, but when a selection is made & the dialog closes, the underlying RadEditor goes back to normal mode with the toggle full screen button depressed. This causes the page to sort of freeze until the full screen toggle button is raised again.

2. I add content such as this:

<div>
                                                        <div class="tile tile-image-top-left">
                                                            <div data-collapse="mobile" data-collapse-default="close">
                                                                <button data-collapse="control" data-desktop="exclude">Top Left</button>
                                                                <div data-collapse="content">
                                                                    <div class="tile-image">
                                                                        <img alt="Top Left" src="images/icon-tile-dummy-image.png" />
                                                                    </div>
                                                                    <div class="tile-title tile-title-background">
                                                                        <p>Top Left</p>
                                                                    </div>
                                                                    <div class="tile-description">
                                                                        <p>This demonstrates how a tile can be used for diplaying an image on the top left of the container. Any text around the tile image will wrap around the image associated with the tile.</p>
                                                                        <p>Additionally, the tile can contain HTML content including hyperlinks and other images if required.</p>
                                                                        <p><ul><li><a href="#">Browse to website 1</a></li></ul></p>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>

But the editor removes the <button> element. 

Here are the contents of the files that you might find useful:

Sub-classed class

public class CustomRadHtmlField : Telerik.SharePoint.FieldEditor.RadHtmlField
    {
        #region Protected Methods
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            ConfigureRadHtmlField();
        }
 
        protected override bool AllowFirstFocus { get { return false; } }
        #endregion
 
        #region Internal Methods
        internal static void ConfigureRadEditorControl(ref SPRadEditor editor)
        {
            editor.ConfigFile = "/_layouts/15/divportals/telerik/configfile.xml";
            editor.ToolsFile = "/_layouts/15/divportals/telerik/toolsfile.xml";
            editor.EnsureToolsFileLoaded();
            editor.ContentAreaMode = EditorContentAreaMode.Iframe;
 
            editor.EnableFilter(EditorFilters.ConvertTags );
            editor.DisableFilter(EditorFilters.EncodeScripts | EditorFilters.RemoveScripts);
            editor.EditModes = EditModes.All;
 
            editor.ToolbarMode = EditorToolbarMode.RibbonBarPageTop;
            editor.NewLineMode = EditorNewLineModes.Div;
            editor.ContextMenus.Clear();
            editor.EnableEmbeddedScripts = true;
            editor.EnableEmbeddedSkins = true;
        }
        #endregion
 
        #region Private Methods
        private void ConfigureRadHtmlField()
        {
            this.AllowScripts = false;
            this.AllowSpecialTags = false;
            this.AllowFonts = false;
 
            CustomRadHtmlField.ConfigureRadEditorControl(ref this.radEditorControl);
        }
        #endregion               
    }
 

ConfigFile.xml

<configuration>
  <property name="Skin">Default</property>
  <property name="ToolbarMode">Default</property>
  <property name="ContentAreaMode">IFRAME</property>
  <property name="DocumentsFilters">
    <item>*.*</item>
  </property>
  <property name="OnClientLoad">setAutoWidthForRadEditorControls</property>
  <property name="ImagesPaths">
    <item>SiteCollectionImages</item>
  </property>
  <property name="MaxDocumentSize">524288000</property>
  <property name="MaxImageSize">524288000</property>
  <property name="MaxFlashSize">524288000</property>
  <property name="MaxMediaSize">524288000</property>
  <property name="MaxSilverlightSize">524288000</property>
  <property name="StripFormattingOptions">MSWordRemoveAll,Css,Font</property>
</configuration>
 

setAutoWidthForRadEditorControls JavaScript function

function setAutoWidthForRadEditorControls() {
    // Set max width for all rad editor controls that appear in the main content place holder
    var radEditorControl = $(".radEditorControl");
    if (radEditorControl) {
        radEditorControl.find(".reContentArea").width(Math.ceil(radEditorControl.width() * 0.98));
    }
}

 

 

 

 

 

 

Ken
Top achievements
Rank 1
 answered on 01 Jul 2015
1 answer
55 views

hi,

     i have some textbox and one save button outside the radgrid. this controls are hided.

i need to enable this controls through Add new record icon click.

thanks & regards

karthik

Eyup
Telerik team
 answered on 01 Jul 2015
5 answers
202 views

Hi, 

 Dunno why, but the grid insert item and the update item templates styles are gone. the text became bold and the textboxes just stack on top of each other.

the only thing i did was adding bootstrap.css and .js to my project and used it on various pages without problems.

I am not using any divs or containers in the pages with the grid, so it's kinda strange.

I just have a top navbar recurring in all the pages (master). i suppose it might be a css problem.

Also, in a page with a treeview, but without any bootstrap code (except for the core link files css and js which are in the master pages) and the tree floats right, it didn't before.

 

here' a snapshot of a grid item in edit mode

 

http://snag.gy/1nxTp.jpg

CRISTINA
Top achievements
Rank 1
Iron
 answered on 01 Jul 2015
1 answer
89 views

Hi,

My code can run  at 2015 Q1

But it upgrade to 2015 Q2 after,it can not run,exception below

Server Error in '/' Application.Value cannot be null.
Parameter name: keyDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
 
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: key
 
Source Error:
 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
 
[ArgumentNullException: Value cannot be null.
Parameter name: key]
System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +11032629
System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value) +12
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.GetLiteralTraceData(LiteralControl literal, TraceData& data) +47
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.GetTraceData(Object renderedObject) +259
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.EndRendering(TextWriter writer, Object renderedObject) +35
System.Web.UI.RenderTraceListenerList.EndRendering(TextWriter writer, Object renderedObject) +58
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +142
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.WebControls.TableCell.RenderContents(HtmlTextWriter writer) +31
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.WebControls.Table.RenderContents(HtmlTextWriter writer) +9590815
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.WebControls.TableCell.RenderContents(HtmlTextWriter writer) +31
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
Telerik.Web.UI.GridMultiRowItem.Render(HtmlTextWriter writer) +208
Telerik.Web.UI.GridTFoot.Render(HtmlTextWriter writer) +4
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
Telerik.Web.UI.GridTable.RenderContents(HtmlTextWriter writer) +674
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
Telerik.Web.UI.GridTable.Render(HtmlTextWriter writer) +2931
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
Telerik.Web.UI.GridTableViewBase.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
Telerik.Web.UI.RadCompositeDataBoundControl.RenderContents(HtmlTextWriter writer) +20
Telerik.Web.UI.RadGrid.RenderContents(HtmlTextWriter writer) +56
Telerik.Web.UI.GridBaseDataList.Render(HtmlTextWriter writer) +100
Telerik.Web.UI.RadGrid.Render(HtmlTextWriter writer) +130
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
Telerik.Web.UI.RadAjaxPanel.RenderChildren(HtmlTextWriter writer) +157
Telerik.Web.UI.RadAjaxPanel.RenderContents(HtmlTextWriter writer) +27
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
Telerik.Web.UI.RadAjaxPanel.Render(HtmlTextWriter writer) +33
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
Telerik.Web.UI.ControlRenderer.Render(HtmlTextWriter writer) +118
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.UpdatePanel.RenderChildren(HtmlTextWriter writer) +243
System.Web.UI.UpdatePanel.Render(HtmlTextWriter writer) +38
Telerik.Web.UI.OurUpdatePanel.Render(HtmlTextWriter writer) +201
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
Telerik.Web.UI.PreControlToAjaxify.Render(HtmlTextWriter writer) +114
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +102
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +788
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +268
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386

@aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="THS.ERP.MM.UI.Setup.WebForm2" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
     
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
        <div>
 
            <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
                <telerik:RadGrid ID="RadGrid1"
                    ShowGroupPanel="true"
                    AllowFilteringByColumn="true"
                    ShowStatusBar="true" runat="server"
                    AllowCustomPaging="true"
                    AllowPaging="true"
                    AllowSorting="true"
                    VirtualItemCount="100000"
                    OnNeedDataSource="RadGrid1_NeedDataSource">
                    <ClientSettings AllowDragToGroup="true">
                    </ClientSettings>
                    <MasterTableView TableLayout="Fixed"></MasterTableView>
                </telerik:RadGrid>
            </telerik:RadAjaxPanel>
        </div>
    </form>
</body>
</html>

 

@cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace THS.ERP.MM.UI.Setup
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
 
        protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            MyBusinessObjectCollection MyBusinessObjectCollection1 = new MyBusinessObjectCollection();
            int startRowIndex = (ShouldApplySortFilterOrGroup()) ?
                0 : RadGrid1.CurrentPageIndex * RadGrid1.PageSize;
 
            int maximumRows = (ShouldApplySortFilterOrGroup()) ?
                MyBusinessObjectCollection1.SelectCount() : RadGrid1.PageSize;
 
            RadGrid1.AllowCustomPaging = !ShouldApplySortFilterOrGroup();
 
            RadGrid1.DataSource = MyBusinessObjectCollection1.Select(startRowIndex, maximumRows);
        }
 
        private bool isGrouping = false;
 
        public bool ShouldApplySortFilterOrGroup()
        {
            return RadGrid1.MasterTableView.FilterExpression != "" ||
                (RadGrid1.MasterTableView.GroupByExpressions.Count > 0 || isGrouping) ||
                RadGrid1.MasterTableView.SortExpressions.Count > 0;
        }
    }
}

小章
Top achievements
Rank 1
 answered on 01 Jul 2015
1 answer
72 views

Hi

I have a page which contains a grid of properties (all managed by one letting agency). I have another page which contains a grid of tenants (all of the tenants in properties managed by the letting agency). Both grids work perfectly and I am using an embedded form on each to provide insert/updates for both the properties and the tenants.

I have a situation where I want to be able to make the NAME of the tenant clickable on the PROPERTY screen and take the user to the Tenant Management Screen with the tenant they clicked in EDIT MODE.

I've worked out how to get the correct hyperlink in the format http://localhost/data_tenantmanagement.aspx?action=edit&id=TENANT_ID

My tenant management grid has filters and tooltips so that when someone hovers over the name it pops out contact details. The TenantPerson table has an ID number (primary key) and the Property record has a field called TENANTID which maps to the tenant living in it.

This code is in data_tenantmanagement.aspx.vb:

 

    Public Function GetDataTable(ByVal query As String) As DataTable
        Dim ConnString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
        Dim conn As SqlConnection = New SqlConnection(ConnString)
        Dim adapter As SqlDataAdapter = New SqlDataAdapter
        adapter.SelectCommand = New SqlCommand(query, conn)
        Dim table1 As New DataTable
        conn.Open()
        Try
            adapter.Fill(table1)
        Finally
            conn.Close()
        End Try
        Return table1
    End Function

    Public ReadOnly Property TheseTenants() As DataTable
        Get
            Dim obj As Object = Me.Session("TheseTenants")
            If (Not obj Is Nothing) Then
                Return CType(obj, DataTable)
            End If
            Dim myDataTable As DataTable = New DataTable
            myDataTable = GetDataTable("SELECT * FROM TenantPerson")
            Me.Session("TheseTenants") = myDataTable
            Return myDataTable
        End Get
    End Property

    Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
        Me.RadGrid1.DataSource = Me.TheseTenants
        Me.TheseTenants.PrimaryKey = New DataColumn() {Me.TheseTenants.Columns("Id")}
    End Sub

    Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender
        If Not IsPostBack And Me.RadGrid1.MasterTableView.Items.Count > 0 Then
            RadGrid1.EditIndexes.Clear()
            Me.Session("TheseTenants") = Nothing
            RadGrid1.DataSource = TheseTenants
            RadGrid1.DataBind()
        End If
    End Sub

 I guess I need:

 1. Generate the hyperlink from the PROPERTY screen to the TENANT screen with an action (edit) and an ID (the tenant ID).

2. Open the data_tenantmanagement.aspx page and somewhere read the ID of the tenant being passed in.

3. Find the row corresponding to the required tenant.

4. Open the row in Edit Mode.

The bit of the grid with the EDIT is this (ignore the drag and drop stuff):

<EditColumn FilterControlAltText="Filter EditCommandColumn1 column" UniqueName="EditCommandColumn1">
                                </EditColumn>
                                <FormTemplate>
                                <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" AutoTooltipify="True" Position="MiddleRight" RelativeTo="Element"></telerik:RadToolTipManager>
                                    <div class="widget">
                                    <header>
                                        <div class="pull-left">
                                            <h2>
                                                <asp:Literal ID="litControlTitle" runat="server"></asp:Literal>
                                                    </h2>
                                                </div>
                                            </header>
                                        <div class="inner-padding">
                                        <div class="row">
                                            <div class="col-sm-2">
                                                <label for="txtDisplayName">
                                                    Display Name:
                                                        </label>
                                                    </div>
                                                <div class="col-sm-2">
                                               <Telerik:RadTextBox skin="Bootstrap"  ID="txtDisplayName" runat="server" ToolTip="Enter the display name here (this will appear in drop down lists referring to this entity) - REQUIRED." />
                                            
                                                </div>
                                                </div>
                                            <div class="row">
                                            <div class="col-sm-2">
                                                <label for="lstPeople">
                                                    People:
                                                        </label>
                                                
                                                    <telerik:RadComboBox ID="drpPeopleSearch" runat="server" Width="200px" Height="400px"
                                                    EmptyMessage="Type a name..." ClientIDMode="Static" AllowCustomText="true" AutoCompleteSeparator="|" Filter="Contains" MarkFirstMatch="True" onclientselectedindexchanged="OnClientSelectedIndexChanged" DropDownWidth="250px" ToolTip="Start typing a name and click the one you need when it is showing." Skin="Web20">
                                                                         </telerik:RadComboBox>
                                                
                                                </div>
                                                <div class="col-sm-2">
                                                <label for="lstTenant">
                                                    Tenant Object:
                                            
                                                    </label>
                                                
                                                </div>
                                                <div class="col-sm-2">
                                                <label for="txtLeadTenant">
                                                    Lead Tenant Person:
                                                        </label>
                                                    </div>
                                                <div class="col-sm-4">
                                                <div class="row">
                                                
                                                        <asp:Button ID="btnUpdate" runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>' CssClass="btn btn-primary" ValidationGroup="EditFormGroup" CausesValidation="True" ToolTip="Click this button to update or insert an entity." />
                                                        &nbsp;
                                                        <asp:Button ID="btnCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" CssClass="btn btn-default" ToolTip="Click this button to cancel out of the insert/edit form." />
                                                        <asp:TextBox ID="txtid" runat="server" Text="" style="visibility: hidden;" />
                                                        </div>
                                                    <div class="spacer-20"></div>
                                                    <div class="row">
                                                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="EditFormGroup" Visible="False" CssClass="alert alert-danger" />
                                                        <asp:RequiredFieldValidator ValidationGroup="EditFormGroup" ID="RequiredFieldValidator1" runat="server" ErrorMessage="You must enter a display name." Text="" ClientIDMode="Static"  ControlToValidate="txtDisplayName" SetFocusOnError="True" Display="Dynamic" Visible="True"></asp:RequiredFieldValidator>
                                                        <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtNumberOfTenants" Text="" ErrorMessage="You must have at least one legal person in the Tenant Object." MaximumValue="4" MinimumValue="1" Type="Integer" ValidationGroup="EditFormGroup" Display="Dynamic" Visible="True"></asp:RangeValidator>
                                                        <asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="txtNumberOfLeadTenants" Text="" ErrorMessage="You must have a lead tenant defined." MaximumValue="1" MinimumValue="1" Type="Integer" ValidationGroup="EditFormGroup" Display="Dynamic" Visible="True"></asp:RangeValidator>
                                                        </div>
                                                    </div>
                                                </div>

                                            <div class="row">
                                            <div class="col-sm-2">
                                                <telerik:RadListBox ID="lstPeople" runat="server" AllowTransfer="True" ButtonSettings-ShowDelete="False" ButtonSettings-ShowReorder="False" ButtonSettings-ShowTransferAll="False" ButtonSettings-TransferButtons="TransferFrom" CausesValidation="False" Culture="en-GB" EnableDragAndDrop="True" Height="200px" Skin="Bootstrap" TransferMode="Copy" Width="200px" TransferToID="lstTenant" AllowTransferOnDoubleClick="True" AutoPostBackOnTransfer="False" OnClientTransferred="onClientTransferredHandlerLstTenant" OnClientTransferring="onClientTransferringHandlerLstTenant" ClientIDMode="Static" ToolTip="Drag a name from here to the Tenant Object. You can filter this list using the box above.">
                                                    </telerik:RadListBox>
                                                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ABBEYMOVEConnectionString %>" SelectCommand="SELECT [Id], [LegalName] FROM [LegalPerson]"></asp:SqlDataSource>
                                                    </div>
                                                <div class="col-sm-2">
                                                        
                                                    <telerik:RadListBox ID="lstTenant" runat="server" AllowDelete="true" AllowReorder="true" AllowTransfer="True" CausesValidation="False" Culture="en-GB" EnableDragAndDrop="true" Height="200px" Skin="Bootstrap" TransferMode="Copy" TransferToID="lstLeadTenant" Width="200px" OnClientDeleted="onClientDeletedTenantHandler" AllowTransferOnDoubleClick="True" OnClientTransferred="onClientTransferredHandlerLstLeadTenant" ClientIDMode="Static"
                                                    OnClientTransferring="onClientTransferringHandlerLstLeadTenant" ButtonSettings-ShowTransferAll="False" ButtonSettings-TransferButtons="TransferFrom" ToolTip="Drag a person from here to the Lead Tenant box to the right.">
                                                                        </telerik:RadListBox>
                                                    <asp:TextBox ID="txtNumberOfTenants" runat="server" CausesValidation="True" ValidationGroup="EditFormGroup" ClientIDMode="Static" TextMode="Number" style="visibility: hidden;"></asp:TextBox>
                                                
                                                </div>
                                                <div class="col-sm-2">
                                            
                                                    <telerik:RadListBox ID="lstLeadTenant" runat="server" AllowDelete="true" AutoPostBackOnDelete="False" CausesValidation="False" Culture="en-GB" EnableDragAndDrop="true" Height="200px" Skin="Bootstrap" Width="200px" OnClientDeleted="onClientDeletedLeadTenantHandler" ClientIDMode="Static" ToolTip="Use the delete button if you want to change the lead tenant person.">
                                                    </telerik:RadListBox>
                                                    <asp:TextBox ID="txtNumberOfLeadTenants" runat="server" CausesValidation="True" text="0" ValidationGroup="EditFormGroup" TextMode="Number" style="visibility: hidden;"></asp:TextBox>
                                                    
                                                </div>
                                                
                                            </div>
                                                    
                                        </div>
                                                    
                                    </div>

                                    </div>
                                                
                                    </div>
                                    </FormTemplate>
                                </EditFormSettings>

Any help would be appreciated as I've got to do this in several places (such as Owners, Landlords, etc.) - it's probably simple but I cannot work out where to put the bit that will actually do what I need. Of course, if request.querystring("action") isn't EDIT then I'd just want the grid to display as usual BUT if possible can I also throw action=NEW at it and put it in Insert Mode (or is that too much to ask).....

 Thanks!

 

 

Pavlina
Telerik team
 answered on 30 Jun 2015
1 answer
106 views

Dear All,

I want to bind the RadTabStrip from database means it should be dynamic.

Can anyone please tell me how to bind the RadTabStrip from database ?

 

Thanks,

Harish Patil

Ivan Danchev
Telerik team
 answered on 30 Jun 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?