Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
100 views
Hi,
I'm reading about StyleSheetManager. You wrote in documentation: "RadStyleSheetManager merges the RadControls embedded skins", so it doesn't work with custom skins?

Dimo
Telerik team
 answered on 10 Mar 2010
1 answer
68 views
I have folllowed the demo at http://demos.telerik.com/aspnet-ajax/grid/examples/programming/listview/defaultcs.aspx in order to format my grid in a listview fashion - and that works fine.  However, as soon as I try to edit an item the popup edit form does not show anymore and the problem seems to arise due to the code in the protected void RadGrid1_PreRender(object sender, EventArgs e) method since the <table> is being hidden. Could you please suggest a solution or workaround to this?

Thanks
Matthew
Princy
Top achievements
Rank 2
 answered on 10 Mar 2010
1 answer
71 views
We just updated our dll to the latest release and we are getting "was unable to find embedded skin with name 'Gray'."

Where is this skin?  How do we get it back? 

Vincent
Dimo
Telerik team
 answered on 10 Mar 2010
1 answer
124 views
Hello,

I've been trying to come up with a way to modify a value in the grid based on business logic within the application.  For example, if showing a list of employee's, the business logic checks to see if they have access to salary information for the employee's department.  Based on the complexity of the logic, it is done within the applicaiton and not in SQL.

So, if the user does NOT have access to the salary, I would like to change the cell to say "Protected" or something similar.  I can do this fine, however, the user could still sort the grid and infer the salary range based on where the records show up in the sort results.  What I can't figure out how to do is change the underlying value to 0 (zero) when checking this logic.  I have tried doing this in the ItemCreated event and the ItemDataBound event, but whatever I do, it seems to continue knowing how to sort based on the real value and doesn't honor the new 0 (zero) I put in there.  Here is what I have tried....a little overkill now, but I was trying to modify they value everywhere I could.

Does anyone know how to do this?

Thanks,
Chris

void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)  
        {  
            if (e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem || e.Item.ItemType == Telerik.Web.UI.GridItemType.Item)  
            {  
                Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item;  
                System.Data.DataRowView dataRow = (DataRowView)item.DataItem;  
 
                if (dataRow != null && !SecurityManager.HasAccessToGroupByRole(BusinessServices.Security.RoleCode.ViewSalary, dataRow["Dept"].ToString() ))  
                {  
                    item["Annual_Salary"].Text = "Protected";  
                    dataRow["Annual_Salary"] = 0;  
                    ((System.Data.DataRow)dataRow.Row)["Annual_Salary"] = 0;  
                    gridData.Tables[0].Rows[item.DataSetIndex]["Annual_Salary"] = 0;  
 
                }  
 
            }  
        }  
 
void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)  
{  
    if (e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem || e.Item.ItemType == Telerik.Web.UI.GridItemType.Item)  
    {  
        Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item;  
        System.Data.DataRowView dataRow = (DataRowView)item.DataItem;  
          
        if (!SecurityManager.HasAccessToGroupByRole(BusinessServices.Security.RoleCode.ViewSalary, dataRow["Dept"].ToString() ))  
        {  
            //item["Annual_Salary"].Text = "Protected";  
            dataRow["Annual_Salary"] = 0;  
            ((System.Data.DataRow)dataRow.Row)["Annual_Salary"] = 0;  
            gridData.Tables[0].Rows[item.DataSetIndex]["Annual_Salary"] = 0;  
              
        }  
 
    }  
} 

Princy
Top achievements
Rank 2
 answered on 10 Mar 2010
2 answers
97 views
I have created a grid which has generated a edit button, when I edit one of my row, it turns to edit mode, then after I change sth and click update, it would not be updated! Would somebody help me out here?
The first remarked datasource is built by myself and with logical delete, but it seems not working!
The second one is generated by datasource configuration builder. And it is still not working
<%--<asp:AccessDataSource ID="adsMenus" runat="server"   
    DataFile="~/App_Data/dbmx.mdb"   
    SelectCommand="SELECT * FROM [Menus] where isDelete = False"   
      
    UpdateCommand="UPDATE Menus SET menuName = ?, menuType = ?, menuSequence = ?, menuLink = ?, menuParentID = ? WHERE (menuID = ?)"   
    DeleteCommand="UPDATE Menus SET isDelete = true WHERE (menuID = ?)">  
    <UpdateParameters> 
        <asp:SessionParameter Name="menuName" SessionField="menuName" /> 
        <asp:SessionParameter Name="menuType" SessionField="menuType"/>  
        <asp:SessionParameter Name="menuSequence" SessionField="menuSequence"/>  
        <asp:SessionParameter Name="menuLink" SessionField="menuLink"/>  
        <asp:SessionParameter Name="menuParentID" SessionField="menuParentID"/>  
        <asp:SessionParameter Name="menuID" SessionField="menuID"/>  
    </UpdateParameters> 
    <DeleteParameters> 
        <asp:SessionParameter Name="menuID" SessionField="menuID" /> 
    </DeleteParameters> 
</asp:AccessDataSource>--%> 
<asp:AccessDataSource ID="adsMenus" runat="server"   
    DataFile="~/App_Data/dbmx.mdb"   
    SelectCommand="SELECT * FROM [Menus]"   
      
    UpdateCommand="UPDATE [Menus] SET [menuName] = ?, [menuType] = ?, [menuSequence] = ?, [menuLink] = ?, [menuParentID] = ?, [isDelete] = ? WHERE [menuID] = ? AND [menuName] = ? AND (([menuType] = ?) OR ([menuType] IS NULL AND ? IS NULL)) AND (([menuSequence] = ?) OR ([menuSequence] IS NULL AND ? IS NULL)) AND (([menuLink] = ?) OR ([menuLink] IS NULL AND ? IS NULL)) AND (([menuParentID] = ?) OR ([menuParentID] IS NULL AND ? IS NULL)) AND [isDelete] = ?"   
    ConflictDetection="CompareAllValues"   
    DeleteCommand="DELETE FROM [Menus] WHERE [menuID] = ? AND [menuName] = ? AND (([menuType] = ?) OR ([menuType] IS NULL AND ? IS NULL)) AND (([menuSequence] = ?) OR ([menuSequence] IS NULL AND ? IS NULL)) AND (([menuLink] = ?) OR ([menuLink] IS NULL AND ? IS NULL)) AND (([menuParentID] = ?) OR ([menuParentID] IS NULL AND ? IS NULL)) AND [isDelete] = ?"   
    InsertCommand="INSERT INTO [Menus] ([menuID], [menuName], [menuType], [menuSequence], [menuLink], [menuParentID], [isDelete]) VALUES (?, ?, ?, ?, ?, ?, ?)"   
    OldValuesParameterFormatString="original_{0}">  
    <DeleteParameters> 
        <asp:Parameter Name="original_menuID" Type="Int32" /> 
        <asp:Parameter Name="original_menuName" Type="String" /> 
        <asp:Parameter Name="original_menuType" Type="String" /> 
        <asp:Parameter Name="original_menuSequence" Type="Int32" /> 
        <asp:Parameter Name="original_menuLink" Type="String" /> 
        <asp:Parameter Name="original_menuParentID" Type="Int32" /> 
        <asp:Parameter Name="original_isDelete" Type="Boolean" /> 
    </DeleteParameters> 
    <UpdateParameters> 
        <asp:Parameter Name="menuName" Type="String" /> 
        <asp:Parameter Name="menuType" Type="String" /> 
        <asp:Parameter Name="menuSequence" Type="Int32" /> 
        <asp:Parameter Name="menuLink" Type="String" /> 
        <asp:Parameter Name="menuParentID" Type="Int32" /> 
        <asp:Parameter Name="isDelete" Type="Boolean" /> 
        <asp:Parameter Name="original_menuID" Type="Int32" /> 
        <asp:Parameter Name="original_menuName" Type="String" /> 
        <asp:Parameter Name="original_menuType" Type="String" /> 
        <asp:Parameter Name="original_menuSequence" Type="Int32" /> 
        <asp:Parameter Name="original_menuLink" Type="String" /> 
        <asp:Parameter Name="original_menuParentID" Type="Int32" /> 
        <asp:Parameter Name="original_isDelete" Type="Boolean" /> 
    </UpdateParameters> 
    <InsertParameters> 
        <asp:Parameter Name="menuID" Type="Int32" /> 
        <asp:Parameter Name="menuName" Type="String" /> 
        <asp:Parameter Name="menuType" Type="String" /> 
        <asp:Parameter Name="menuSequence" Type="Int32" /> 
        <asp:Parameter Name="menuLink" Type="String" /> 
        <asp:Parameter Name="menuParentID" Type="Int32" /> 
        <asp:Parameter Name="isDelete" Type="Boolean" /> 
    </InsertParameters> 
</asp:AccessDataSource> 
 
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateDeleteColumn="True"   
    AutoGenerateEditColumn="True" DataSourceID="adsMenus" GridLines="None"   
    Skin="Office2007">  
<MasterTableView AutoGenerateColumns="False" DataKeyNames="menuID"   
        DataSourceID="adsMenus">  
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
    <Columns> 
        <telerik:GridBoundColumn DataField="menuID" DataType="System.Int32"   
            HeaderText="menuID" ReadOnly="True" SortExpression="menuID" UniqueName="menuID">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="menuName" HeaderText="menuName"   
            SortExpression="menuName" UniqueName="menuName">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="menuType" HeaderText="menuType"   
            SortExpression="menuType" UniqueName="menuType">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="menuSequence" DataType="System.Int32"   
            HeaderText="menuSequence" SortExpression="menuSequence"   
            UniqueName="menuSequence">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="menuLink" HeaderText="menuLink"   
            SortExpression="menuLink" UniqueName="menuLink">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="menuParentID" DataType="System.Int32"   
            HeaderText="menuParentID" SortExpression="menuParentID"   
            UniqueName="menuParentID">  
        </telerik:GridBoundColumn> 
        <telerik:GridCheckBoxColumn DataField="isDelete" DataType="System.Boolean"   
            HeaderText="isDelete" SortExpression="isDelete" UniqueName="isDelete">  
        </telerik:GridCheckBoxColumn> 
    </Columns> 
</MasterTableView> 
</telerik:RadGrid> 
louis chan
Top achievements
Rank 1
Iron
 answered on 10 Mar 2010
2 answers
113 views
Hey everyone

I have the following scenario: The Master page contains a RadAjaxManager (ID = ajaxMgr) and a RadTreeView (ID = treeView). On another page, namely Default.aspx a RadGrid (ID = radGrid) is placed. The treeView will start the AJAX request and the radGrid is the control that will be updated. My question here is, on which page do I add the AJAX setting: on the Master page (using a base class or something else) or on the Default.aspx page (using ((MasterPage)Master).AjaxMgr.AjaxSettings.AddAjaxSettings(((MasterPage)Master).TreeView, radGrid) )? Does a Telerik control exist, that does solve this kind of situation? Or what is your best practice in this scenario? 

I'm looking forward to your answers. Thanks.

Regards,
Mallory
Mallory
Top achievements
Rank 1
 answered on 10 Mar 2010
3 answers
125 views
Hi,
   I have few questions, Anyone can help me? Thanks in advance

1) Pagination
       i'm having 25 records in my grid and 10 records are displayed per page. So  first 2 page got 10 records and last page got 5 records. after going to last page, if i click sorting, the pagination is still on the last page and number of records shown also 5 only but the data got sorted. am i doing anything wrong?

2) Export to PDF in client side
  if the grid is not ajaxifiedm i'm able to export the grid to PDF in client side. If the grid is ajaxified, then how can i export to pdf in client side?

Telerik version used :2008.2.1001.35

ASPX Code:
<body>

    <script type="text/javascript" language="javascript">
        function ExportGrid()
        {
            var radGrid = $find('<%= RadGrid1.ClientID %>');
            
            radGrid.get_masterTableView().exportToPdf();
        }
        function RequestStart(ajaxManager,eventArgs)
        {
        
        var evtTarget=eventArgs.EventTarget;
        //alert(evtTarget.indexOf("Button1"));
         if(evtTarget.indexOf("Button1")!=-1)
            {
                eventArgs.EnableAjax=false
            }
        }
    </script>

    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
        <asp:Button ID="Button1" runat="server" Text="Export" OnClientClick="ExportGrid();return false;" />
        <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"
            AllowPaging="True" AllowSorting="True" GridLines="None" EnableViewState="true" PagerStyle-Position="TopAndBottom">
            <MasterTableView>
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
            </MasterTableView>
            <FilterMenu EnableTheming="True">
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
            </FilterMenu>
        </telerik:RadGrid>
        <telerik:RadAjaxManager ID="ajaxman" runat="server"
            onajaxsettingcreating="ajaxman_AjaxSettingCreating">
        <ClientEvents OnRequestStart="RequestStart" />
            <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>            
            <telerik:AjaxSetting AjaxControlID="Button1">
                <UpdatedControls>
                 <telerik:AjaxUpdatedControl ControlID="Button1"/>                    
                </UpdatedControls>
            </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
    </div>
    </form>
</body>

Code Behind:

protected DataTable GenerateDataTable()
    {
        DataTable myDataTable = new DataTable();
        myDataTable.Columns.Add("ID", typeof(int));
        myDataTable.Columns.Add("Name", typeof(string));

        for (int rows = 0; rows < 25; rows++)
            myDataTable.Rows.Add(rows, "Row " + rows);

        return myDataTable;
    }

    protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        RadGrid1.DataSource = GenerateDataTable();
    }
Princy
Top achievements
Rank 2
 answered on 10 Mar 2010
1 answer
124 views
Hello,

I have a simple problem with regards to positioning of the XAxis Item Labels.  After I set them to a rotation angle of 45, rather than 90, the start of the label is not aligned with the major tick it corresponds to.  Instead it looks as if the label belongs to the tick preceeding it.  Having the labels set at 90 does not make them very reader friendly, but I am not sure what setting I would need to adjust in order to get them to lineup correctly with their appropriate tick mark?

Thanks,
Ron
Ron
Top achievements
Rank 2
 answered on 10 Mar 2010
2 answers
257 views
I try to use the Rad Grid Delete Command to delete a row in the RadGrid using server side store proc. The index property reads correctly but the actual value of the field is null.

TABLE
-------------------------------------------------------------------------------------------------------------------------------------------------
USE [xxxx]
GO

/****** Object:  Table [dbo].[TemplateAreasPractice]    Script Date: 03/08/2010 21:52:42 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[TemplateAreasPractice](
[TemplateAreasPracticeId] [int] IDENTITY(1,1) NOT NULL,
[CategoryId] [int] NULL,
[ProfileId] [int] NULL,
[TemplateAreasPracticePorcent] [int] NULL,
[TemplateAreasPracticeDate] [datetime] NULL,
 CONSTRAINT [PK_TemplateAreasPractice] PRIMARY KEY CLUSTERED 
(
[TemplateAreasPracticeId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[TemplateAreasPractice] ADD  CONSTRAINT [DF_TemplateAreasPractice_TemplateAreasPracticeDate]  DEFAULT (getdate()) FOR [TemplateAreasPracticeDate]
GO

Store Proc
------------------------------------------------------------------------------------------------------------------------------------------------------------
USE [xxx]
GO

/****** Object:  StoredProcedure [dbo].[Delete_TemplateAreasPractice]    Script Date: 03/08/2010 21:52:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author: Christian Rodriguez
-- Create date: 3-8-2010
-- Description:
-- =============================================
CREATE PROCEDURE [dbo].[Delete_TemplateAreasPractice] 
-- Add the parameters for the stored procedure here
@TemplateAreasPracticeId int = 0
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

    -- Insert statements for procedure here
DELETE FROM TemplateAreasPractice
WHERE (TemplateAreasPracticeId = @TemplateAreasPracticeId)
END

GO

HTML
------------------------------------------------------------------------------------------------------------------------------------------
<telerik:RadGrid ID="RadGridAreaofPractice" runat="server" AllowPaging="True" 
                                                                GridLines="None" AutoGenerateColumns="False" OnDeleteCommand="RadGridAreaofPractice_DeleteCommand">
                                        <MasterTableView>
                                        <RowIndicatorColumn>
                                        <HeaderStyle Width="20px"></HeaderStyle>
                                        </RowIndicatorColumn>

                                        <ExpandCollapseColumn>
                                        <HeaderStyle Width="20px"></HeaderStyle>
                                        </ExpandCollapseColumn>
                                        <Columns>                                     
                                                <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName= "DeleteColumn" />                                                                                 
                                                <telerik:GridBoundColumn DataField="TemplateAreasPracticeId" HeaderText="TemplateAreasPracticeId" SortExpression="TemplateAreasPracticeId" UniqueName="TemplateAreasPracticeId" />
                                                <telerik:GridBoundColumn DataField="CategoryDesc" HeaderText="Category" SortExpression="Category" UniqueName="Category" />
                                                <telerik:GridBoundColumn DataField="TemplateAreasPracticePorcent" HeaderText="Porcent" SortExpression="Porcent" UniqueName="Porcent" />                                                                                         
                                            </Columns>
                                        </MasterTableView>
                                       </telerik:RadGrid>


ASPX.VB
--------------------------------------------------------------------------------------------------------------------------------------------------------
 Public Sub RadGridAreaofPractice_DeleteCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridAreaofPractice.DeleteCommand

        Dim id As String = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("TemplateAreasPracticeId").ToString()

        If id > "" Then

            Dim ConnectionString As New XXX
            Dim sConnection As String = ConnectionString.XXX
            Dim connection As SqlConnection = New SqlConnection(sConnection)

            'Delete
            Dim objCommand_Delete_TemplateAreasPractice As SqlCommand = New SqlCommand("Delete_TemplateAreasPractice", connection)
            objCommand_Delete_TemplateAreasPractice.Connection.Open()
            objCommand_Delete_TemplateAreasPractice.CommandType = Data.CommandType.StoredProcedure
            objCommand_Delete_TemplateAreasPractice.Parameters.AddWithValue("@TemplateAreasPracticeId", id)

            objCommand_Delete_TemplateAreasPractice.ExecuteNonQuery()

            objCommand_Delete_TemplateAreasPractice.Connection.Close()
            objCommand_Delete_TemplateAreasPractice.Dispose()

            'close database connection
            connection.Close()
            connection.Dispose()

        End If



    End Sub 'RadGridAreaofPractice_DeleteCommand


Christian Rodriguez
Top achievements
Rank 2
 answered on 10 Mar 2010
2 answers
89 views
Dear Telerik,

How do yoy view scheduler detail in double clicked. instead of displaying the edit, I would like to display the detail of the scheduler, such as location, price and name of the person.

thank you
Molivia Sa
Top achievements
Rank 1
 answered on 09 Mar 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?