Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
225 views
Hi,

I want to validate usercontrol controls (client and server side) as the result of add/edit item of the grid.
Please refer to example from telerik website.
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx

I have set required field validator to the usercontrol fields but it doesnt fire validators on postback.
Any example is appreciated.

regards
Mac
Martin
Telerik team
 answered on 02 Apr 2010
1 answer
138 views
Hi,

I want to put a rename button on the toolbar, nothing sofisticated, so when I click it, show the rename popup just like grid context menu.

This is because I want to remove the context menu but I need to keep some functionalities.

Thanks
Rumen
Telerik team
 answered on 02 Apr 2010
2 answers
126 views
Hi All,
   I was having problems with RadListView and RadFormDecorator (standard skins) (version 2009.3.1208.35)
What happened was that alignment and background was not as expected.
When I started on this post I wanted to include markup that would show the issue, but instead I stumbled upon a setting that works in this case.

The soulution was to have RadFormDecorator skip fieldsets, the markup then looks like this.
 
    <telerik:radformdecorator id="FormDecorator1" runat="server" DecoratedControls="all" ControlsToSkip="Fieldset"  Enabled="true" > 
    </telerik:radformdecorator>   
 

The skin selection is in the web.config file.

Hope this can help someone else, since it had me puzzled for hours.
Björn
Petio Petkov
Telerik team
 answered on 02 Apr 2010
1 answer
158 views
Telerik experts,

       Here is my code. I can't update my dynamic RadGrid.
       Otherwise no problem to update a normally generated RadGrid. 

       I must be missing something very basic ...

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Northwind2.aspx.cs" Inherits="Northwind2" %>    
    
<!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">     
<head runat="server">     
    <title>Northwind2</title>    
</head>    
<body>    
    <form id="form1" runat="server">     
          <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />    
        <!-- content start -->    
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">     
            <AjaxSettings>       
                <telerik:AjaxSetting AjaxControlID="RadGrid2">        
                </telerik:AjaxSetting>       
            </AjaxSettings>       
        </telerik:RadAjaxManager>    
             
    <div>    
             
    <br />    
    <asp:PlaceHolder ID="PlaceHolder1" runat="server" />    
    <br />    
            <telerik:RadGrid ID="RadGrid2" EnableViewState="true" AllowAutomaticUpdates="True" OnUpdateCommand="grid_UpdateCommand"       
                OnNeedDataSource="RadGrid2_NeedDataSource" Width="400px"    
                runat="server" AutoGenerateColumns="false" AllowSorting="False" AllowMultiRowSelection="False" GridLines="None">                                    
            <MasterTableView ItemStyle-Wrap="false" Name="Employees" ShowHeader="true" DataKeyNames="EmployeeID"      
                EditMode="InPlace" BorderWidth="0" EnableColumnsViewState="true" Width="400px">                          
                <HeaderStyle Wrap="false" Height="20px" Font-Size="X-Small" Font-Bold="true"/>                   
                <AlternatingItemStyle Height="20px" BackColor="BlanchedAlmond" Wrap="false" BorderWidth="0" Font-Size="X-Small"/>        
                <ItemStyle Height="20px" BackColor="Azure" Wrap="false" BorderWidth="0" Font-Size="X-Small"/>                
                <EditItemStyle Height="20px" Wrap="false" BorderWidth="0" Font-Size="X-Small"/>          
                <Columns>       
                      <telerik:GridBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" ItemStyle-Height="20px" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="150" HeaderStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>                      
                      <telerik:GridBoundColumn DataField="LastName" HeaderText="LastName" ItemStyle-Height="20px" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="150" HeaderStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>                      
                      <telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" ItemStyle-Height="20px" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="150" HeaderStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>                      
                      <telerik:GridEditCommandColumn ></telerik:GridEditCommandColumn>    
                </Columns>                                          
            </MasterTableView>       
            <clientsettings allowexpandcollapse="false">                       
                    <Scrolling AllowScroll="false" UseStaticHeaders="true"></Scrolling>                                                                                          
            </clientsettings>        
        </telerik:RadGrid>      
    </div>    
    </form>    
</body>    
</html>    
    
'-------------------------------------------------------------     
'-------------------------------------------------------------     
'-------------------------------------------------------------     
    
using System;     
    
using System.Collections;     
using System.Collections.Generic;     
using System.Linq;     
    
using System.Web;     
using System.Web.UI;     
using System.Web.UI.WebControls;     
using System.Web.UI.HtmlControls;     
    
using System.Data;     
using System.Data.Sql;     
using System.Data.SqlClient;     
    
using Telerik.Web.UI;     
using System.Reflection;     
    
public partial class Northwind2 : System.Web.UI.Page     
{       
    //Declare a global DataTable dtTable1            
    DataTable dtTable1 = new DataTable();     
 
    
    protected void Page_Load(object sender, EventArgs e)     
    {     
    
    }     
    
    protected void Page_Init(object sender, System.EventArgs e)     
    {     
        PopulateGridOnPageInit();     
           
    }     
    
    protected void PopulateGridOnPageInit()     
    {            
        RadGrid grid = new RadGrid();     
        grid.ID = "grid";     
        grid.Width = Unit.Pixel(400);     
        grid.AllowSorting = true;     
        grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;     
        grid.AllowPaging = true;     
        grid.AllowAutomaticUpdates = false;     
        grid.Skin = "Sunset";     
    
        grid.MasterTableView.AutoGenerateColumns = false;     
        grid.MasterTableView.EnableColumnsViewState = false;     
        grid.MasterTableView.EditMode = GridEditMode.InPlace;     
        grid.MasterTableView.EnableViewState=true ;     
    
        grid.UpdateCommand +=new GridCommandEventHandler(grid_UpdateCommand);      
    
        GridBoundColumn boundColumn;     
             
        boundColumn = new GridBoundColumn();     
        boundColumn.HeaderText = "EmployeeID";     
        boundColumn.DataField = "EmployeeID";     
        //boundColumn.UniqueName = "EmployeeID";     
        grid.MasterTableView.Columns.Add(boundColumn);     
        boundColumn = new GridBoundColumn();     
        boundColumn.HeaderText = "LastName";     
        boundColumn.DataField = "LastName";     
        //boundColumn.UniqueName = "LastName";     
        grid.MasterTableView.Columns.Add(boundColumn);     
        boundColumn = new GridBoundColumn();     
        boundColumn.HeaderText = "FirstName";     
        boundColumn.DataField = "FirstName";     
        //boundColumn.UniqueName = "FirstName";     
        grid.MasterTableView.Columns.Add(boundColumn);     
    
    
             
        GridEditCommandColumn gcEdit = new GridEditCommandColumn();     
        grid.MasterTableView.Columns.Add(gcEdit);     
    
        grid.DataSource = LoadData();     
        grid.DataBind();     
    
        PlaceHolder1.Controls.Add(grid);     
    }     
    
    protected void RadGrid2_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)     
    {     
        RadGrid2.DataSource = LoadData();     
    }     
    
 
    
    protected void grid_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)     
    {     
        //Get the GridEditableItem of the RadGrid            
        GridEditableItem eeeditedItem = e.Item as GridEditableItem;     
        //Get the primary key value using the DataKeyValue.            
        string EmployeeID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["EmployeeID"].ToString();     
        //Access the textbox from the edit form template and store the values in string variables.            
        string LastName = (editedItem["LastName"].Controls[0] as TextBox).Text;     
        string FirstName = (editedItem["FirstName"].Controls[0] as TextBox).Text;     
    
        try     
        {     
            SqlConnection SqlConnection = new SqlConnection(GetConnectionString());     
            SqlCommand SqlCommand1 = new SqlCommand();     
            //Open the SqlConnection            
            SqlConnection.Open();     
            //Update Query to update the Datatable             
            string updateQuery = " UPDATE Employees " +     
                                 " SET    LastName='" + LastName + "'," +     
                                 "        FirstName='" + FirstName + "'" +      
                                 " WHERE  EmployeeID=" + EmployeeID ;     
            SqlCommand1.CommandText = updateQuery;     
            SqlCommand1.Connection = SqlConnection;     
            SqlCommand1.ExecuteNonQuery();     
            //Close the SqlConnection            
            SqlConnection.Close();     
    
    
        }     
        catch (Exception ex)     
        {     
            RadGrid2.Controls.Add(new LiteralControl("Unable to update Employee. Reason: " + ex.Message));     
            e.Canceled = true;     
        }     
        finally     
        {     
            RadGrid2.EditIndexes.Clear();     
        }     
    }     
    
    
    protected DataTable LoadData()     
    {     
        string connectionString = GetConnectionString();     
        SqlConnection SqlConnection = new SqlConnection(connectionString);     
    
        DataTable dtTable = new DataTable();     
        //Declare a global SqlDataAdapter SqlDataAdapter1            
        SqlDataAdapter SqlDataAdapter1 = new SqlDataAdapter();     
        //Declare a global SqlCommand SqlCommand            
        SqlCommand SqlCommand1 = new SqlCommand();     
    
        //Open the SqlConnection            
        SqlConnection.Open();     
        try     
        {     
            //Select Query to populate the RadGrid with data from table Employees.            
            string selectQuery = "SELECT EmployeeID, LastName, FirstName, Title, ReportsTo from Employees";     
            SqlDataAdapter1.SelectCommand = new SqlCommand(selectQuery, SqlConnection);     
            SqlDataAdapter1.Fill(dtTable);     
            return dtTable;     
        }     
        finally     
        {     
            //Close the SqlConnection            
            SqlConnection.Close();     
        }      
    }     
       
    static private string GetConnectionString()     
    {     
        return "server=STATION00374;database=Northwind;Integrated Security=SSPI;";     
    }       
      
}    
 
Pavlina
Telerik team
 answered on 02 Apr 2010
1 answer
157 views
Hi is there a way to apply a kind of MaxLength on a GridBoundColumn?

Lest assume you have a very long text like this one

Andrew_received_his_BTS_commercial_in_1974_and_a_Ph_D__in_international_marketing_from_the_University_of_Dallas_in_1981___He_is_fluent_in_French_and_Italian_and_reads_German___He_joined_the_company_as_a_sales_representative,_was_promoted_to_sales_manager_in_January_1992_and_to_vice_president_of_sales_in_March_1993___Andrew_is_a_member_of_the_Sales_Management_Roundtable,_the_Seattle_Chamber_of_Commerce,_and_the_Pacific_Rim_Importers_Association_

Go to http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx
Edit any row.
Paste the text above in the text fields and then click update.

How can we avoid displaying such long lines and breaking the grid?
Is there any mechanism that will display the first x characters followed by ...

ie : Andrew_received_his ...

thanks

Pierre
Dimo
Telerik team
 answered on 02 Apr 2010
1 answer
136 views
Hi

I would like to specify an icon for my custom context menu in my radEditor. 

I am able to display an icon for my toolbar as in the following:
<root> 
 
    <tools name="MainToolbar">  
        <tool name="tbiComment" showtext="true" Text="Mark as Comment" shortcut="CTRL+SHIFT+C"/>  
     

This works for my toolbar.
        .reToolbar.Default .tbiComment {  
           background-image: url(../images/comment.png);  
        }  
 

I have a custom contextmenu:
    <contextMenus> 
        <contextMenu forElement="comment">  
            <tool name="tbiEditComment" Text="Edit Comment" /> 
            <tool name="tbiRemoveComment" Text="Remove Comment" /> 
        </contextMenu> 

Just need the css to display a custom icon for my contextmenus. 

Thanks in advance... You guys Rock!
Rumen
Telerik team
 answered on 02 Apr 2010
1 answer
293 views
Hello,

Is there a way to display only folders, without files they contain and allows for selecting a folder ?

Thanks for help
CS
Lini
Telerik team
 answered on 02 Apr 2010
3 answers
105 views
I am using an editor and I implementing my own “set absolute position” command that’s very similar to what you have for an image but my commend button  can do tables, divs etc. The problem that I have is that user needs to do 4 steps to make it work. Here is a sequence
1. Select text that you want to absolute position
2. Click on the toolbar button (at this time I will do editor.getSelectedElement() and tuggle elem.style.position)
3. User needs to click outside the selected area so the text selection is removed
4. Click on div (handles show up) and now my element can be dragged

My question is how can I do steps 3 and 4 in JavaScript command handler? I think it has to be possible because I already have and element that I want to drag it.  I just need to change that element mode or something

Rumen
Telerik team
 answered on 02 Apr 2010
3 answers
96 views
I purchased Telerik Controls today (Premier Collection) and I am excited about the promise of these controls for my web site. However, a seemingly simple initial task has proven - well, problematic.

As background, we hired a vendor to create an ASP.Net application for us and this uses the RadGrid. This app is running fine in my development environment (VS 2008). I upgraded to the most recent (Marhc 2010) version and all seems to be running fine, which suggests all the basic plumbing is in place. However...

As a simple test I want to add a Captcha control to the form. I drop it into place from the Toolbox and can see the designer experience (including the arrow to pop up the context menu). However, none of the Captcha-specific options are available in that design-mode context menu. For example, the help suggests I should see an option "Enable RadCaptcha Http Handler". That option doesn't exist. That perhaps suggests that the handler is already in place but I then believe I should see additional options in the design mode, which allows me to actually configure the control (right?). I don't see any of these.

Finally, the design mode shows the "missing image" icon (a red X). Is that expected? Ironically, if I run the app I see the runtime captcha control. This is good but should I not be seeing a fill designer mode?

Thanks.

Mark
Lini
Telerik team
 answered on 02 Apr 2010
5 answers
156 views
I am trying to follow the RadChart Example http://www.telerik.com/demos/aspnet/prometheus/Controls/Examples/Integration/ChartAndToolTip/DefaultCS.aspx?product=chart

about adding a tooltip to series.

However my chart is a content page within a master page site and I have added my script manager to the master page. When the page with the chart loads I get an error

The control with ID 'RadToolTipManager1RTMPanel' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

Any help greatly appreciated
Tsvetie
Telerik team
 answered on 02 Apr 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?