Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
613 views
<telerik:RadDatePicker runat="server" ID="rdpSomeName" Width="125px" CssClass="SomeCssClass">
   <DateInput ID="rdpSomeName_DateInput" InvalidStyleDuration="100" runat="server"  CssClass="SomeCssClass">
   </DateInput>
   <DatePopupButton CssClass="SomeCssClass"/>
</telerik:RadDatePicker>
Whenever I assign any value to the DatePopupButton's CssClass property, the UI renders the default text for the button as a link instead of rendering the button image.

My goal is to access each element on the page with a given class name via jQuery and set the 'disabled' attribute accordingly:
function Set_CssClass_UI_Enabled(bool_Enable) {
 
    //If we are told to ENABLE the UI set:
    if (bool_Enable) {
        $('.SomeCssClass').removeAttr('disabled');
    }
    else  //Otherwise, DISABLE the UI set:
    {
        $('.SomeCssClass').attr('disabled', 'disabled');
    }
}
This works for all the UI so far... except the date picker popup button.  I really don't want to hard code any control names in this method because at some point I plan on even passing the name of the cssClass which we want to toggle.  Thus I want to keep this as a generic helper method that I can reuse as needed.
Martin
Telerik team
 answered on 02 Jul 2012
0 answers
76 views

Telerik team,

I am using telerik tree in a radpane which has around 1000 nodes in it . Whenever the tree is expanded and any action is performed on it,

the ajax loading panel is showing up but in the middle of the tree(vertically i.e.The ajax wheel will be seen somewhere when I scroll down the browser window) due to which the User do not get prompt if any action is performed on tree.

I am using other controls also on the same page which are using same ajax manager,I do not want to disturb their ajax wheel position 

I have tried  the code given on following link but I could not achieve the result as expected.

http://www.telerik.com/help/aspnet-ajax/ajax-center-loadingpanel.html

Is there any way in which only for the tree control I can explicitly define the position of the ajax wheel so that it does not affect other controls?

Kindly let me know an appropriate solution for this as soon as possible.

A demo project would be of great help.

Thanking you in advance.

 

Sampada
Top achievements
Rank 1
 asked on 02 Jul 2012
3 answers
195 views
Hi!

I'm having a pretty specific question, and I wonder if it's possible what I want. In my codebehind I have a collection of objects that I bind to my gridview. In my gridview it is possible to check/uncheck some checkboxes. On a postback I read the values from the grid back into my collection of objects. When the user clicks the save button, I save the collection of objects to the database. I know this sounds a little bit clumsy, but I can't bind my database directly to my grid. 

This all works fine. However, I also want to add a row to the grid and I want to do this client side. I have my own input form and if the user clicks 'Add', I want this row to be added to the grid, with the values that the user enered in the form. I don't want my Grid to rebind or something like that. I only want the row to be there. 

Is this possible? And how can I achieve this?
 
Tsvetoslav
Telerik team
 answered on 02 Jul 2012
3 answers
65 views
Hello,

I was working on telerik controls from the past 1year. So far I found few issues respect to the IE7 and we could able to fix those.
From the past 2-3weeks one issue is paining us like anything and which is only with IE7.

I have page with 'div' and in that I kept a radgrid control with pageslider, and when I open this page in IE7 I am seeing the alignment of pageslider is missing and it is not at its place where it should be.

Following is the markup page which has div and radgrid control.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadGridDemo.aspx.cs" Inherits="WebApplication2.RadGridDemo" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!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>
</head>
<body>
    <form id="form1" runat="server">
    <div style="width:500px; height:300px; overflow:auto;">
        <asp:toolkitscriptmanager id="ToolkitScriptManager1" runat="server" scriptmode="Release"
            loadscriptsbeforeui="false" combinescripts="true" enablehistory="true" enablepagemethods="true">
        </asp:toolkitscriptmanager>
        <telerik:radgrid id="RadGrid1" runat="server" pagesize="10" width="800px"
            onitemcreated="RadGrid_ItemCreated" onneeddatasource="RadGridInner_OnNeedDataSource"
            allowpaging="true" enableheadercontextmenu="true"
            enableheadercontextfiltermenu="true">
         <MasterTableView PageSize="10" AllowSorting="true" AllowFilteringByColumn="true"
            HierarchyLoadMode="Client" DataKeyNames="ID" AutoGenerateColumns="false">
            <PagerStyle Position="Bottom" PageButtonCount="5" Mode="Slider" PageSizeLabelText="Records per Page:"
                Visible="true" ShowPagerText="true" AlwaysVisible="true"></PagerStyle>
                <Columns>
                <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" AllowSorting="true"
                    EmptyDataText="-" UniqueName="ID" HeaderText="Employee ID" SortExpression="ID" />
                <telerik:GridBoundColumn ItemStyle-Font-Bold="true" DataField="FirstName" DataType="System.String"
                    AllowSorting="true" EmptyDataText="-" UniqueName="FirstName" HeaderText="First Name"
                    SortExpression="FirstName" />
                <telerik:GridBoundColumn DataField="LastName" DataType="System.String" AllowSorting="true"
                    EmptyDataText="-" UniqueName="LastName" HeaderText="Last Name" SortExpression="LastName" />
                <telerik:GridBoundColumn DataField="DateOfJoin" DataType="System.DateTime" AllowSorting="true"
                    EmptyDataText="-" DataFormatString="{0:MM/dd/yyyy}" UniqueName="Date Of Join"
                    HeaderText="Date Of Join" SortExpression="DateOfJoin">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Designation" DataType="System.String" AllowSorting="true"
                    EmptyDataText="-" UniqueName="Designation" HeaderText="Designation" SortExpression="Designation" />
                <telerik:GridBoundColumn DataField="CompanyName" DataType="System.String" AllowSorting="true"
                    EmptyDataText="-" UniqueName="CompanyName" HeaderText="Company Name" SortExpression="CompanyName" />
                    </Columns>
        </MasterTableView>
    </telerik:radgrid>
    </div>
    </form>
</body>
</html>

Following is the codebehind file which basically I am using to bind the data.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace WebApplication2
{
    public partial class RadGridDemo : System.Web.UI.Page
    {
        static List<DemoEmployee> employeeList = new List<DemoEmployee>();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                employeeList = GetEmployeeList();
                RadGrid1.DataSource = employeeList;
                RadGrid1.DataBind();
            }
        }
 
        protected void RadGrid_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridGroupHeaderItem)
            {
                (e.Item as GridGroupHeaderItem).Cells[0].Controls.Clear();
            }
 
            if (e.Item is GridFilteringItem)
            {
                System.Web.UI.HtmlControls.HtmlGenericControl dynDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
                dynDiv.ID = "imgHeaderExpandAndCollpase";
                dynDiv.Attributes.Add("class", "imageExpand");
                dynDiv.Attributes.Add("onclick", "javascript:ToggleGridRows()");
 
                (e.Item as GridFilteringItem).Cells[0].Controls.Add(dynDiv);
            }
 
            if (e.Item is GridPagerItem)
            {
                GridPagerItem pager = (GridPagerItem)e.Item;
 
                Label lblPager = new Label();
                lblPager.ID = "PageSizeLabel";
                lblPager.CssClass = "lblPageSize";
                lblPager.Text = "Records per Page:";
 
                RadComboBox combo = new RadComboBox();
                combo.ID = "PageSizeComboBox";
                combo.CssClass = "pagerCombo";
                combo.AutoPostBack = true;
 
 
                // Adding items to combobox
                combo.Items.Add(new RadComboBoxItem("10", "10"));
                combo.FindItemByText("10").Attributes.Add("ownerTableViewId",
                                                          RadGrid1.MasterTableView.ClientID);
                combo.Items.Add(new RadComboBoxItem("25", "25"));
                combo.FindItemByText("25").Attributes.Add("ownerTableViewId",
                                                          RadGrid1.MasterTableView.ClientID);
                combo.Items.Add(new RadComboBoxItem("50", "50"));
                combo.FindItemByText("50").Attributes.Add("ownerTableViewId",
                                                          RadGrid1.MasterTableView.ClientID);
                combo.Items.Add(new RadComboBoxItem("100", "100"));
                combo.FindItemByText("100").Attributes.Add("ownerTableViewId",
                                                           RadGrid1.MasterTableView.ClientID);
                combo.SelectedValue = "10";
                combo.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(combo_SelectedIndexChanged);
 
                e.Item.Controls[0].Controls[0].Controls[0].Controls[0].Controls.Add(lblPager);
 
                e.Item.Controls[0].Controls[0].Controls[0].Controls[0].Controls.Add(combo);
 
            }
        }
 
        private void combo_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            RefreshData();
        }
 
 
 
        protected void RadGridInner_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            RefreshData();
        }
 
        private void RefreshData()
        {
            RadGrid1.MasterTableView.PageSize = Convert.ToInt32("10");
            employeeList = GetEmployeeList();
            RadGrid1.DataSource = employeeList;
        }
 
         
 
        public static List<DemoEmployee> GetEmployeeList()
        {
            List<DemoEmployee> empList = new List<DemoEmployee>();
 
            for (int i = 1; i <= 30; i++)
            {
                DemoEmployee emp = new DemoEmployee();
                emp.ID = i;
                emp.FirstName = "FirstName " + i.ToString();
                emp.LastName = "LastName " + i.ToString();
                emp.DateOfJoin = DateTime.Now;
                emp.Designation = "Designation " + i.ToString();
                emp.CompanyName = "CompanyName " + i.ToString();
                List<Experience> experienceList = new List<Experience>();
                for (int j = 1; j <= 3; j++)
                {
                    Experience experience = new Experience();
                    experience.Company = "Company " + j.ToString();
                    experience.Years = j.ToString();
                    experience.Location = "Location " + j.ToString();
                    experienceList.Add(experience);
                }
 
                emp.ExperienceList = experienceList;
                empList.Add(emp);
            }
 
            return empList;
        }
    }
 
    [Serializable]
    public class DemoEmployee
    {
        public int ID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public DateTime DateOfJoin { get; set; }
        public string Designation { get; set; }
        public string CompanyName { get; set; }
        public List<Experience> ExperienceList { get; set; }
    }
 
    [Serializable]
    public class Experience
    {
        public string Company { set; get; }
        public string Years { set; get; }
        public string Location { set; get; }
    }
}


Can anyone suggest me how to overcome this situation. [PageSlider in Grid is not aligned properly in IE7]
Please don't advise to remove the 'div', we need that div.

Thanks,
Praveen 
Tsvetoslav
Telerik team
 answered on 02 Jul 2012
0 answers
93 views
I had worked a lot and now achieved percentage(%) instead of pixel(px) for telerik textboxes and combos.
mailtovargis@gmail.com
UI Dsgnr
Cochin
Vargis
Top achievements
Rank 1
 asked on 02 Jul 2012
1 answer
169 views
Hi.

How can i add new tab to a radTabstrip and then associate it with a PageView in the client side?
Princy
Top achievements
Rank 2
 answered on 02 Jul 2012
1 answer
169 views
Hi Team,

I've been struggling with this for couple of hours, the Combobox does not seem to fill up with the web service.
This is the web service i'm using

namespace WebApplication
{
    /// <summary>
    /// Summary description for vendorsearch
    /// </summary>
    [WebService(Namespace = "http://jnkdfjdf.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class comboboxsearch : System.Web.Services.WebService
    {
        [WebMethod]
        public IEnumerable GetItems(RadComboBoxContext context)
        {
            RadComboBoxData result = new RadComboBoxData();
            int numberOfItems = (int)(context["ItemsCount"] ?? 1000);
 
            List<ComboBoxItemData> items = new List<ComboBoxItemData>();
            for (int i = 0; i < numberOfItems; i++)
            {
                ComboBoxItemData itemData = new ComboBoxItemData();
                itemData.Text = "Item " + i;
                items.Add(itemData);
            }
 
            return items;
        }
    }


And here is the asp.net default.aspx code

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebApplication._Default" %>
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
 
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
     
 
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Panel1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
   <telerik:RadComboBox ID="RadComboBox1" CssClass="ComboBox" runat="server" Width="240px" Height="200px"
        OnClientItemsRequested="OnClientItemsRequested" OnClientItemsRequesting="OnClientItemsRequesting"
        EnableLoadOnDemand="true" OnClientDropDownClosed="OnClientDropDownClosed" EnableItemCaching="true">
        <ExpandAnimation Type="none" />
        <CollapseAnimation Type="none" />
        <WebServiceSettings Path="comboboxsearch.asmx" Method="GetItems" />
    </telerik:RadComboBox>
 
 
    <telerik:RadScriptBlock runat="Server" ID="RadScriptBlock1">
 
    </telerik:RadScriptBlock>
  
 
</asp:Content>

What could i be possibly doing wrong? , any help will be appreciated :) .


Cheers

Princy
Top achievements
Rank 2
 answered on 02 Jul 2012
3 answers
199 views
Hello
I am building a page where users can edit data
I have followed a sample case (http://demos.telerik.com/aspnet-ajax/grid/examples/programming/commanditem/defaultcs.aspx)
and here is my sample page (http://gaia.agraria.unitus.it/prova3.aspx)
The problem rise in the second grid after user selects a site: when you switch to edit mode, you can enter anything in the textbox.
In your sample, I tried to enter the string  SELECT * FROM MyTable DELETE FROM MyTable or other attempts with dangerous words (such as delete or drop) and the input was blocked.
But inspecting your code there I could not find anything about sql injection prevenction; that is, when I tried to replicate the test into my page, all data were dangerously inserted.
Is there a way to process data before the update operatione in the database?
Thanks
Diego
Radoslav
Telerik team
 answered on 02 Jul 2012
1 answer
102 views
Hi All,
We are developing product in asp.net using c sharp.How to bind multiple Roles and RoleFeaures in TreeList it involves Role as parent and RoleFeature as child. that means how to implement this and what is code to aspx and aspx.cs pages..that is when i click Role and list of RoleFeature will display inTreeList..How to implement this...

Thanks in Advance..!
Radoslav
Telerik team
 answered on 02 Jul 2012
1 answer
116 views
Dear All,

We are developing product in asp.net using c sharp in 4-tier architecture namely DataAccessLayer,BusinessLayer,ServiceLayer and PresentationLayer.I have 3 methods namely SelectRoles,SelectRoleFeatures and Assign And UnassignRoleFeatures to bind in RadTreeList and that we are having multiple roles and rolefeatures.Every role have rolefeatures.How to assign and unassign rolefeatures in checkbox at TreeList.How to bind Roles and RoleFeatures in Treelist and update role feature.

Thanks,
Radoslav
Telerik team
 answered on 02 Jul 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?