The name 'startslider' does not exist in the current context

2 posts, 0 answers
  1. Adem
    Adem avatar
    7 posts
    Member since:
    Nov 2012

    Posted 21 Nov 2012 Link to this post

    Hi..

    i want to install a Radslider in my project but there is an error in it that i cant fixed :(

    i copied the C# and the aspx codes from the page "http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx" but it gives me error like "The name 'startSlider' does not exist in the current context" :((

    here are my to check.. it has been a day nearly but i could not find the error :((( please help..

    Thanks to Telerik Team in advance..

    Adem.


    ASPX code:

    <telerik:GridBoundColumn DataField="Yatan" HeaderText="Yatan" UniqueName="Yatan"
                                    FilterImageToolTip="Süz" FilterControlAltText="Filtrele" HeaderStyle-Width="250px"
                                    SortExpression="Yatan" DataFormatString="{0:###,###.## TL}">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle"></HeaderStyle>
                                     
                                    <FilterTemplate>                             
                                      <div style="float: left; padding: 5px 10px 0 0">
                                0 TL </div>
                            <telerik:RadSlider runat="server" ID="RadSlider1" IsSelectionRangeEnabled="true"
                                Style="float: left" MinimumValue="0" MaximumValue="3000" SmallChange="100" Width="135px" ShowDecreaseHandle="false"
                                ShowIncreaseHandle="false" Skin="Sunset" AutoPostBack="True" SelectionStart='<%# startSlider %>'
                                SelectionEnd='<%# endSlider %>' OnClientValueChanged="ClientValueChanged" OnClientSlideStart="ClientSlideStart"
                                OnClientSlideEnd="FreightRangeChanged" />
                            <div style="float: left; padding: 5px 0 0 10px">
                                3000 TL </div>
                            <div style="clear: both">
                            <asp:Literal ID="Literal1" runat="server" Text='<%# "Showing range between: $" + startSlider + " and $" + endSlider %>' />
                            </div>
                            <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                                <script type="text/javascript">
                                    function FreightRangeChanged(sender, args) {
                                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
     
                                        var startValue = sender.get_selectionStart();
                                        var endValue = sender.get_selectionEnd();
     
                                        tableView.filter("Yatan", startValue + " " + endValue, "Between");
                                    }
                                    function ClientValueChanged(sender, args) {
                                        var tooltip = $find("<%= RadToolTip1.ClientID %>");
     
                                        if (!tooltip.isVisible()) {
                                            var activeHandle = sender.get_activeHandle();
                                            if (!activeHandle) return;
     
                                            tooltip.set_targetControl(activeHandle);
                                            tooltip.show();
                                        }
                                        else {
                                            tooltip.updateLocation();
                                        }
     
                                        tooltip.set_text(args.get_newValue());
                                    }
     
                                    function ClientSlideStart(sender, args) {
                                        var tooltip = $find("<%= RadToolTip1.ClientID %>");
                                        tooltip.hide();
                                    }
                                </script>
                            </telerik:RadScriptBlock>
                                    </FilterTemplate>
     
     
                                </telerik:GridBoundColumn>


    CS.code:

    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;
    using System.Data;
     
    namespace MyFirstBudgetProgram.MyWebPages
    {
        public partial class GelirEkleDuzenle : System.Web.UI.Page
        {
            
        
            protected void GelirEkleDuzenle_ItemCommand(object source, GridCommandEventArgs e)
            {
                if (e.CommandName == RadGrid.FilterCommandName)
                {
                    Pair filterPair = (Pair)e.CommandArgument;
     
                    switch (filterPair.Second.ToString())
                    {
                         
                        case "Yatan":
                            this.startSlider = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("RadSlider1") as RadSlider).SelectionStart;
                            this.endSlider = ((e.Item as GridFilteringItem)[filterPair.Second.ToString()].FindControl("RadSlider1") as RadSlider).SelectionEnd;
                            break;
                        default:
                            break;
                    }
                }
            }
            protected decimal startSlider
            {
                set
                {
                    ViewState["strSl"] = value;
                }
                get
                {
                    if (ViewState["strSl"] != null)
                        return (decimal)ViewState["strSl"];
                    else
                        return 0;
                }
            }
            protected decimal endSlider
            {
                set
                {
                    ViewState["endSl"] = value;
                }
                get
                {
                    if (ViewState["endSl"] != null)
                        return (decimal)ViewState["endSl"];
                    else
                        return 3000;
                }
            }
             
            protected void Page_Load(object sender, EventArgs e)
            {
     
            }
             
        }
    }

        
  2. Adem
    Adem avatar
    7 posts
    Member since:
    Nov 2012

    Posted 22 Nov 2012 Link to this post

    I fixed the problem!!

    The page loads successfully but another problem :))

    it does not filter it.. Although I move the slider, it does not filter the values unless i double click on the values.  :(( and it goes directly the starting points immediately :(

    let me share my code..

    thanks in Advance..


    Adem

    <telerik:GridBoundColumn DataField="YATAN" HeaderText="YATAN" UniqueName="YATAN"
                                    HeaderStyle-Width="250px" SortExpression="yatan" DataFormatString="{0:C}" FilterListOptions="AllowAllFilters">
                                    <FilterTemplate>
                                        <div style="float: left; padding: 5px 10px 0 0">
                                            0TL</div>
                                        <telerik:RadSlider runat="server" ID="RadSlider1" IsSelectionRangeEnabled="true"
                                            Style="float: left" MinimumValue="0" MaximumValue="5000" SmallChange="100" Width="135px"
                                            SelectionStart='<%# startSlider %>' SelectionEnd='<%# endSlider %>' ShowDragHandle="True"
                                            ShowDecreaseHandle="False" ShowIncreaseHandle="False" AutoPostBack="True" Skin="Forest"
                                            OnClientValueChanged="ClientValueChanged" OnClientSlideStart="ClientSlideStart"
                                            OnClientSlideEnd="RangeChanged" />
                                        <div style="float: left; padding: 5px 0 0 10px">
                                            5000TL</div>
                                        <div style="clear: both">
                                            <asp:Literal ID="Literal1" runat="server" Text='<%# startSlider + " TL ile " + endSlider + " TL arasındaki değerler" %>' />
                                        </div>
                                        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                                            <script type="text/javascript">
                                                function RangeChanged(sender, args) {
                                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
     
                                                    var startValue = sender.get_selectionStart();
                                                    var endValue = sender.get_selectionEnd();
     
                                                    tableView.filter("Yatan", startValue + " " + endValue, "Between");
                                                }
                                                function ClientValueChanged(sender, args) {
                                                    var tooltip = $find("<%= RadToolTip1.ClientID %>");
     
                                                    if (!tooltip.isVisible()) {
                                                        var activeHandle = sender.get_activeHandle();
                                                        if (!activeHandle) return;
     
                                                        tooltip.set_targetControl(activeHandle);
                                                        tooltip.show();
                                                    }
                                                    else {
                                                        tooltip.updateLocation();
                                                    }
     
                                                    tooltip.set_text(args.get_newValue());
                                                }
     
                                                function ClientSlideStart(sender, args) {
                                                    var tooltip = $find("<%= RadToolTip1.ClientID %>");
                                                    tooltip.hide();
                                                }
                                            </script>
                                        </telerik:RadScriptBlock>
                                    </FilterTemplate>
                                </telerik:GridBoundColumn>
     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top