Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
164 views
Im binding this

<telerik:RadListView runat="server" ID="rlvMyTaxReportsCustomization"
        onitemdrop="rlvMyTaxReportsCustomization_ItemDrop">
    <ClientSettings AllowItemsDragDrop="true">
        <ClientEvents OnItemDropping="reportDropping" />
    </ClientSettings>
    <LayoutTemplate>
        <ul id="ulMyTaxReportsCustomization" runat="server" class="noBullet">
            <li id="itemPlaceHolder" runat="server"></li>
        </ul>
    </LayoutTemplate>
    <ItemTemplate>
        <li id="liMyTaxReportsCustomization" runat="server">
            <asp:CheckBox ID="MyTaxReportsCustomizationHidden" runat="server" text="Hide" Checked='<%#Eval("hidden").ToString().Equals("1") %>' CssClass="cbHide" />
            <div id="divMyTaxReportsCustomization" class="rlvI" runat="server">
                <div class="rlvDrag" onmousedown="Telerik.Web.UI.RadListView.HandleDrag(event, '<%# Container.OwnerListView.ClientID %>', <%# Container.DisplayIndex%>)">                                              
                    <asp:LinkButton ID="lkbMyTaxReportsCustomization" runat="server" CssClass="aCont">
                        <%#Eval("name") %>
                        <asp:Label ID="lblMyTaxReportsCustomizationFrom" runat="server" Text='<%#Eval("from"," (from {0} )") %>' ></asp:Label>
                    </asp:LinkButton>
                </div>
            </div>
        </li>
    </ItemTemplate>
</telerik:RadListView>

with this CSS

.rlvI
{
    display:block;
}
 
.rlvDrag
{
    display:block;
}
 
.cbHide
{
    float:right;
}
 
.aCont
{
    display:block;
    text-decoration:none;
}
 
.noBullet
{
    list-style-type: none;
    padding: 0;
    margin-left: 0;
}


and Im getting the result in the attached image.

The obvious thing I am looking for is a hide checkbox align to the right and I tried this in a static <ul><li> schema and also in a normal ASP.NET ListView and they displayed as I was lloking for... I know this could be an issue, but could you lend me a hand to make it look as I want to?? it is really important, or maybe if there is a fix for this...

Thanks in advance,

Camilo
Mira
Telerik team
 answered on 07 Mar 2011
1 answer
257 views

Requirements

RadControls version

V.2010.3.1215.35
.NET version

3.5
Visual Studio version

2008 SP1
programming language

VB.Net
browser support

all browsers supported by RadControls


PROJECT DESCRIPTION
[This projects shows major javascript adjustments to a radgrid. It shows how to filter a grid onkeypress so when the user types something into the filter, it will filter by a default filter type that you have set. If they want a specific filter type other than that one, then they must select it using the filter button (the conventional way). It also shows how to avoid javascript errors for columns without filters and for datecolumns so you wont filter an incorrect date.  Hope this is helpful.]



<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <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:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="rlpProgress" ClientEvents-OnRequestStart="request">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadTabStrip1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
            <telerik:AjaxUpdatedControl ControlID="rmp1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rmp1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
            <telerik:AjaxUpdatedControl ControlID="rmp1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
</telerik:RadAjaxManager>
 
 
    <telerik:RadAjaxLoadingPanel ID="rlpProgress" runat="server" Skin="Default" BackgroundPosition="Center" />
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="rmp1">
        <Tabs>
            <telerik:RadTab Text="tab 1" Value="1" PageViewID="rpv1" Selected="true">
            </telerik:RadTab>
            <telerik:RadTab Text="tab 2" Value="2" PageViewID="rpv2">
            </telerik:RadTab>
            <telerik:RadTab Text="tab 3" Value="3" PageViewID="rpv3">
            </telerik:RadTab>
            <telerik:RadTab Text="tab 4" Value="4" PageViewID="rpv4">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="rmp1" runat="server">
        <telerik:RadPageView ID="rpv1" runat="server" Selected="true">
            <h1>
                Grid 1</h1>
            <telerik:RadGrid ID="grid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
                AllowSorting="True">
                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                </HeaderContextMenu>
                <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID">
                    <CommandItemSettings ExportToPdfText="Export to Pdf" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" SortExpression="ID"
                            UniqueName="ID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Name" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Name column"
                            HeaderText="Name" SortExpression="Name" UniqueName="Name">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Address column"
                            HeaderText="Address" SortExpression="Address" UniqueName="Address">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="City" FilterListOptions="VaryByDataType" FilterControlAltText="Filter City column"
                            HeaderText="City" SortExpression="City" UniqueName="City">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="State" FilterListOptions="VaryByDataType" FilterControlAltText="Filter State column"
                            HeaderText="State" SortExpression="State" UniqueName="State">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ZipCode" FilterListOptions="VaryByDataType" FilterControlAltText="Filter ZipCode column"
                            HeaderText="ZipCode" SortExpression="ZipCode" UniqueName="ZipCode">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="PhoneNo" FilterListOptions="VaryByDataType" FilterControlAltText="Filter PhoneNo column"
                            HeaderText="PhoneNo" SortExpression="PhoneNo" UniqueName="PhoneNo">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Email" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Email column"
                            HeaderText="Email" SortExpression="Email" UniqueName="Email">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Comments" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter Comments column" HeaderText="Comments" SortExpression="Comments"
                            UniqueName="Comments">
                        </telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn DataField="DateEntered" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter DateEntered column" HeaderText="DateEntered" ReadOnly="True"
                            SortExpression="DateEntered" UniqueName="DateEntered" DataType="System.DateTime"
                            DataFormatString="{0:MM/dd/yyyy}">
                        </telerik:GridDateTimeColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <GroupingSettings CaseSensitive="false" />
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
            </telerik:RadGrid>
        </telerik:RadPageView>
        <telerik:RadPageView ID="rpv2" runat="server">
            <h1>
                Grid 2</h1>
            <telerik:RadGrid ID="grid2" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
                AllowSorting="True">
                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                </HeaderContextMenu>
                <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID">
                    <CommandItemSettings ExportToPdfText="Export to Pdf" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" SortExpression="ID"
                            UniqueName="ID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Name" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Name column"
                            HeaderText="Name" SortExpression="Name" UniqueName="Name">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Address column"
                            HeaderText="Address" SortExpression="Address" UniqueName="Address">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="City" FilterListOptions="VaryByDataType" FilterControlAltText="Filter City column"
                            HeaderText="City" SortExpression="City" UniqueName="City">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="State" FilterListOptions="VaryByDataType" FilterControlAltText="Filter State column"
                            HeaderText="State" SortExpression="State" UniqueName="State">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ZipCode" FilterListOptions="VaryByDataType" FilterControlAltText="Filter ZipCode column"
                            HeaderText="ZipCode" SortExpression="ZipCode" UniqueName="ZipCode">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="PhoneNo" FilterListOptions="VaryByDataType" FilterControlAltText="Filter PhoneNo column"
                            HeaderText="PhoneNo" SortExpression="PhoneNo" UniqueName="PhoneNo">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Email" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Email column"
                            HeaderText="Email" SortExpression="Email" UniqueName="Email">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Comments" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter Comments column" HeaderText="Comments" SortExpression="Comments"
                            UniqueName="Comments">
                        </telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn DataField="DateEntered" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter DateEntered column" HeaderText="DateEntered" ReadOnly="True"
                            SortExpression="DateEntered" UniqueName="DateEntered" DataType="System.DateTime"
                            DataFormatString="{0:MM/dd/yyyy}">
                        </telerik:GridDateTimeColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <GroupingSettings CaseSensitive="false" />
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
            </telerik:RadGrid>
        </telerik:RadPageView>
        <telerik:RadPageView ID="rpv3" runat="server">
            <h1>
                Grid 3</h1>
            <telerik:RadGrid ID="grid3" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
                AllowSorting="True">
                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                </HeaderContextMenu>
                <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID">
                    <CommandItemSettings ExportToPdfText="Export to Pdf" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" SortExpression="ID"
                            UniqueName="ID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Name" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Name column"
                            HeaderText="Name" SortExpression="Name" UniqueName="Name">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Address column"
                            HeaderText="Address" SortExpression="Address" UniqueName="Address">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="City" FilterListOptions="VaryByDataType" FilterControlAltText="Filter City column"
                            HeaderText="City" SortExpression="City" UniqueName="City">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="State" FilterListOptions="VaryByDataType" FilterControlAltText="Filter State column"
                            HeaderText="State" SortExpression="State" UniqueName="State">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ZipCode" FilterListOptions="VaryByDataType" FilterControlAltText="Filter ZipCode column"
                            HeaderText="ZipCode" SortExpression="ZipCode" UniqueName="ZipCode">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="PhoneNo" FilterListOptions="VaryByDataType" FilterControlAltText="Filter PhoneNo column"
                            HeaderText="PhoneNo" SortExpression="PhoneNo" UniqueName="PhoneNo">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Email" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Email column"
                            HeaderText="Email" SortExpression="Email" UniqueName="Email">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Comments" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter Comments column" HeaderText="Comments" SortExpression="Comments"
                            UniqueName="Comments">
                        </telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn DataField="DateEntered" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter DateEntered column" HeaderText="DateEntered" ReadOnly="True"
                            SortExpression="DateEntered" UniqueName="DateEntered" DataType="System.DateTime"
                            DataFormatString="{0:MM/dd/yyyy}">
                        </telerik:GridDateTimeColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <GroupingSettings CaseSensitive="false" />
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
            </telerik:RadGrid>
        </telerik:RadPageView>
        <telerik:RadPageView ID="rpv4" runat="server">
            <h1>
                Grid 4</h1>
            <telerik:RadGrid ID="grid4" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
                AllowSorting="True">
                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                </HeaderContextMenu>
                <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID">
                    <CommandItemSettings ExportToPdfText="Export to Pdf" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" SortExpression="ID"
                            UniqueName="ID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Name" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Name column"
                            HeaderText="Name" SortExpression="Name" UniqueName="Name">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Address column"
                            HeaderText="Address" SortExpression="Address" UniqueName="Address">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="City" FilterListOptions="VaryByDataType" FilterControlAltText="Filter City column"
                            HeaderText="City" SortExpression="City" UniqueName="City">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="State" FilterControlAltText="Filter State column"
                            HeaderText="State" SortExpression="State" UniqueName="State">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ZipCode" FilterListOptions="VaryByDataType" FilterControlAltText="Filter ZipCode column"
                            HeaderText="ZipCode" SortExpression="ZipCode" UniqueName="ZipCode">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="PhoneNo" FilterListOptions="VaryByDataType" FilterControlAltText="Filter PhoneNo column"
                            HeaderText="PhoneNo" SortExpression="PhoneNo" UniqueName="PhoneNo">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Email" FilterListOptions="VaryByDataType" FilterControlAltText="Filter Email column"
                            HeaderText="Email" SortExpression="Email" UniqueName="Email">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Comments" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter Comments column" HeaderText="Comments" SortExpression="Comments"
                            UniqueName="Comments">
                        </telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn DataField="DateEntered" FilterListOptions="VaryByDataType"
                            FilterControlAltText="Filter DateEntered column" HeaderText="DateEntered" ReadOnly="True"
                            SortExpression="DateEntered" UniqueName="DateEntered" DataType="System.DateTime"
                            DataFormatString="{0:MM/dd/yyyy}">
                        </telerik:GridDateTimeColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <GroupingSettings CaseSensitive="false" />
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
            </telerik:RadGrid>
        </telerik:RadPageView>
    </telerik:RadMultiPage>
    <telerik:RadButton ID="chkbox" runat="server" ButtonType="ToggleButton" Skin="Web20"
        Text="Checkbox" ToggleType="CheckBox" Font-Underline="false">
    </telerik:RadButton>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
 
            function doFilter(sender, eventArgs, gvwName) {
                if ((eventArgs.keyCode == 13 || eventArgs.keyCode == 9) && (sender.value != "")) {
                    eventArgs.cancelBubble = true;
                    eventArgs.returnValue = false;
                    if (eventArgs.stopPropagation) {
                        eventArgs.stopPropagation();
                        eventArgs.preventDefault();
                    }
                    var masterTableView = $find(gvwName).get_masterTableView();
                    var index = sender.parentNode.cellIndex;
                    var columns = masterTableView.get_columns();
                    var uniqueName = columns[index].get_uniqueName();
                    var filterFunction = columns[index].get_filterFunction();
                    masterTableView.filter(uniqueName, sender.value, filterFunction);
                }
            }
 
            function doFilterDate(sender, eventArgs, gvwName, gvwColName) {
                code = eventArgs.keyCode;
                setTimeout(function () {
 
                    if (isValid) {
                        if ((code == 13 || code == 9) && (sender.value != "")) {
                            var masterTableView = $find(gvwName).get_masterTableView();
                            masterTableView.filter(gvwColName, sender.value, Telerik.Web.UI.GridFilterFunction.EqualTo);
                        }
                    };
                }, 300);
                isValid = true;
            }
 
            function FilterChanged(sender, eventArgs, gvwName) {
 
                var active = document.activeElement;
 
                if (sender.value == "") {
                    eventArgs.cancelBubble = true;
                    eventArgs.returnValue = false;
                    if (eventArgs.stopPropagation) {
                        eventArgs.stopPropagation();
                        eventArgs.preventDefault();
                    }
                    var masterTableView = $find(gvwName).get_masterTableView();
 
                    var index = sender.parentNode.cellIndex;
                    var columns = masterTableView.get_columns();
                    var uniqueName = columns[index].get_uniqueName();
                    masterTableView.filter(uniqueName, sender.value, Telerik.Web.UI.GridFilterFunction.NoFilter);
                }
            }
 
            function FilterChangedDate(sender, eventArgs, gvwName, gvwColName) {
 
                var active = document.activeElement;
 
                if (sender.value == "") {
                    eventArgs.cancelBubble = true;
                    eventArgs.returnValue = false;
                    if (eventArgs.stopPropagation) {
                        eventArgs.stopPropagation();
                        eventArgs.preventDefault();
                    }
                    var masterTableView = $find(gvwName).get_masterTableView();
                    masterTableView.filter(gvwColName, sender.value, Telerik.Web.UI.GridFilterFunction.NoFilter);
                }
            }
 
            function request(sender, eventArgs) {
                //debugger;
            }
            var isValid = true;
            function Error(sender, eventArgs) {
                //debugger;
                isValid = false;
            }
        </script>
    </telerik:RadCodeBlock>
    </form>
</body>
</html>







Imports Telerik.Web.UI
Imports Telerik.Web
Imports System.Data.OleDb
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Sql
 
Partial Class _Default
    Inherits System.Web.UI.Page
 
    Public dbConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("~/app_data/RadGridFilteringIssue.mdb") & ";User Id=admin;Password=;")
    Public strSQL As String = "SELECT People.ID, People.Name, People.Address, People.City, People.State, People.ZipCode, People.PhoneNo, People.Email, People.Comments, Date As DateEntered FROM People"
 
    Public Sub AddFilterOnKey(ByVal gvwName As String, ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
        Dim gvw As RadGrid = DirectCast(rmp1.FindControl(gvwName), RadGrid)
        Dim ctrl As Control
        If TypeOf e.Item Is GridFilteringItem Then
            Dim fltItem As GridFilteringItem = TryCast(e.Item, GridFilteringItem)
            For Each column As GridColumn In gvw.Columns
                column.CurrentFilterFunction = GridKnownFunction.Contains
                ctrl = fltItem(column.UniqueName).Controls(0)
                If TypeOf ctrl Is TextBox Then
                    Dim box As TextBox = TryCast(ctrl, TextBox)
                    box.Attributes.Add("onkeydown", "doFilter(this,event,'" & gvw.ClientID & "')")
                    box.Attributes.Add("onchange", "FilterChanged(this,event,'" & gvw.ClientID & "')")
                ElseIf TypeOf ctrl Is RadDatePicker Then
                    Dim datepick As RadDatePicker = TryCast(ctrl, RadDatePicker)
                    Dim dateinput As RadDateInput = TryCast(datepick.DateInput, RadDateInput)
                    dateinput.Attributes.Add("onkeypress", "doFilterDate(this,event,'" & gvw.ClientID & "','" & column.UniqueName & "')")
                    dateinput.Attributes.Add("onchange", "FilterChangedDate(this,event,'" & gvw.ClientID & "','" & column.UniqueName & "')")
                    dateinput.ClientEvents.OnError = "Error"
                End If
            Next
        End If
    End Sub
 
    Protected Sub grid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grid1.ItemCreated
        For Each column As GridColumn In grid1.Columns
            If column.CurrentFilterFunction = GridKnownFunction.NoFilter Then
                If Not column.UniqueName = "Delete" Then
                    column.CurrentFilterFunction = GridKnownFunction.Contains
                End If
            End If
        Next
        AddFilterOnKey("grid1", sender, e)
    End Sub
 
    Protected Sub grid2_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grid2.ItemCreated
        For Each column As GridColumn In grid2.Columns
            If column.CurrentFilterFunction = GridKnownFunction.NoFilter Then
                If Not column.UniqueName = "Delete" Then
                    column.CurrentFilterFunction = GridKnownFunction.Contains
                End If
            End If
        Next
        AddFilterOnKey("grid2", sender, e)
    End Sub
 
 
    Protected Sub grid3_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grid3.ItemCreated
        For Each column As GridColumn In grid3.Columns
            If column.CurrentFilterFunction = GridKnownFunction.NoFilter Then
                If Not column.UniqueName = "Delete" Then
                    column.CurrentFilterFunction = GridKnownFunction.Contains
                End If
            End If
        Next
        AddFilterOnKey("grid3", sender, e)
    End Sub
 
    Protected Sub grid4_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grid4.ItemCreated
        For Each column As GridColumn In grid4.Columns
            If column.CurrentFilterFunction = GridKnownFunction.NoFilter Then
                If Not column.UniqueName = "Delete" Then
                    column.CurrentFilterFunction = GridKnownFunction.Contains
                End If
            End If
        Next
        AddFilterOnKey("grid4", sender, e)
    End Sub
 
    Protected Sub grid1_SortCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridSortCommandEventArgs) Handles grid1.SortCommand
        DataBindGrid("grid1")
    End Sub
 
    Protected Sub grid1_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grid1.ItemCommand
        If e.CommandName = RadGrid.FilterCommandName Then
            DataBindGrid("grid1")
        End If
    End Sub
 
    Protected Sub grid2_SortCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridSortCommandEventArgs) Handles grid2.SortCommand
        DataBindGrid("grid2")
    End Sub
 
    Protected Sub grid2_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grid2.ItemCommand
        If e.CommandName = RadGrid.FilterCommandName Then
            DataBindGrid("grid2")
        End If
    End Sub
 
    Protected Sub grid3_SortCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridSortCommandEventArgs) Handles grid3.SortCommand
        DataBindGrid("grid3")
    End Sub
 
    Protected Sub grid3_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grid3.ItemCommand
        If e.CommandName = RadGrid.FilterCommandName Then
            DataBindGrid("grid3")
        End If
    End Sub
 
    Protected Sub grid4_SortCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridSortCommandEventArgs) Handles grid4.SortCommand
        DataBindGrid("grid4")
    End Sub
 
    Protected Sub grid4_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grid4.ItemCommand
        If e.CommandName = RadGrid.FilterCommandName Then
            DataBindGrid("grid4")
        End If
    End Sub
 
    Public Sub DataBindGrid(ByVal gvwName As String)
        Dim gvw As RadGrid = DirectCast(rmp1.FindControl(gvwName), RadGrid)
 
        Dim reader As OleDbDataReader
        Dim cmd As New OleDbCommand(strSQL, dbConn)
 
        Dim dt As New DataTable
        dbConn.Open()
        Try
            reader = cmd.ExecuteReader
            If reader.HasRows Then
                dt.Load(reader)
            End If
        Catch ex As Exception
        Finally
            If Not dbConn Is Nothing Then dbConn.Close()
        End Try
 
        gvw.DataSource = dt
        gvw.DataBind()
    End Sub
 
    Public Sub GetDataSource(ByVal gvwName As String)
        Dim gvw As RadGrid = DirectCast(rmp1.FindControl(gvwName), RadGrid)
 
        Dim reader As OleDbDataReader
        Dim cmd As New OleDbCommand(strSQL, dbConn)
 
        Dim dt As New DataTable
        dbConn.Open()
        Try
            reader = cmd.ExecuteReader
            If reader.HasRows Then
                dt.Load(reader)
            End If
        Catch ex As Exception
        Finally
            If Not dbConn Is Nothing Then dbConn.Close()
        End Try
 
        gvw.DataSource = dt
    End Sub
 
    Protected Sub grid4_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grid4.NeedDataSource
        GetDataSource("grid4")
    End Sub
 
    Protected Sub grid3_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grid3.NeedDataSource
        GetDataSource("grid3")
    End Sub
 
 
    Protected Sub grid2_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grid2.NeedDataSource
        GetDataSource("grid2")
    End Sub
 
    Protected Sub grid1_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grid1.NeedDataSource
        GetDataSource("grid1")
    End Sub
End Class
Sebastian
Telerik team
 answered on 07 Mar 2011
1 answer
217 views
Hello,

My RadGrid is defined with several GridDropDownColumn. The GridDropDownColumns are linked to an ObjectDatasource.
<telerik:GridDropDownColumn DataField="MondayId" DataSourceID="oOdsPoste" HeaderText="Monday"
                               ListTextField="Code" ListValueField="Id" UniqueName="Monday">
                           </telerik:GridDropDownColumn>


Is there a way to retrieve all the data of the ObjectDataSource in the ItemDataBound Event of the RadGrid?

Thanks,Steven

Iana Tsolova
Telerik team
 answered on 07 Mar 2011
1 answer
141 views

Hi,
I am working on a page which shows hirarchical records through RadTreeList control. Everything looks fine except records with parent id which didnt exists in list. Not sure if this is a limitation of RadTreeList control or if there is any flag which allow to display these kind of records.

I have many records in the table with parent id which didn't exists in the table but we still want to show those records in TreeList control.

To explain the issue, there is test page. As you can see in result, first record ("Appetizers") is not rendering on the page as parent id "Y", didn't exists in list.

Thank you in advance for your help.

Default.aspx

<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
<telerik:RadTreeList ID="RadTreeList1" runat="server" OnNeedDataSource="RadTreeList1_NeedDataSource"
    ParentDataKeyNames="ParentID" DataKeyNames="ID" AllowPaging="true" PageSize="5"
    AutoGenerateColumns="false" AllowSorting="true">
    <Columns>
        <telerik:TreeListBoundColumn DataField="ID" UniqueName="ID" HeaderText="Category ID" />
        <telerik:TreeListTemplateColumn DataField="ProductName" UniqueName="ProductName" HeaderText="Product">
            <ItemTemplate>
                <%# Eval("ProductName")%>
            </ItemTemplate>
            <HeaderStyle Width="300px" />
        </telerik:TreeListTemplateColumn>
        <telerik:TreeListBoundColumn DataField="ParentID" UniqueName="ParentID" HeaderText="Parent Category ID" />
    </Columns>
</telerik:RadTreeList>

Default.aspx.cs
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void RadTreeList1_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
    {
        RadTreeList1.DataSource = MyData.GetData();
    }
}
public class MyData
{
    public static List<MyItem> GetData()
    {
        List<MyItem> list = new List<MyItem>();
        list.Add(new MyItem("A", "Appetizers", "Y"));
        list.Add(new MyItem("B", "Beverages", ""));
        list.Add(new MyItem("C", "Cheese", ""));
        return list;
    }
}
public class MyItem
{
    public string ID { get; set; }
    public string ProductName { get; set; }
    public string ParentID { get; set; }
    public MyItem(string id, string productName, string parentID)
    {
        ID = id;
        ProductName = productName;
        ParentID = parentID;
    }
}
Veli
Telerik team
 answered on 07 Mar 2011
1 answer
230 views
The control is enforcing the min and max when using the spin buttons, however, I can type in values that are below the minimum and then click button to postback.

From what I can tell from the UI, it looks like the control shows the alert that the input is wrong, but the postback continues.

Any ideas on how to block the postback?

Thanks.
Martin
Telerik team
 answered on 07 Mar 2011
6 answers
241 views
Hi all,

I set width="100%"in the aspx
And  would like to know its width in pixel after data is filled.
I tried myRadGrid.width, but it just show 100% 
Could someone help me?

Thanks.

Andy.  
Vasil
Telerik team
 answered on 07 Mar 2011
1 answer
54 views
I am receiving records from a web service that are displayed in a
RadGrid. I need to mark certain records as selected based on the
existence of matching records in a database table. The records in
the table were produced from the web service at one time and contain
only matching records. The records are matched via the "AccDesc"
DataKeyNames. Any suggestions would be appreciated.

<
radControls:RadGrid ID="AccessoriesGrd" runat="server" Width="780px" AllowMultiRowSelection="true" Visible="true">
<MasterTableView DataKeyNames="AccDesc, Retail, TradeIn" AutoGenerateColumns="false" EnableHeaderContextMenu="true">
<Columns
<radControls:GridClientSelectColumn HeaderText="Select" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="55px" UniqueName="SelectColumn" ItemStyle-VerticalAlign="Top" />
<radControls:GridBoundColumn DataField="AccDesc" AllowSorting="true" HeaderText="Description" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="350px" ItemStyle-VerticalAlign="Top" />
<radControls:GridTemplateColumn HeaderText="Retail" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="55px" SortExpression="Retail" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Top">
<ItemTemplate>
<%#Consumers.StandardFunctions.FormatCurrency(Eval("Retail"))%>
</ItemTemplate>
</radControls:GridTemplateColumn
<radControls:GridTemplateColumn HeaderText="Trade-In" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="55px" SortExpression="TradeIn" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Top">
<ItemTemplate>
<%#Consumers.StandardFunctions.FormatCurrency(Eval("TradeIn"))%>
</ItemTemplate>
</radControls:GridTemplateColumn
</Columns>                  
</MasterTableView>
<ClientSettings EnableRowHoverStyle="true" AllowColumnsReorder="true" ColumnsReorderMethod="Reorder">
<Selecting AllowRowSelect="true" />
</ClientSettings>
</radControls:RadGrid>

 

Mira
Telerik team
 answered on 07 Mar 2011
1 answer
81 views

Hello

I'm having a bit of a problem with an AJAX update from within a RadTree, I've had a look around the forums and can't find a proper answer to my prolem although I have stumbled across a couple of posts that given me a couple of ideas. Anyway, here is my problem, I hope someone can help.

What I'm effectivly trying to do is differentiate between clicking on a node in a RadTreeVew (to update the main panel) and dragging a node in a RadTreeView (to update a graph) during an AJAX update, unfortuately it seems that the EventName property of the RadAjaxManager AjaxSetting does not work as mentioned in this post (http://www.telerik.com/community/forums/aspnet-ajax/ajax/ajax-manager-event-filter.aspx)  reading on on this post Nicholas Walker (10th post) suggests a workaround in which you use the OnClientNodeClicked and OnClientNodeDropped properties of the RadTreeView to fire some JavaScript which modifies(?) the RadAjaxManager. I can get one or the other to work and I'm not really sure how the JavaScript fits in, ideally for one or the other, I want to disable the opposite manager update but I'm not sure how this could be done with javascript, or whether it could be done at all.
 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
     <AjaxSettings>
         <telerik:AjaxSetting AjaxControlID="radTree" EventName="onTreeViewNodeDrop">
             <UpdatedControls>
                 <telerik:AjaxUpdatedControl ControlID="divWatchMeasureChart1" LoadingPanelID="RadAjaxLoadingPanel1" />
                 <telerik:AjaxUpdatedControl ControlID="lbMeasureName" />
             </UpdatedControls>
         </telerik:AjaxSetting>
         <telerik:AjaxSetting AjaxControlID="radTree" EventName="onTreeViewNodeClicked">
             <UpdatedControls>
                 <telerik:AjaxUpdatedControl ControlID="mainRight" LoadingPanelID="RadAjaxLoadingPanel1"/>
             </UpdatedControls>
         </telerik:AjaxSetting>
     </AjaxSettings>
</telerik:RadAjaxManager>
   
<div class="treeHolder">
  <telerik:RadTreeView ID="radTree" Runat="server" Skin="Windows7" 
     onclientnodedatabound="OnClientNodeDataBoundHandler" 
     onnodeclick="radTree_NodeClick" EnableDragAndDrop="True"
     OnNodeDrop="RadTreeView1_NodeDrop" OnClientNodeClicked="onTreeViewNodeClicked" OnClientNodeDropped="onTreeViewNodeDrop">
     <WebServiceSettings Path="~\Controls\WebController.aspx" Method="GetChildren" />
  </telerik:RadTreeView>
<div>
  
<telerik:RadScriptBlock runat="server">
<script language="javascript">
    function OnClientNodeDataBoundHandler(sender, e) {
        var node = e.get_node();
        node.set_toolTip(node.get_attributes().getAttribute("ToolTip"));
    }
  
    function onTreeViewNodeClicked(sender, eventArgs) 
    {
        var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
        if (ajaxManager != null) 
        {
            var settings = ajaxManager.get_ajaxSettings();
            for (setting in settings) 
            {
                var initiatingControl = settings[setting].InitControlID;
                var controls = settings[setting].UpdatedControls;
                if (initiatingControl == '<%= radTree.ClientID %>') {
  
                    for (control in controls) 
                    {
                        if (controls[control].ControlID != "mainRight")
                        {//disable all other updates perhaps?
                        }
                    }
                }
  
            }
  
            ajaxManager.set_ajaxSettings(settings);
        }
    }
  
  
    function onTreeViewNodeDrop(sender, eventArgs) 
    {
        var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
        if (ajaxManager != null) {
            var settings = ajaxManager.get_ajaxSettings();
            for (setting in settings) {
                var initiatingControl = settings[setting].InitControlID;
                var controls = settings[setting].UpdatedControls;
                if (initiatingControl == '<%= radTree.ClientID %>') {
                    for (control in controls) 
                    {
                        if (controls[control].ControlID != "CntrlViewOverview1_divWatchMeasureChart1") 
                        {//disable all other updates perhaps?
                        }
                    }
                }
  
            }
  
            ajaxManager.set_ajaxSettings(settings);
        }
    }
  
</script>
</telerik:RadScriptBlock>

This whole issue seems to be a bit of an oversight as it would seem sensible that you would want to react to a drag differently to a click, hopefully someone will have an answer to this and eny my multi-day efforts in getting this working. Thank you.
Iana Tsolova
Telerik team
 answered on 07 Mar 2011
1 answer
76 views
I am using a grid of which the SaveScrollPosition="True" so that the position is saved during AJAX postbacks.  I have however implemented a custom client-side script to handle scrolling when the bottom and top of the grid is reached (based on http://www.telerik.com/help/aspnet-ajax/grdvirtualscrollpaging.html) so that paging is "automated".  

The issue is now that when I reach the bottom of the grid and the AJAX request is fulfilled then the position is still at the bottom of the grid.  I want it to be at the top of the grid and visa-versa when I reach the top of the grid.

I have looked and tested all the scenarios proposed in the demos and sample that I could find, but must be missing something. I believe I must use ScrollTop, but cannot find a proper description of how to implement such a client-side script when the SaveScrollPosition is enabled.

Any help would be highly appreciated.

Regards,
Ray 
Tsvetina
Telerik team
 answered on 07 Mar 2011
6 answers
330 views
I am tasked with developing some funcitonality that will allow users to create snippets of web content. The snippets will contain standard html formatting elements and images. It seems that Rad Editor can accomplish a great deal of what I'm trying to do. I do have some questions about inserting images in the content, though.

1) The images are going to be stored in a central directory on the server, but not necessarily in the application folder structure. I assume its possible to set the loacation of the images folder anywhere on the server by using a virtual directory in the application, and this will allow the images dialog to function. Is there any way to specify the location of the image directory on a networked server, as opposed to the same server as the web application?

2) Because the applicaiton will contain a virtual directory, the specified url for an image will work, even if the image is in a directory which isn't in the application folder structure. However, in some cases we don't want the image urls to reference the web application and its domain. We have created a separate domain which points to the images folder... something like http://imagesrv.com/images/someimage.jpg. When an image is inserted in the editor using the images dialog, is there a way to specify that the  url should be an absolute url based on this pattern http://imagesrv.com/images/ + imageFileName as opposed to the default url which is used by the editor? As a side note, can the same be done when inserting links to files as opposed to images?
Rumen
Telerik team
 answered on 07 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?