Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
146 views
Hi, is there a way I can query all events that will occur between now and the next 7 days?  I need to include individual recurrence events as well.
Thank you
T. Tsonev
Telerik team
 answered on 02 Apr 2010
1 answer
191 views
I am working on telerik treeview control and I want to display all the nodes that are parent in bold. The treeview is created dynamically as in the treeview is bound to a Sql Server database. How can I display the parent nodes in bold.

reply me at ur earliest
thanks
Asim Ali
Veronica
Telerik team
 answered on 02 Apr 2010
3 answers
199 views
Probably a shameful noob question: I'm generating a series of buttons on page load from a SQL datasource using XSL. I'm having an issue with radConfirm and the postback. My confirm dialog shows up, but clicking OK doesn't trigger the underlying Command.

<asp:ImageButton ID="b_RemoveMod_{@mID}" runat="server"
     ImageUrl
="~\Images\12.png" AlternateText="Remove Module" CssClass="hideMe"
    
CommandName="RemoveModule"
     CommandArgument
="{@mID}"
    
OnCommand="ImageButton_onCommand"
     onClientClick
="radconfirm('Are you sure you want to delete the module and return it to inventory?',
          confirmRemoveMod, 300, 140, null, 'Confirm Module Removal');"
 /> 

I'm not sure what the first parameter of the __doPostBack should be (and heck, I'm not that confident in the second parameter, neither). If it were always a single button, I suspect the first parameter would be something like <%= Button.ClientID %>. But how do I get the ID of the clicked image button when I don't know it's ID ahead of time? There could be one, there could be 20.
function confirmRemoveMod(arg) { 
     if (arg == true) { 
          __doPostBack('''ImageButton_onCommand#RemoveModule'); 
     } 

Tsvetie
Telerik team
 answered on 02 Apr 2010
3 answers
159 views
Hello Team,

I need to provide a Confirm dialog to proceed by check some validations of Parent and Detail table controls.

1. How do I get the values of Child edit form control on client side?
2. I have written onclientclick event on update button, but the post back happens though it returns false.... I had set causes validation property to true?
3. Finally I am planning to write on server side validation to check for parent item value and detail table edit form control. Which event needs to be handled in this case. I shud show confirm dialog on validation. How do I achieve this?

Please provide me pointers.

Reg
Prema
Pavlina
Telerik team
 answered on 02 Apr 2010
1 answer
181 views
Hi,

We have a base page where we need to traverse through all controls on the current page instance and set them to ReadOnly mode.
This works fine for most of the controls but does not work for RadComboBox.  Process never gets into if (cntrl is RadComboBox) clause. Here is the function:
       private void SetControlReadOnly(Control cntrl) 
        { 
            if (cntrl.HasControls()) 
            { 
                foreach (Control nestedContrl in cntrl.Controls) 
                { 
                    SetControlReadOnly(nestedContrl); 
                } 
            } 
            else 
            { 
                if (cntrl is RadComboBox) 
                { 
                    RadComboBox ddl = (RadComboBox)cntrl; 
                    ddl.Enabled = false
                } 
                else if (cntrl is RadInputControl) 
                { 
                    SetRadInputControlReadOnly((RadInputControl)cntrl); 
                } 
                else if (cntrl is CheckBox) 
                { 
                    CheckBox chk = ((CheckBox)cntrl); 
                    chk.Enabled = false
                } 
                else if (cntrl is TextBox) 
                { 
                    TextBox txt = ((TextBox)cntrl); 
                    txt.Enabled = true
                    txt.ReadOnly = true
                    txt.ForeColor = System.Drawing.Color.Black; 
                } 
            } 
 
        } 
 
 
        private void SetRadInputControlReadOnly(RadInputControl input) 
        { 
            input.Enabled = true
            input.ReadOnly = true
            //input.BorderStyle = BorderStyle.None; 
            input.DisabledStyle.ForeColor = System.Drawing.Color.Black; 
        } 
Kalina
Telerik team
 answered on 02 Apr 2010
3 answers
217 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
130 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
118 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
148 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
150 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
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?