Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
473 views
heey guys i got a strange error 

Telerik.Web.UI.GridInsertionObject' does not contain a property with the name 'FromDate'


<%@ Page Title="" Language="C#" MasterPageFile="~/ABBMaster.Master" AutoEventWireup="true"
    CodeBehind="UserEditPanel.aspx.cs" Inherits="HolidayTracker.Administrator.UserEditPanel" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainRegionContentPlaceHolder" runat="server">
    <telerik:RadScriptManager ID="rsmTelerik" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js"></asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js"></asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js"></asp:ScriptReference>
        </Scripts>
    </telerik:RadScriptManager>
 
 
    <br />
 
<%--    <script type="text/javascript">
        function onRequestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
                args.set_enableAjax(false);
            }
        }
    </script>--%>
    <asp:Panel ID="pnlContent" CssClass="pnlContent" runat="server">
 
        <asp:Panel ID="pnlHeader" CssClass="pnlHeader" runat="server">
        </asp:Panel>
        <asp:Panel ID="pnlBody" CssClass="pnlBody" runat="server">
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Skin="Default" LoadingPanelID="RadAjaxLoadingPanel1">
                <fieldset style="padding: 10px; margin-bottom: 10px;">
                    <legend>User form</legend>
                    <div class="formRowDiv">
                        <asp:Label ID="label4" CssClass="formLabel" runat="server" Text="Email"></asp:Label>
                        <telerik:RadComboBox ID="rcbSearch" CssClass="rowForm" runat="server" Width="260px"
                            Height="100px" EmptyMessage="Enter Email" EnableLoadOnDemand="true" AutoPostBack="true"
                            OnItemsRequested="rcbSearch_ItemsRequested" CausesValidation="false" OnSelectedIndexChanged="rcbSearch_IndexChanged">
                        </telerik:RadComboBox>
                        <asp:RegularExpressionValidator ID="revEmail" runat="server" Display="Dynamic" ControlToValidate="rcbSearch"
                            ValidationExpression="^[\w\.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*(\.[a-zA-Z]{2,3}){1,2}$"
                            ErrorMessage="Enter a valid email address" />
                        <asp:RequiredFieldValidator ID="rfvEmail" runat="server" Display="Dynamic" ControlToValidate="rcbSearch"
                            ErrorMessage="Can not be empty" CssClass="rowFormValidation" />
                    </div>
                    <div class="formRowDiv">
                        <asp:Label ID="label1" CssClass="formLabel" runat="server" Text="Firstname"></asp:Label>
                        <telerik:RadTextBox ID="rtbFirstName" CssClass="rowForm" runat="server" ReadOnly="True" />
                        <asp:RequiredFieldValidator ID="rfvFirstName" runat="server" Display="Dynamic" ControlToValidate="rtbFirstName"
                            ErrorMessage="Can not be empty" CssClass="rowFormValidation" />
                    </div>
                    <div class="formRowDiv">
                        <asp:Label ID="label2" CssClass="formLabel" runat="server" Text="Lastname"></asp:Label>
                        <telerik:RadTextBox ID="rtbLastName" CssClass="rowForm" runat="server" ReadOnly="True" />
                        <asp:RequiredFieldValidator ID="rfvLastName" runat="server" Display="Dynamic" ControlToValidate="rtbLastName"
                            ErrorMessage="Can not be empty" CssClass="rowFormValidation" />
                    </div>
                    <div class="formRowDiv">
                        <asp:Label ID="label3" CssClass="formLabel" runat="server" Text="Username"></asp:Label>
                        <telerik:RadTextBox ID="rtbUserName" CssClass="rowForm" runat="server" ReadOnly="True" />
                        <asp:RequiredFieldValidator ID="rfvUserName" runat="server" Display="Dynamic" ControlToValidate="rtbUserName"
                            ErrorMessage="Can not be empty" CssClass="rowFormValidation" />
                    </div>
                    <div class="formRowDiv" style="display: none;">
                        <asp:Label ID="label5" CssClass="formLabel" runat="server" Text="AdAccount"></asp:Label>
                        <telerik:RadTextBox ID="rtbAdAccount" CssClass="rowForm" runat="server" ReadOnly="True" />
                    </div>
                    <div class="formRowDiv" style="display: none;">
                        <asp:Label ID="label6" CssClass="formLabel" runat="server" Text="AdDomain"></asp:Label>
                        <telerik:RadTextBox ID="rtbAdDomain" CssClass="rowForm" runat="server" ReadOnly="True" />
                    </div>
                    <div class="formRowDiv">
                        <asp:Label ID="label8" runat="server" Text="Role" CssClass="formLabel"></asp:Label>
                        <telerik:RadComboBox ID="rcbUserRoles" CssClass="rowForm" CheckBoxes="True" EmptyMessage="- Please select -"
                            runat="server" DataTextField="Name" DataValueField="RoleId">
                        </telerik:RadComboBox>
                        <asp:SqlDataSource ID="UserRoleSqlSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                            SelectCommand="SELECT * FROM [HtUserRole]"></asp:SqlDataSource>
                    </div>
                    <div class="formRowDiv">
                        <%--  <asp:Label ID="label7" CssClass="formLabel" runat="server" Text="Annual vacations"></asp:Label> --%>
                        <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
 
                            <telerik:RadGrid ID="rgAnnualVacation" runat="server" CellSpacing="0" GridLines="None" AllowPaging="True" AutoGenerateDeleteColumn="True"
                                OnInsertCommand="rgAnnualVacation_InsertCommand" OnDeleteCommand="rgAnnualVacation_DeleteCommand" Height="200px"
                                OnUpdateCommand="rgAnnualVacation_UpdateCommand" OnNeedDataSource="rgAnnualVacation_NeedDataSource">
 
                                <MasterTableView AutoGenerateColumns="false" DataKeyNames="AnnualVacationId" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
 
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="AnnualVacationId" Visible="false" DataType="System.Int32" FilterControlAltText="Filter AnnualVacationId column" HeaderText="AnnualVacationId" ReadOnly="True" SortExpression="AnnualVacationId" UniqueName="AnnualVacationId">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="UserId" Visible="false" DataType="System.Int32" FilterControlAltText="Filter UserId column" HeaderText="UserId" SortExpression="UserId" UniqueName="UserId">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="FromDate" DataType="System.DateTime" FilterControlAltText="Filter FromDate column" HeaderText="FromDate" SortExpression="FromDate" UniqueName="FromDate">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="ToDate" DataType="System.DateTime" FilterControlAltText="Filter ToDate column" HeaderText="ToDate" SortExpression="ToDate" UniqueName="ToDate">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="WorkingTime" DataType="System.Int32" FilterControlAltText="Filter WorkingTime column" HeaderText="WorkingTime" SortExpression="WorkingTime" UniqueName="WorkingTime">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="VacationDays" DataType="System.Double" FilterControlAltText="Filter VacationDays column" HeaderText="VacationDays" SortExpression="VacationDays" UniqueName="VacationDays">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridEditCommandColumn />
                                    </Columns>
 
                                    <EditFormSettings EditFormType="Template">
                                        <FormTemplate>
                                            <table>
                                                <tr>
                                                    <td>From</td>
                                                    <td>
                                                        <telerik:raddatepicker id="fromdatepicker" runat="server" dbselecteddate='<%# bind("fromdate") %>'
                                                            tabindex="4">
                                                        </telerik:raddatepicker>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>To</td>
                                                    <td>
                                                        <telerik:raddatepicker id="todatepicker" runat="server" mindate="1/1/1900" dbselecteddate='<%# bind("todate") %>'
                                                            tabindex="4">
                                                        </telerik:raddatepicker>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>Working time (%)</td>
                                                    <td>
                                                        <telerik:RadNumericTextBox ID="txtWorkingTime" runat="server" NumberFormat-DecimalDigits="0" DbValue='<%# Bind("WorkingTime") %>'></telerik:RadNumericTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>Vacation days</td>
                                                    <td>
                                                        <telerik:RadNumericTextBox ID="txtVacationDays" runat="server" NumberFormat-DecimalDigits="2" DbValue='<%# Bind("VacationDays") %>'></telerik:RadNumericTextBox>
                                                    </td>
                                                </tr>
 
                                            </table>
 
                                            <table style="margin-top: 15px;">
                                                <tr>
                                                    <td>
                                                        <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                                            runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button
                                                    </td>
                                                    <td>
                                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                                            CommandName="Cancel"></asp:Button>
                                                    </td>
                                                </tr>
                                            </table>
                                        </FormTemplate>
                                    </EditFormSettings>
                                    <%--<CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true" ShowExportToCsvButton="true" />--%>
                                </MasterTableView>
                                <FilterMenu EnableImageSprites="False">
                                </FilterMenu>
 
                            </telerik:RadGrid>
                        </telerik:RadAjaxPanel>
                    </div>
                    <div class="formRowDiv">
                        <telerik:RadButton ID="rbBack" CssClass="rowButton" runat="server" Text="Back" OnClick="rbBack_Clicked"
                            CausesValidation="false" />
                        <telerik:RadButton ID="rbSave" CssClass="rowButton" runat="server" Text="Save" OnClick="rbSave_Clicked" />
                    </div>
                </fieldset>
            </telerik:RadAjaxPanel>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
            </telerik:RadAjaxLoadingPanel>
        </asp:Panel>
        <asp:Panel ID="pnlFooter" CssClass="pnlFooter" runat="server">
        </asp:Panel>
    </asp:Panel>
</asp:Content>



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HolidayTracker.Data.Model;
using Telerik.Web.UI;
using HolidayTracker.Code;
using System.Collections;
 
namespace HolidayTracker.Administrator {
    public partial class UserEditPanel : System.Web.UI.Page {
 
        private List<AnnualVacation> annualVacations = new List<AnnualVacation>();
 
        private Boolean newUser;
        private HtUser paramUser;
        private HtUser user;
        private HtUser User {
            get {
                user = HtUser.INIT_USER(this.Page, true);
                return user;
            }
        }
 
        protected void Page_Load(object sender, EventArgs e) {
            getParameters();
            if (!IsPostBack) {
 
                bindData();
 
                fillFieldsWithData();
                initFieldSettings();
            }
        }
 
        private void getParameters() {
            if (Page.Request["userId"] != null) {
                int userId = Constants.TryConvert(Page.Request["userId"], this.Page);
                this.paramUser = HtUser.GetById(userId);
            } else {
                this.paramUser = new HtUser();
            }
        }
 
        private void initFieldSettings() {
            if (!newUser) {
                this.rcbSearch.Enabled = false;
            }
        }
 
        private void bindData() {
            this.rcbUserRoles.DataSource = this.UserRoleSqlSource;
            this.rcbUserRoles.DataBind();
 
            //fill viewstate with annual vacations if empty
            if (paramUser != null && paramUser.AnnualVacations.Any())
            {
                if (ViewState["AnnualVacationSource"] == null)
                {
                    annualVacations.AddRange(paramUser.AnnualVacations);
                    ViewState["AnnualVacationSource"] = annualVacations;
                }
            }
        }
 
        private void fillFieldsWithData() {
            if (paramUser != null) {
                this.rtbFirstName.Text = paramUser.FirstName;
                this.rtbLastName.Text = paramUser.LastName;
                this.rtbUserName.Text = paramUser.UserName;
                this.rcbSearch.Text = paramUser.Email;
                this.rtbAdAccount.Text = paramUser.AdAccount;
                this.rtbAdDomain.Text = paramUser.AdDomain;
 
                //UserRole
                IEnumerable<HtUserRole> userRoles = paramUser.HtUserRoles != null ? paramUser.HtUserRoles : null;
                if (userRoles != null && userRoles.Count() > 0) {
                    foreach (RadComboBoxItem rcbi in rcbUserRoles.Items) {
                        rcbi.Checked = false;
                        foreach (HtUserRole ur in userRoles) {
                            if (ur.RoleId.ToString() == rcbi.Value) {
                                rcbi.Checked = true;
                                break;
                            }
                        }
                    }
                }
            }
        }
 
        protected void rcbSearch_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) {
            if (e.Text != null && e.Text.Length > 2) {
                IEnumerable<HtUser> result = null;
                AdLookup lookup = new AdLookup();
                result = lookup.SearchAdUserByEmail(e.Text);//HtUser.SearchByEmail(e.Text);
                if (result != null && result.Count() > 0) {
                    foreach (HtUser user in result) {
                        this.rcbSearch.Items.Add(new RadComboBoxItem(user.Email, user.UserId.ToString()));
                    }
                }
            }
        }
 
        protected void rcbSearch_IndexChanged(object sneder, RadComboBoxSelectedIndexChangedEventArgs e) {
            string email = e.Text;
            AdLookup lookup = new AdLookup();
            paramUser = lookup.GetAdUserByEmail(email);
            fillFieldsWithData();
        }
 
        private void saveData() {
            HolidayTrackerEntities ctx = HtEntityFactory.Context;
            HtUser userToSave = ctx.HtUsers.Where(u => u.UserId == paramUser.UserId).FirstOrDefault();
            if (userToSave == null) {
                userToSave = new HtUser();
                userToSave.IsNew = true;
            }
            userToSave.FirstName = this.rtbFirstName.Text;
            userToSave.LastName = this.rtbLastName.Text;
            userToSave.UserName = this.rtbUserName.Text;
            userToSave.Email = this.rcbSearch.Text;
            userToSave.AdAccount = this.rtbAdAccount.Text;
            userToSave.AdDomain = this.rtbAdDomain.Text;
 
            //UserRole
            foreach (RadComboBoxItem rcbi in rcbUserRoles.Items) {
                HtUserRole newUserRole = HtUserRole.GetById(int.Parse(rcbi.Value));
 
                if (rcbi.Checked) {
                    if (userToSave.HtUserRoles.Where(x => x.RoleId == newUserRole.RoleId).Count() == 0) {
                        userToSave.HtUserRoles.Add(newUserRole);
                    }
                } else {
                    if (userToSave.HtUserRoles.Where(x => x.RoleId == newUserRole.RoleId).Count() > 0) {
                        userToSave.HtUserRoles.Remove(newUserRole);
                    }
                }
            }
 
            if (userToSave.IsNew) {
                ctx.AddToHtUsers(userToSave);
            }
 
            if (((List<AnnualVacation>)ViewState["AnnualVacationSource"]) != null) {
                List<AnnualVacation> vacationToSave = (List<AnnualVacation>)ViewState["AnnualVacationSource"];
                IEnumerable<AnnualVacation> existing = paramUser.AnnualVacations;
                foreach (AnnualVacation toSave in vacationToSave) {
                    //if (toSave.IsNew) {
                    //    ctx.AddToAnnualVacations(toSave);
                    //}
                        
                    //Zu löschende aus context löschen
                }
            }
 
            ctx.SaveChanges();
        }
 
        protected void rbBack_Clicked(object sender, EventArgs e) {
            Response.Redirect("~/Administrator/UserPanel.aspx");
        }
 
        protected void rbSave_Clicked(object sender, EventArgs e) {
            saveData();
            fillFieldsWithData();
        }
 
        protected void rgAnnualVacation_InsertCommand(object sender, GridCommandEventArgs e) {
            try {
                GridEditableItem item = e.Item as GridEditableItem;
                Hashtable values = new Hashtable();
                item.ExtractValues(values);
 
                AnnualVacation newAnnualVacation = new AnnualVacation();
                item.UpdateValues(newAnnualVacation);
                //newAnnualVacation.IsNew = true;
 
                ((List<AnnualVacation>)ViewState["AnnualVacationSource"]).Add(newAnnualVacation);
            } catch {
                //Hier fehlermeldung
            }
 
        }
 
        protected void rgAnnualVacation_DeleteCommand(object sender, GridCommandEventArgs e) {
            int annualVacationId = int.Parse((e.Item as GridDataItem).GetDataKeyValue("AnnualVacationId").ToString());
            ((List<AnnualVacation>)ViewState["AnnualVacationSource"]).
                Remove(((List<AnnualVacation>)ViewState["AnnualVacationSource"]).
                Where(av => av.AnnualVacationId == annualVacationId).FirstOrDefault());
        }
 
        protected void rgAnnualVacation_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) {
            rgAnnualVacation.DataSource = ViewState["AnnualVacationSource"];
            if (rgAnnualVacation.DataSource == null)
            {
                rgAnnualVacation.DataSource = String.Empty;
            }
        }
 
        protected void rgAnnualVacation_UpdateCommand(object sender, GridCommandEventArgs e) {
 
        }
       
         }
}


plzz  dont give me just a reference plzz help thanks allot !!!!!  

Thanks for fast answer ! 
Pavlina
Telerik team
 answered on 25 Oct 2012
3 answers
79 views
I am using Tabstrip control in my aspx page with multipage view as given below.I am moving to next tab on click of a button.But while giving the RadTabStrip1 & RadMultiPage1 in the AjaxUpdatedControl,I am getting the blow error: "Microsoft JScript runtime error: Unable to set value of the property 'control': object is null or undefined"

MY CODE GOES AS BELOW:
-------------------------------------------

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest" >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadMultiPagetab" /> -- (if i mentioned this one i am getting error)
<telerik:AjaxUpdatedControl ControlID="RadTabStrip2" />
 </UpdatedControls>
            </telerik:AjaxSetting>
</AjaxSettings>
    </telerik:RadAjaxManager>

 <div style="float: left; width: 100%; min-height: 830px;">
        <div style="float: left; width: 100%; background-image: url(../images/bridge_logo_bg.jpg);
            background-repeat: repeat-x;">
 <telerik:RadTabStrip ID="RadTabStrip2" runat="server" MultiPageID="RadMultiPagetab"
                SelectedIndex="0" Orientation="HorizontalTop" ShowBaseLine="true" CssClass="tabStrip">
                <Tabs>
                    <telerik:RadTab Text="Overview" ToolTip="Overview">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Attendance" ToolTip="Attendance">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Discipline" ToolTip="Discipline">
                    </telerik:RadTab>                   
                </Tabs>
            </telerik:RadTabStrip>
</div>
<telerik:RadMultiPage ID="RadMultiPagetab" runat="server" SelectedIndex="0" >
            <!-- Overview -->
            <telerik:RadPageView ID="RadPageView2" runat="server">
<telerik:RadHtmlChart runat="server" ID="radhtml_dt" Width="240px" Height="300px"
                                        OnClientSeriesClicked="OnClientSeriesClicked">
                                        <Appearance>
                                            <FillStyle />
                                        </Appearance>
                                        <Legend>
                                            <Appearance Visible="false" />
                                        </Legend>
                                        <PlotArea>
                                            <YAxis>
                                            </YAxis>
                                        </PlotArea>
                                        <Legend>
                                            <Appearance Position="Right" />
                                        </Legend>
                                        <ChartTitle Text="Disc : Top 10">
                                        </ChartTitle>
                                    </telerik:RadHtmlChart>
                                </div>
 </telerik:RadPageView>
            <telerik:RadPageView ID="Disc" runat="server">
..... some controls---------------
 </telerik:RadPageView>
 <telerik:RadPageView ID="Enroll" runat="server">
----some controls---------------
 </telerik:RadPageView>
 </telerik:RadMultiPage>

 <telerik:RadCodeBlock ID="codeBlock" runat="server">
        <script type="text/javascript">
            function OnClientSeriesClicked(sender, args) {
                // debugger;
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(args.get_category() + ";" + sender._uniqueId);
                var totstring = args._seriesData.toString();
                var count = (totstring.split(",").length)
                for (var i = 0; i < count; i++) {
                    if (args._seriesData[i].value != args.get_value()) {
                        args._seriesData[i].explode = false;
                    }
                    else {
                        args._seriesData[i].explode = true;
                    }
                }
                sender.repaint();
            }
           
        </script>
 </telerik:RadCodeBlock>


Nencho
Telerik team
 answered on 25 Oct 2012
8 answers
70 views
Please disregard my thread below. I converted all my <images> to <asp:images> and put them into the controls collection to get what I needed. Lots of work but a better result.

Anyway, I'm attaching a project that won't pick up my customized styles if I set them at runtime. If I set them at design time they get picked up and work just fine.

When I dynamically add 10 images and set them each with one of 4 custom styles it has a clear tooltip with transparent everything except text. 

Thanks in advance!

Marin Bratanov
Telerik team
 answered on 25 Oct 2012
2 answers
48 views
I am using Schedular control as readonly to list the all ppointments from database. It displays all appointments. It gets refresh once I clicked on an appointment. After that all events of scheduler doesn't work. I am using in my asp.net master page. What might be the issue here.
Rajendra
Top achievements
Rank 1
 answered on 25 Oct 2012
28 answers
1.3K+ views
I've been looking into ways of doing filtering in a RadGrid by simply selecting a foreign key from a dropdown-list, like "Categories", "OrderStatus" etc. but no matter how hard I look, I can't seem to find a solution that doesn't feel very complicated, for what should really be one of the most common tasks used with a Grid. The other solutions probably work, but they seem over complicated, and thus harder to maintain over time etc.RadGrid has so many exceptional features, like most of the support for filtering, that it is very odd that it seems to almost lack support for what must be one of the most common tasks - filtering based on dropdowns.

When googling for this, I happend to stumble upon this blog entry, which I think really sums it ut very well, so instead of writing the same thing here all over again, I just refer just to http://www.tunaslut.com/telerik-radgrid-and-filtering-on-listtextfield-with-a-griddropdowncolumn/ and humly ask if there is still no easy way of doing this as of October 2010?

What is the recommended way of implementing simple drop down filtering? I've must have seen examples/code only on the Telerik site describing at lest 3-4 different ways of doing it (client side, serverside, custom class etc) and I am guessing that perhaps some of them are mainly vaild for older versions of the Telerik controls, lacking the features of the latest versions.
Tsvetoslav
Telerik team
 answered on 25 Oct 2012
3 answers
284 views
Hi, 

I have 2 grids on the web page, which I put into RadAjaxManager

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" >
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGridResults">
            <UpdatedControls>  
                <telerik:AjaxUpdatedControl ControlID="RadGridResults" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="RadGridResultsTest">
            <UpdatedControls>  
                <telerik:AjaxUpdatedControl ControlID="RadGridResultsTest" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>


Both of them have detail tables and I obtain data through NeedDataSource with similar content =>

if (e.IsFromDetailTable || e.RebindReason == GridRebindReason.InitialLoad)
  return;
  
RadGridResultsTest.DataSource = GetMainData();

First grid works fine and when I try to go to next page or change pagesize everything works correctly because all the time I obtain GridRebindReason.PostBackEvent in NeedDataSource method.

On the other hand second grid will display data only after button click, because there is GridRebindReason.ExplicitRebind
but during paging I obtain all the time GridRebindReason.InitialLoad, which makes my grid disappear. I also tried to remove condition

e.RebindReason == GridRebindReason.InitialLoad

so paging was suddenly working. I had 3 pages with 26 rows. I changed pagesize to 15 so I had 2 pages. But when I clicked on second page, grid somehow restored to pagesize 10 and got itself to first page.

Do you have any idea, where can be the problem and how can I make this work ?

Thanks a lot.
Peter
Top achievements
Rank 1
 answered on 25 Oct 2012
2 answers
181 views
Hi Team,

Can we disable and Enable the Rad Grid Paging Buttons .

If I am In 1st page then we have to disable Previous and First buttons

similary If we are in last page then we have to diable Next and Last buttons

and

Can we show tool tips for Grid page index numbers 1,2,3................

please give ur advise as soon as possible ....

Regards,
Prasad
Prasad
Top achievements
Rank 1
 answered on 25 Oct 2012
1 answer
42 views
Dear
i need to save settings for grid but in same time i have my paging
 code :
public void CustomizedGridPagerSize(GridItemEventArgs e) {
        int allItemsCount = (e.Item as GridPagerItem).Paging.DataSourceCount;
        RadComboBox combo = (e.Item as GridPagerItem).FindControl("PageSizeComboBox"as RadComboBox;
        RadComboBoxItem item1 = new RadComboBoxItem("10""10");
        RadComboBoxItem item2 = new RadComboBoxItem("20""20");
        RadComboBoxItem item3 = new RadComboBoxItem("50""50");
        RadComboBoxItem item4 = new RadComboBoxItem("100""100");
        RadComboBoxItem item5 = new RadComboBoxItem("200""200");
        RadComboBoxItem item6 = new RadComboBoxItem("All", allItemsCount.ToString());
        item1.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        item2.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        item3.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        item4.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        item5.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        item6.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        combo.Items.Clear();
        combo.Items.Add(item1);
        combo.Items.Add(item2);
        combo.Items.Add(item3);
        combo.Items.Add(item4);
        combo.Items.Add(item5);
        combo.Items.Add(item6);
        combo.Items.FindItemByValue(((RadGrid)e.Item.OwnerTableView.Parent).PageSize.ToString()).Selected = true;
    }

if we use the default paging sizes then it is working well and we can load the grid settings,
but when we use the code above to increase the paging sizes then when we load the grid settings we found the pager not saved

Regards
AhmedSalem
 
Angel Petrov
Telerik team
 answered on 25 Oct 2012
24 answers
520 views
Hi,
I'm long time Telerik controls user. I'm generally very hapy with them, but I miss one thing. Integrated RadTextBox property which set RadTextBox as Required. When you create long forms, you have two ways how to implement validation:
  • put and configure asp:RequiredFieldValidator to each RadTextBox. It is very painful work and you will end with very messy code
  • use RadInputManager with Validation IsRequired="true". This approach is good, but it's working only with classic TextBoxes, not with RadTextBoxes. And then I miss eg. possibility to define different EmptyMessage texts for each control.

My dream RadTextBox could be this one (meaning of new parameters is obvious):
<telerik:RadTextBox ID="RadTextBox1" Runat="server"  
EmptyMessage="Enter you desired username" 
Label="User Name" 
Required="True"  
RequiredMessage="Username is mandatory" 
ShowRedStar="True" 
MinLength="5"  
MinLengthMessage="Your username is too short" 
MaxLength="20" 
MaxLengthMessage="Use shorter username" 
Regex="[a-zA-Z0-9]" 
RegexMessage="Please use only alphabet and numbers" 
> 
</telerik:RadTextBox> 

I'm not developing wheel for now, those parameters are used in this ExJS implementation:
http://extasp.net/#/form/form_validate.aspx
Their TextBox works absolutly amazing. When non-valid, it sets itself into red, displays explanation bubble etc...

I'm able to achieve this behavior with RadTextBox also, but it will cost a lot of Javascript, implementation of RadToolTip etc. And I'm talking about speed! R.A.D.! :-) I just want to put required="true" into RadTextBox tag and everything is set.

Is there some way how to work with RadTextBox (...RadNumericTextBox, RadMaskedTextBox...) in simillar way?

Thank you very much for your advise.
Zdenek



Vasil
Telerik team
 answered on 25 Oct 2012
11 answers
1.5K+ views
How can I add a custom data attribute to a combo box that is dynamically created and bound to a DataTable?


protected
RadComboBox AddProductsCombo(int catID, int prodID)
   {
       RadComboBox RadComboBox1 = new RadComboBox();
       RadComboBox1.ID = "RadComboBox1";
       RadComboBox1.AutoPostBack = true;
       RadComboBox1.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(RadComboBox1_SelectedIndexChanged);
       PlaceHolder1.Controls.Add(RadComboBox1);
 
       MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQLConn"].ConnectionString);
       conn.Open();
       string sqlSelect1 = "SELECT p.prodID AS Id, p.prodName As Name, tsp.siteproductTypeID As Attr, p.catID  FROM products AS p INNER JOIN tblsiteproducts AS tsp ON tsp.prodID = p.prodID WHERE tsp.isActive = 1 AND tsp.siteID = 1 AND p.catID = ?catID AND isAddon = 0 ORDER BY prodSort ASC";
       MySqlDataAdapter adapter1 = new MySqlDataAdapter();
       MySqlCommand cmd1 = new MySqlCommand(sqlSelect1, conn);
       adapter1.SelectCommand = cmd1;
       cmd1.Parameters.Add("?catID", MySqlDbType.Int32).Value = catID;
 
       DataTable dt1 = new DataTable();
       adapter1.Fill(dt1);
 
       RadComboBox1.DataTextField = "Name";
       RadComboBox1.DataValueField = "Id";
       RadComboBox1.DataSource = dt1;
       RadComboBox1.DataBind();
       RadComboBox1.SelectedValue = prodID.ToString();
 
       return RadComboBox1;
   }
Nencho
Telerik team
 answered on 25 Oct 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?