Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
301 views
I am using a single grid with drag drop and wanted to know if it is possible to somehow indicate that a row is "un-dropable".  Basically, i am doing this in the code behind, but it would be nice to prevent it from the client side.  Also, is it possible to specify that a row cannot be dragged?  I have tried using the client side model from the examples, but if i cancel the event, then i cannot drag-drop on any other rows for a while.  It seems to "hang" before i can drag-drop again.
Ricardo Pinto
Top achievements
Rank 1
 answered on 17 Aug 2009
4 answers
218 views
Hi,

I have been trying to extend the Telerik RadGrid.
Right now my extended grids do nothing more than configure the grid and add a couple of columns, but in the future I might want to add more functionality.
But the grid doesn't show properly and doesn't function either if I use my extended grid. There is no GridClientSelectColumn, sorting doesn't work, the whole pager item is gone, when I try to resize I get this error message: "MS Jscript runtime error: 'this.HeaderRow.cells[...].ScrollWidth' is null or not an object.", the size of the columns isn't right and I'm missing the 'name' column (next to the GridClientSelectColumn it should also show columns for the guid, name, username, email and role) and when double clicking a row the corresponding javascript doesn't get the proper guid for that row anymore.
All of this did work when I just put a RadGrid in my aspx page and then configured everything on that grid.
I would upload a screenshot that clearly shows some of the problems if I knew how to do this.

This is what I did:
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using Telerik.Web.UI; 
using System.Web.UI.WebControls; 
using CMS.Process; 
using System.IO; 
using System.Drawing; 
 
namespace CMS.WebControls.Grid 
{ 
    public class BasicCmsGrid : Telerik.Web.UI.RadGrid 
    { 
        public BasicCmsGrid() : base() { } 
 
        protected override void OnLoad(EventArgs e) 
        { 
            base.OnLoad(e); 
 
            this.GridLines = GridLines.None; 
            this.AutoGenerateColumns = false; 
            this.AllowMultiRowSelection = true; 
            this.AllowFilteringByColumn = false; 
            this.AllowSorting = true; 
            this.AllowPaging = true; 
            this.PageSize = 7; 
            this.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; 
            this.PagerStyle.AlwaysVisible = true; 
 
            this.MasterTableView.RowIndicatorColumn.HeaderStyle.Width = Unit.Pixel(5); 
            this.MasterTableView.ExpandCollapseColumn.HeaderStyle.Width = Unit.Pixel(15); 
            this.MasterTableView.AllowMultiColumnSorting = false; 
 
            GridClientSelectColumn selectColumn = new GridClientSelectColumn(); 
            this.MasterTableView.Columns.Add(selectColumn); 
            selectColumn.HeaderStyle.Width = Unit.Pixel(15); 
            selectColumn.UniqueName = "CheckBoxcolumn"; 
 
            this.ClientSettings.AllowColumnsReorder = true; 
            this.ClientSettings.ReorderColumnsOnClient = true; 
 
            this.ClientSettings.Resizing.AllowColumnResize = true; 
            this.ClientSettings.Resizing.EnableRealTimeResize = true; 
            this.ClientSettings.Resizing.ClipCellContentOnResize = true; 
            this.ClientSettings.Resizing.ResizeGridOnColumnResize = false; 
 
            this.ClientSettings.Scrolling.SaveScrollPosition = true; 
            this.ClientSettings.Scrolling.UseStaticHeaders = true; 
            this.ClientSettings.Scrolling.AllowScroll = true; 
 
            this.ClientSettings.Selecting.AllowRowSelect = true; 
 
            this.ClientSettings.ClientEvents.OnRowSelecting = "CancelNonInputSelect"; 
            this.ClientSettings.ClientEvents.OnRowDeselecting = "CancelNonInputSelect"; 
            this.Page.ClientScript.RegisterClientScriptInclude("BasicCmsGridScript", Path.Combine(ConfigMan.Settings.BaseHref, "js/GridScripts/BasicCmsGridScript.js")); 
 
            ((CMS.Util.Page)this.Page).RegisterCssStyle(".rgAdvPart{ display:none;}");//hiding the page size selection controls 
        } 
 
        public override GridTableView CreateTableView() 
        { 
            return new BasicCmsGridTableView(this); 
        } 
 
        public override GridTableView MasterTableView 
        { 
            get 
            { 
                return base.MasterTableView; 
            } 
        } 
    } 
 
    public class BasicCmsGridTableView : GridTableView 
    { 
        public BasicCmsGridTableView() : base() { } 
 
        public BasicCmsGridTableView(RadGrid owner) : base(owner) { } 
 
        public BasicCmsGridTableView(RadGrid owner, bool isTrackingViewState) : base(owner, isTrackingViewState) { } 
 
        protected override GridTableView CreateTableView(RadGrid owner, bool isTrackingViewState) 
        { 
            return new BasicCmsGridTableView(owner, isTrackingViewState); 
        } 
    } 
} 
 
The CancelNonInputSelect JS function lets you (de)select a row only by (un)checking the checkbox in the GridClientSelectColumn and not by clicking anywhere else on a row. This still works properly.
If any contructor and such is redundant for my purposes please let me know. I have been looking around for more information and just tried anything I came across.

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using Telerik.Web.UI; 
using System.Web.UI.WebControls; 
using System.IO; 
using CMS.Process; 
 
namespace CMS.WebControls.Grid 
{ 
    public class CmsUsersGrid : BasicCmsGrid 
    { 
        public CmsUsersGrid() : base() { } 
 
        protected override void OnLoad(EventArgs e) 
        { 
            base.OnLoad(e); 
 
            this.MasterTableView.NoMasterRecordsText = "Geen gebruikers om te tonen."; 
 
            GridBoundColumn guidColumn = new GridBoundColumn(); 
            this.MasterTableView.Columns.Add(guidColumn); 
            guidColumn.DataField = "Guid"; 
            guidColumn.DataType = typeof(System.Guid); 
            guidColumn.UniqueName = "Guid"; 
            guidColumn.Visible = false; 
            guidColumn.ReadOnly = true; 
 
            GridBoundColumn nameColumn = new GridBoundColumn(); 
            this.MasterTableView.Columns.Add(nameColumn); 
            nameColumn.DataField = "Name"; 
            nameColumn.HeaderText = "Naam"; 
            nameColumn.SortExpression = "Name"; 
            nameColumn.UniqueName = "Name"; 
            nameColumn.HeaderStyle.Width = Unit.Pixel(105); 
 
            GridBoundColumn usernameColumn = new GridBoundColumn(); 
            this.MasterTableView.Columns.Add(usernameColumn); 
            usernameColumn.DataField = "Username"; 
            usernameColumn.HeaderText = "Gebruikersnaam"; 
            usernameColumn.SortExpression = "Username"; 
            usernameColumn.UniqueName = "Username"; 
            usernameColumn.HeaderStyle.Width = Unit.Pixel(105); 
 
            GridBoundColumn emailColumn = new GridBoundColumn(); 
            this.MasterTableView.Columns.Add(emailColumn); 
            emailColumn.DataField = "Email"; 
            emailColumn.HeaderText = "Emailadres"; 
            emailColumn.SortExpression = "Email"; 
            emailColumn.UniqueName = "Email"; 
            emailColumn.HeaderStyle.Width = Unit.Pixel(105); 
 
            GridBoundColumn roleColumn = new GridBoundColumn(); 
            this.MasterTableView.Columns.Add(roleColumn); 
            roleColumn.DataField = "Role"; 
            roleColumn.HeaderText = "Rol"; 
            roleColumn.SortExpression = "Role"; 
            roleColumn.UniqueName = "Role"; 
            roleColumn.HeaderStyle.Width = Unit.Pixel(105); 
 
            this.MasterTableView.ClientDataKeyNames = new String[] { "Guid" }; 
 
            this.ClientSettings.ClientEvents.OnRowDblClick = "RowDblClick"; 
            this.Page.ClientScript.RegisterClientScriptInclude("UsersGridAdditionalScript", Path.Combine(ConfigMan.Settings.BaseHref, "js/GridScripts/UsersGridAdditionalScript.js")); 
        } 
 
        public override GridTableView CreateTableView() 
        { 
            return new CmsUsersGridTableView(this); 
        } 
 
        public override GridTableView MasterTableView 
        { 
            get 
            { 
                return base.MasterTableView; 
            } 
        } 
    } 
 
    public class CmsUsersGridTableView : GridTableView 
    { 
        public CmsUsersGridTableView() : base() { } 
 
        public CmsUsersGridTableView(RadGrid owner) : base(owner) { } 
 
        public CmsUsersGridTableView(RadGrid owner, bool isTrackingViewState) : base(owner, isTrackingViewState) { } 
 
        protected override GridTableView CreateTableView(RadGrid owner, bool isTrackingViewState) 
        { 
            return new CmsUsersGridTableView(owner, isTrackingViewState); 
        } 
    } 
} 
 
Some texts are in Dutch.
The RowDblClick JS sends you to the details page of the corresponding user, or at least it is supposed to.
Again there might be redundant constructors and methods here.

And this is where I try to use the CmsUsersGrid:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Gebruikers_List.aspx.cs" Inherits="CMS.Views.Beheer.Gebruikers.Gebruikers_List" %> 
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
<%@ Register Assembly="CMS" Namespace="CMS.WebControls.Grid" TagPrefix="CmsGrids" %> 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
 
<html> 
<head runat="server"> 
    <title>Gebruikers overzicht</title> 
    <link rel="stylesheet" type="text/css" href="../../../Layout/stylesheet.css" /> 
</head> 
 
<body> 
    <form id="form1" runat="server"> 
        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <asp:UpdatePanel ID="upUsersList" runat="server"> 
        <ContentTemplate> 
            <CmsGrids:CmsUsersGrid ID="rgUsersGrid" runat="server" onneeddatasource="rgUsersGrid_NeedDataSource" /> 
        </ContentTemplate> 
        </asp:UpdatePanel> 
    </form> 
</body> 
</html> 
 

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
 
using CMS.Business; 
 
using Telerik.Web.UI; 
using System.Data; 
using CMS.Process; 
using CMS.Util; 
 
namespace CMS.Views.Beheer.Gebruikers 
{ 
    /// <summary> 
    ///     shows a list of all users 
    /// </summary> 
    public partial class Gebruikers_List : CMS.Util.Page 
    { 
        private IOrderedEnumerable<CMSUser> _users = null; 
 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            RetrieveObjects(); 
 
            if (!IsPostBack) 
            { 
                InitForm(); 
            } 
        } 
 
        private void RetrieveObjects() 
        { 
            //get all users, ordered by name 
            _users = CMSUser.RetrieveAll().ToList().OrderBy(u => u.ToString()); 
        } 
 
        private void InitForm() 
        { 
            //GridConfigor.ConfigAsUsersGrid(rgUsersGrid, this); 
        } 
 
        protected void rgUsersGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
        { 
            DataTable table = new DataTable("xxx"); 
            table.Columns.Add("Guid"); 
            table.Columns.Add("Name"); 
            table.Columns.Add("UserName"); 
            table.Columns.Add("Email"); 
            table.Columns.Add("Role"); 
            foreach (CMSUser user in _users) 
            { 
                table.Rows.Add(user.usr_GUID, user.ToString(), user.usr_username, user.usr_email, (UserRole)user.usr_role); 
            } 
 
            rgUsersGrid.DataSource = table; 
        } 
    } 
} 
 

Please help me out with this one.

Regards,

Mink

Mink
Top achievements
Rank 1
 answered on 17 Aug 2009
1 answer
104 views
Hello,
I have a Sharepoint Site with a list which has 4 fields : name, Sirname, Department,Section. I want to have a grid which will have dynamic filtering on each of these fileds. So, when I type C in field name, the grid will show all the rows where names start witn C . If I type D in the Sirename fields, the grid will show all the rows where sirename starts with c and so on.
Dows Grid has these functionality?
If not, what will be the best approach using telerik products?
Also, If I don't want filtering but the grid to show rows greater that equal to the letters i type (same functionality that outlook has in address book.
Thank you
Mr. Plinko
Top achievements
Rank 1
 answered on 17 Aug 2009
1 answer
88 views
I'm adding values to a custom DropDownList on the server w/ the following format:

<img fieldName=\"{0}\" tableName=\"{1}\" alt=\"[{2}]\" style=\"font-weight: bold\" />

When the user selects one of the values in the DropDownList, the OnClientCommandExecuting pastes the value of the selectedItem
as follows:



function templateEditorOnClientCommandExecuting(sender, eventArgs) 
            { 
                var name = eventArgs.get_name(); 
                var val = eventArgs.get_value(); 
                                 
                if(name == "Fields") 
                { 
                    if(val != null && val != '') 
                    { 
                        sender.pasteHtml(val); 
                    } 
                    else 
                    { 
                        alert('Select a Template Type first'); 
                    } 
                     
                    eventArgs.set_cancel(true); 
                } 
            }      

The pasted value is as follows:

<img style=\"font-weight: bold;\" alt=\"[Address]\" tablename=\"Organization\" fieldname=\"MailAddress1\" />

Why is the order of the attributes of my img element on the client different than what I explicitly set on the server?  I'm trying to write a regular expression to do a replace of the img tag when the form is submitted, but I'm not able to due to the issue described above.


Rumen
Telerik team
 answered on 17 Aug 2009
2 answers
261 views
I have some JS functions that retrieve a latitude and longitude and set a couple radtextboxes to the value. The only problem is, they don't set these textboxes to the value until after you mouse into them. What happens is the user fills in address information. I then take that and parse it with google's gmap api to get a lat and lon. I set the textboxes value to those but it won't show up until you mouse into them. I need it to show as soon as it finds it. Here is my code
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/admin/Admin.Master"
    CodeBehind="AddBusiness.aspx.vb" Inherits="ClickableCommunity.AddBusiness" %>

<%@ Register Assembly="RadMenu" Namespace="Telerik.WebControls" TagPrefix="radM" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <telerik:RadScriptBlock ID="ScriptBlock1" runat="server">
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAANvmC5YwARPSDAHoiTGyjXRR-496V5WiR7LkdzcFVQzFkDe07hhSkvWarTS8udi3TGEWMPQwT-FAGew"
        type="text/javascript"></script>
        <script type="text/javascript">
            function getLatLon(sender, args) {

                var street = $find('<%= streetInput.ClientID %>').get_value();
                var city = $find('<%= cityInput.ClientID %>').get_value();
                var state = $find('<%= stateInput.ClientID %>').get_value();
                var zip = $find('<%= zipInput.ClientID %>').get_value();
                var address = (street + " " + city + ", " + state + " " + zip);

                geocodeAddress(address);
            } //getLatLon

            //this function takes in an address and returns
            //the lattitude and longitude.
            function geocodeAddress(address) {
                var coder = new GClientGeocoder();
                coder.getLatLng(address,
                  function(point) {
                      if (!point) {
                          alert(address + " not found");
                      } //if

                      //we set the textboxes to their values
                      else {
                          //this is where it sets the rad textboxes values
                          //to set instantly but they only set when you mouse in
                          var templat = $get('<%= latInput.ClientID %>');
                          var templon = $get('<%= lonInput.ClientID %>');
                          templat.value = point.lat();
                          templon.value = point.lng();
                          
                      } //else
                  } //function(point)
                );
            }//geocodeAddress           
        </script>

    </telerik:RadScriptBlock>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="header" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <table cellpadding="30" width="350px">
        <tr>
            <td>
                <span class="addBusinessLabel">Business Name</span>
                <telerik:RadTextBox ID="businessNameInput" runat="server" Skin="Web20" Width="150px">
                </telerik:RadTextBox>
            </td>
            <td>
                <span class="addBusinessLabel">User</span>
                <telerik:RadComboBox ID="RadComboBox2" runat="server" Skin="Web20" Width="150px">
                </telerik:RadComboBox>
            </td>
        </tr>
        <tr>
            <td>
                <span class="addBusinessLabel">Street Address</span>
                <telerik:RadTextBox ID="streetInput" runat="server" Skin="Web20" Width="150px">
                </telerik:RadTextBox>
            </td>
            <td>
                <span class="addBusinessLabel">City</span>
                <telerik:RadTextBox ID="cityInput" runat="server" Skin="Web20" Width="150px">
                </telerik:RadTextBox>
            </td>
        </tr>
        <tr>
            <td>
                <center>
                    <span class="addBusinessLabel">State</span>
                    <telerik:RadComboBox ID="stateInput" runat="server" Skin="Web20" Width="150px" ChangeTextOnKeyBoardNavigation="true"
                        MarkFirstMatch="true" DropDownWidth="150px">
                        <Items>
                            <telerik:RadComboBoxItem Text="Alabama" Value="AL" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Alaska" Value="AK" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Arizona" Value="AZ" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Arkansas" Value="AR" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="California" Value="CA" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Colorado" Value="CO" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Connecticut" Value="CT" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Delaware" Value="DE" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="District Of Columbia" Value="DC" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Florida" Value="FL" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Georgia" Value="GA" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Hawaii" Value="HI" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Idaho" Value="ID" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Illinois" Value="IL" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Indiana" Value="IN" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Iowa" Value="IA" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Kansas" Value="KS" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Kentucky" Value="KY" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Louisiana" Value="LA" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Maine" Value="ME" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Maryland" Value="MD" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Massachusetts" Value="MA" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Michigan" Value="MI" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Minnesota" Value="MN" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Mississippi" Value="MS" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Missouri" Value="MO" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Montana" Value="MT" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Nebraska" Value="NE" CssClass="stateDropDownText" Selected="true" />
                            <telerik:RadComboBoxItem Text="Nevada" Value="NV" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="New Hampshire" Value="NH" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="New Jersey" Value="NJ" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="New Mexico" Value="NM" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="New York" Value="NY" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="North Carolina" Value="NC" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="North Dakota" Value="ND" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Ohio" Value="OH" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Oklahoma" Value="OK" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Oregon" Value="OR" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Pennsylvania" Value="PA" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Rhode Island" Value="RI" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="South Carolina" Value="SC" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="South Dakota" Value="SD" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Tennessee" Value="TN" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Texas" Value="TX" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Utah" Value="UT" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Vermont" Value="VT" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Virginia" Value="VA" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Washington" Value="WA" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="West Virginia" Value="WV" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Wisconsin" Value="WI" CssClass="stateDropDownText" />
                            <telerik:RadComboBoxItem Text="Wyoming" Value="WY" CssClass="stateDropDownText" />
                        </Items>
                    </telerik:RadComboBox>
                </center>
            </td>
            <td>
                <span class="addBusinessLabel">Zip</span> <span style="width: 150px">
                    <telerik:RadTextBox ID="zipInput" runat="server" Skin="Web20" Width="150px">
                        <ClientEvents OnBlur="getLatLon" />
                    </telerik:RadTextBox>
                </span>
            </td>
        </tr>
        <tr>
            <td>
                <span class="addBusinessLabel">Latitude</span>
                <telerik:RadTextBox ID="latInput" runat="server" Skin="Web20" Width="150px">
                </telerik:RadTextBox>
            </td>
            <td>
                <span class="addBusinessLabel">Longitude</span>
                <telerik:RadTextBox ID="lonInput" runat="server" Skin="Web20" Width="150px">
                </telerik:RadTextBox>
            </td>
        </tr>
    </table>
</asp:Content>
Thanks,
Web Services
Top achievements
Rank 2
 answered on 17 Aug 2009
1 answer
143 views
I tried your example application with automatic database update you provided in this article: databaseupdate.
It works as long as I set the TransferMode="move". As soon as I try to copy the data with TransferMode="copy", I get a System.NullReferenceException.

[NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.]  
   Telerik.Web.UI.RadListBoxItem.ExtractValues() +10  
   Telerik.Web.UI.RadListBox.PerformInsert(IList`1 items, Int32 position) +251  
   Telerik.Web.UI.RadListBox.PerformTransfer(RadListBox sourceListBox, RadListBox destinationListBox, IList`1 items) +852  
   Telerik.Web.UI.RadListBox.Transfer(IList`1 itemsToTransfer, RadListBox sourceListBox, RadListBox destinationListBox) +184  
   Telerik.Web.UI.RadListBox.OnTransfer(ListBoxPostBackCommand command, Func`2 callback) +137  
   Telerik.Web.UI.RadListBox.RaisePostBackEvent(String eventArgument) +292  
   Telerik.Web.UI.RadListBox.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10  
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13  
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175  
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565  
 

The example code is:

<asp:ScriptManager runat="server" ID="ScriptManager1">  
    </asp:ScriptManager> 
    <div> 
        <telerik:RadListBox   
            runat="server"   
            ID="RadListBox1"   
            AllowTransfer="True" 
            TransferMode="Copy" 
            AllowDelete="false" 
            AutoPostBackOnTransfer="true" 
            AllowAutomaticUpdates="true"   
            TransferToID="RadListBox2"   
            DataSourceID="SqlDataSource1"   
            DataKeyField="ID"   
            DataTextField="Value"   
            DataValueField="ID">  
        </telerik:RadListBox> 
        <telerik:RadListBox ID="RadListBox2" runat="server"   
            AllowAutomaticUpdates="True"   
            DataKeyField="ID" 
            DataSourceID="SqlDataSource2"   
            DataTextField="Value"   
            DataValueField="ID">  
        </telerik:RadListBox> 
          
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"   
            ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"   
            SelectCommand="SELECT * FROM [Table1]"   
            ConflictDetection="CompareAllValues"   
            DeleteCommand="DELETE FROM [Table1] WHERE [ID] = @original_ID AND (([Value] = @original_Value) OR ([Value] IS NULL AND @original_Value IS NULL))"   
            InsertCommand="INSERT INTO [Table1] ([Value]) VALUES (@Value)"   
            OldValuesParameterFormatString="original_{0}"   
            ondeleting="SqlDataSource1_Deleting"   
            UpdateCommand="UPDATE [Table1] SET [Value] = @Value WHERE [ID] = @original_ID AND (([Value] = @original_Value) OR ([Value] IS NULL AND @original_Value IS NULL))">  
            <DeleteParameters> 
                <asp:Parameter Name="original_ID" Type="Int32" /> 
                <asp:Parameter Name="original_Value" Type="String" /> 
            </DeleteParameters> 
            <UpdateParameters> 
                <asp:Parameter Name="Value" Type="String" /> 
                <asp:Parameter Name="original_ID" Type="Int32" /> 
                <asp:Parameter Name="original_Value" Type="String" /> 
            </UpdateParameters> 
            <InsertParameters> 
                <asp:Parameter Name="Value" Type="String" /> 
            </InsertParameters> 
        </asp:SqlDataSource> 
        <asp:SqlDataSource ID="SqlDataSource2" runat="server"   
            ConflictDetection="CompareAllValues"   
            ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"   
            DeleteCommand="DELETE FROM [Table2] WHERE [ID] = @original_ID AND (([Value] = @original_Value) OR ([Value] IS NULL AND @original_Value IS NULL))"   
            InsertCommand="INSERT INTO [Table2] ([Value]) VALUES (@Value)"   
            OldValuesParameterFormatString="original_{0}"   
            SelectCommand="SELECT * FROM [Table2]"   
            UpdateCommand="UPDATE [Table2] SET [Value] = @Value WHERE [ID] = @original_ID AND (([Value] = @original_Value) OR ([Value] IS NULL AND @original_Value IS NULL))">  
            <DeleteParameters> 
                <asp:Parameter Name="original_ID" Type="Int32" /> 
                <asp:Parameter Name="original_Value" Type="String" /> 
            </DeleteParameters> 
            <UpdateParameters> 
                <asp:Parameter Name="Value" Type="String" /> 
                <asp:Parameter Name="original_ID" Type="Int32" /> 
                <asp:Parameter Name="original_Value" Type="String" /> 
            </UpdateParameters> 
            <InsertParameters> 
                <asp:Parameter Name="Value" Type="String" /> 
            </InsertParameters> 
        </asp:SqlDataSource> 

Genady Sergeev
Telerik team
 answered on 17 Aug 2009
1 answer
61 views
Hello,

I have a RadGrid where some columns have RadNumericTextBox. So in total I have 100 textboxes. When the page loads the textboxes appear in one style, then the clien freezes for a few seconds and they go to the required style.

Is there a soultion for this? Or perhaps there is another way of have a grid where multiple fields are open for edit and it's numbers only.


Thanks,

Vlad
Telerik team
 answered on 17 Aug 2009
3 answers
157 views

<

 

telerik:RadToolTipManager ID="HierarchyManagerToolTip" runat="server" Position="TopRight"

 

 

RelativeTo="Element" AutoTooltipify="false" Sticky="true" MouseTrailing="true" OffsetY="0">

 

 

</telerik:RadToolTipManager>

 



I have a user control and inside it I have a custom control Dropdown..Everytime I mouse over my custom Dropdown it  calls a webservice and tooltip shows all the info as needed ..So far it is working great..
But now the tooltips show in all the dropdown which I don't need it all. It show the word in the Dropdown.
 I though that AutoTooltipify="false" would solve my problem, but it  doesn't .. I also have set AutoTooltipify for every postback..still not solved..


thanks,
DIP
Dip
Top achievements
Rank 1
 answered on 17 Aug 2009
3 answers
82 views

OnRowDblClick

 

event is not working in firefox. However it works in IE.

Here is my code:

 

<

 

ClientSettings EnablePostBackOnRowClick="True">

 

 

<Selecting AllowRowSelect="True" />

 

 

<ClientEvents OnRowDblClick="OnGridRowDblClick" OnRowCreating="OnGridRowCreating" />

 

 

</ClientSettings>

 

Vlad
Telerik team
 answered on 17 Aug 2009
3 answers
109 views
This page http://alpha.clickablecommunity.com/ views fine in IE 8 and FF. However it is all messed up in IE 7 and I can't seem to get it fixed. Can you provide some help. Here is my master page and css.
<%@ Master Language="VB" AutoEventWireup="false" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register TagPrefix="sidepanel" TagName="sidebar" src="/ascx/leftMenu.ascx"%>
<%@ Register TagPrefix="loginDivTemplate" TagName="login" src="/ascx/loginTemplate.ascx"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.Sql" %>
<%@ import namespace="System.Data.SqlClient" %>
<%@ import namespace="Telerik.Web.UI" %>
<head id="Head1" runat="server">
    <link href="ClickableCommunity.css" rel="stylesheet" type="text/css" />
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body id="MasterBody" runat="server" style="margin: 0px; height: 100%; overflow: hidden;"
    scroll="no">
    <form id="Form1" method="post" runat="server" style="height: 100%">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <br />
    <asp:ContentPlaceHolder ID="header" runat="server">
    </asp:ContentPlaceHolder>
    <div id="loginDiv">
        <loginDivTemplate:login id="loginPanelContent" runat="server"></loginDivTemplate:login>
    </div>
    <div id="topDiv">
        <div id="image" class="topDivImage">
            <img src="images/logo.jpg" alt="Clickable Community Logo" width="200" height="75" />
        </div>
        <div id="viewMenu" class="viewMenu">
            Menu goes here
        </div>
    </div>
    <telerik:RadSplitter ID="RadSplitter1" runat="server" Orientation="Vertical" Width="100%"
        Height="100%" CssClass="AllContent" LiveResize="true">
        <telerik:RadPane ID="LeftRadPane1" runat="server" Width="220px" Scrolling="Both"
            BorderStyle="None" BorderSize="0">
            <div id="leftPanel">
                <sidepanel:sidebar id="leftPanelContent" runat="server"></sidepanel:sidebar>
            </div>
        </telerik:RadPane>
        <telerik:RadSplitBar runat="server" ID="RadSplitBar2" CollapseMode="Forward" EnableResize="false"
            ForeColor='Green' />
        <telerik:RadPane ID="RightRadPane1" runat="server" CssClass="RightPanelPadding" Scrolling="Both"
            BorderStyle="None" BorderSize="0">
            <asp:ContentPlaceHolder ID="MainContent" runat="server">
            
            </asp:ContentPlaceHolder>
        </telerik:RadPane>
        
    </telerik:RadSplitter>
    </form>
</body>
</html>
in the panel MainContent I load this control
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Map.ascx.vb" Inherits="ClickableCommunity.Map" %>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAANvmC5YwARPSDAHoiTGyjXRR-496V5WiR7LkdzcFVQzFkDe07hhSkvWarTS8udi3TGEWMPQwT-FAGew"
        type="text/javascript"></script>

    <script type="text/javascript">
        
        function loadEarth(mapdiv) {
            
            if (GBrowserIsCompatible()) {
                
                var point;
                if (!mapdiv) return true;
                
                //find the div
                map = new GMap2(document.getElementById(mapdiv));

                //this will add a map overview in the bottom
                //right hand corner
                //map.addControl(new GOverviewMapControl());

                //enable the zooming
                map.enableDoubleClickZoom();
                map.enableScrollWheelZoom();

                //add the different map types i.e. satellite street hybrid
                map.addControl(new GMapTypeControl());
                //add the zoom + and - buttons
                map.addControl(new GSmallMapControl());

                //call the function that adds the menu
                //when the user right clics
                //createContextMenu(map);

                //set the center, position, and type of map to start with
                map.setCenter(new GLatLng(40.7001, -99.0844), 15);
                map.setMapType(G_NORMAL_MAP);

                geocoder = new GClientGeocoder();

                //if we wanted to draw a polyline we would uncomment this code

                //var polyline = new GPolyline([new GLatLng(37.4419, -122.1419),
                //new GLatLng(37.4519, -122.1519),
                //new GLatLng(37.4619, -122.1819)], "#3333cc", 10);
                //map.addOverlay(polyline);

            } //if gbrowseriscompatible
            else {
                document.getElementById(mapdiv).innerHTML = "Sorry, your browser is not compatible" +
                                                        "with our maps application<br>" +
                                                        "Please try updating to a newer version of your browser.";
            }

        } //loadEarth

        function createContextMenu(localmap) {
            contextmenu = document.createElement("rightClickDiv");
            contextmenu.style.visibility = "hidden";
            contextmenu.style.background = "#ffffff";
            contextmenu.style.border = "1px solid #8888FF";

            contextmenu.innerHTML = "<a href='javascript:zoomIn()'>" +
                                    "<div class='context'>  Zoom in  </div></a>" +
                                    "<a href='javascript:zoomOut()'>" +
                                      "<div class='context'>  Zoom out  </div></a>" +
                                    "<a href='javascript:zoomInHere()'>" +
                                      "<div class='context'>  Zoom in here  </div></a>" +
                                    "<a href='javascript:zoomOutHere()'>" +
                                    "<div class='context'>  Zoom out here  </div></a>" +
                                    "<a href='javascript:centerMapHere()'>" +
                                      "<div class='context'>  Centre map here  </div></a>";

            localmap.getContainer().appendChild(contextmenu);
            GEvent.addListener(localmap, "singlerightclick",
                  function(pixel, tile) {
                      clickedPixel = pixel;
                      var x = pixel.x;
                      var y = pixel.y;
                      if (x > localmap.getSize().width - 120) {
                          x = localmap.getSize().width - 120
                      } //if
                      if (y > localmap.getSize().height - 100) {
                          y = localmap.getSize().height - 100
                      } //if
                      var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(x, y));
                      pos.apply(contextmenu);
                      contextmenu.style.visibility = "visible";
                  } //function(pixel, tile)
             ); //GEvent.addListener

            GEvent.addListener(localmap, "click",
                  function() {
                      contextmenu.style.visibility = "hidden";
                  } //function
             ); //GEvent.addlistener
        } //createContextMenu
        function zoomIn() {
            localmap.zoomIn();
            contextmenu.style.visibility = "hidden";
        } //zoomIn      
        function zoomOut() {
            localmap.zoomOut();
            contextmenu.style.visibility = "hidden";
        } //zoomOut      
        function zoomInHere() {
            var point = map.fromContainerPixelToLatLng(clickedPixel)
            localmap.zoomIn(point, true);
            contextmenu.style.visibility = "hidden";
        } //zoomInHere      
        function zoomOutHere() {
            var point = map.fromContainerPixelToLatLng(clickedPixel)
            localmap.setCenter(point, map.getZoom() - 1);
            contextmenu.style.visibility = "hidden";
        } //zoomOutHere      
        function centerMapHere() {
            var point = map.fromContainerPixelToLatLng(clickedPixel)
            localmap.setCenter(point);
            contextmenu.style.visibility = "hidden";
        } //centerMapHere

    </script>
<div id="divMap">
</div>




CSS Page


body {
height:100%;
}
#leftPanel{
    display:inline;
    height:500px;
    width:220px;
    border-top-style: none;
    border-right-style: none;
    border-left-style: none;
        
}
.loginLabel{
    padding-right: 10px;
    padding-bottom: 10px;
}
.loginTextBox{
    width: 120px;
}
.leftPanelContent{
    padding-bottom: 30px;
}
#topDiv{
    height: 60px;
    border-bottom-width: 4px;
    border-bottom-color: Gray;
    border-bottom-style:groove;
        
}
#loginDiv{
    position: absolute;
    display:inline;
    right: 10px;
    top: 5px;
}
#menuDiv{
    position: absolute;
    padding-top: 75px;
    margin-left: auto;
    margin-right:auto;
}
.AllContent{
    border-right: none;
    
}
.addBusinessLabel{
    padding-top: 5px;
    padding-bottom: 2px;
    text-align: center;
    display: block;
}
.addBusinessTextBox{
    width:150px;
    text-align:center;
}
#MainContent{
    display:inline;
    height:500px;
    width:400px;
}
.displayInline{
    display: inline;
}
#divMap{
    height:480px;
    width:700px;
    border: groove 4px #EEEEEE;
    border-right: groove 4px #EEEEEE;
    margin-left: auto;
    margin-right: auto;
}
.RightPanelPadding
{
    position: relative;
    height:500px;
    padding-left: 35px;
    padding-top:10px;
    
}
.topDivImage{
position: absolute;
top: 0;
left: 0;
display:inline;
width:220px;
}
.viewMenu{
padding-left:220px;
margin-right:auto;
margin-left:auto;
text-align:center;
width:800px;
vertical-align:bottom;
padding-top: 46px;
}
.emptyTextboxText{

    font-style:italic;
    font-size:10px;
    color: #D8D8D8;

}

Thanks,
Svetlina Anati
Telerik team
 answered on 17 Aug 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?