Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
122 views
RadEditorSharePoint.dll!Telerik.SharePoint.SPRadEditor.VirtualResourceFolder.get()

This operation results in a security exception:
System.Security.SecurityException occurred
  Message=Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
  Source=mscorlib
  GrantedSet=<PermissionSet class="System.Security.PermissionSet

Will web parts run /w SharePoint default minimal trust?
Rumen
Telerik team
 answered on 24 Aug 2011
7 answers
147 views
I am trying to create my own custom filter like in the example outlined here:

http://www.telerik.com/help/aspnet-ajax/grid-custom-option-for-filtering.html

The only difference is that my column is a template column, What do i need to do? Thanks

Error on line: RadGrid1.MasterTableView.Rebind();
Telerik.Web.UI.ParseException was unhandled by user code
  Message=Expression expected
  Source=Telerik.Web.UI

ASPX
<telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column"
    HeaderText="Status" UniqueName="Status">
 
<FilterTemplate>
  <telerik:RadComboBox runat="server" ID="FilterCombo" DataSourceID="StatusList"
                       DataValueField="StatusID" DataTextField="Status" AutoPostBack="true"
                       OnSelectedIndexChanged="FilterCombo_SelectedIndexChanged">
  </telerik:RadComboBox>
</FilterTemplate>
 
    <EditItemTemplate>
        <telerik:RadComboBox ID="RadComboBox_StatusList" runat="server"
            AutoPostBack="true" DataSourceID="StatusList" DataTextField="Status"
            DataValueField="StatusID"
            OnSelectedIndexChanged="RadComboBox_StatusList_SelectedIndexChanged"
            SelectedValue='<%#Bind("StatusID") %>'>
        </telerik:RadComboBox>
    </EditItemTemplate>
    <ItemTemplate>
         <%#DataBinder.Eval(Container.DataItem, "Status")%>
    </ItemTemplate>
    <ItemStyle Width="240px" />
</telerik:GridTemplateColumn>


C#
protected void FilterCombo_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
    string filterExpression;
    filterExpression = "([Status] = '" + e.Value + "')";
    RadGrid1.MasterTableView.FilterExpression = filterExpression;
    RadGrid1.MasterTableView.Rebind();
}



Najid Hanif
Top achievements
Rank 2
 answered on 24 Aug 2011
1 answer
279 views
HI,

I am using RadAjaxManager which is present in the home page of our application. From any child page I require to call parent.Ajaxrequest through this manager. In this ajax requiest  I am required to update a hidden variable in the server side.. and in AjaxResponse end (JavaScript)  of the RadAjaxManager  I need to read the updated value of that hiidden variable.

Now when I update the hidden variable from server side while in the ajax request .. it seems the value has been updated but when I try to read the value from client side in ajax response end using document.getElementByID('hiddenFieldID') the updated value is not there..

I have also put in the id of hidden field in the RadAjaxManager as follows

<rad:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"
            Style="position: absolute;">
            <ClientEvents OnResponseEnd="OnAjaxResponseEnd" OnRequestStart="noScroll" />
            <AjaxSettings>
                <rad:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <rad:AjaxUpdatedControl ControlID="hdHiddenFieldID" />
                   </UpdatedControls>
                </rad:AjaxSetting>
            </AjaxSettings>
        </rad:RadAjaxManager>

Please let me know If I am missing any thing ? or do you have any work aroung for this Issue.
Andrey
Telerik team
 answered on 24 Aug 2011
1 answer
101 views
Hi,

I have relatively simple scenerio where I have to check some conditions before updating data. To manage data I'm using RadGrid with autoupdate. I would like to check some conditions before update (i.e. if the name already exists, if an issue date is greater then other max issue date in database etc.). What is the best practice to make such check and how to stop update if some conditions are not met?
I thought about SqlDataSource updating event but I don't know how to read values from controls in edit form of RadGrid. Maybe other event is much more efficient in this case. I appreciate your support in this case as well as snippet of example code is welcome.

Best Regards,

Darek   
Pavlina
Telerik team
 answered on 24 Aug 2011
7 answers
564 views
Hi,

I am creating a pdf programatically and then opening it in the browser.
I am doing this using

 response.BinaryWrite(pdfBytes);
 response.Flush();
 response.End();

It works fine when its not in a RadAjaxPanel but when it is inside the panel the document will not open.

Is there anyway to get it to work inside a RadAjaxPanel?

Thanks,

Ronan
Maria Ilieva
Telerik team
 answered on 24 Aug 2011
1 answer
211 views
In the form, I have a submit button, when clicked, it updates the panel in the ajax way.  However, I would like to exclude a LinkButton inside the panel from getting ajaxified, is there an easy way to achieve it?  Thanks

<asp:Panel id="MyPanel" Runat="server">
 ...
     <asp:LinkButton id="MyLink" Runat="server">
 ...
</asp:Panel>
<asp:Button Runat="server" id="SubmitButton">

<telerik:RadAjaxManager runat="server" ID="ram">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="SubmitButton">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="MyPanel" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
Shinu
Top achievements
Rank 2
 answered on 24 Aug 2011
7 answers
575 views

Hi,

I've a problem with paging on my radgrid.

To fill the DataSource i'm using the event NeedDataSource, and it works.

If i have a lot of rows (>= 100) and I try to change the page, my pager after 11 pages return at the third page..

Why??

If I have under 100 rows the pager works correctly..

This is the block where i put my RadGrid..

01.<telerik:RadGrid ID="grdPorzioni" runat="server" Skin="Sunset" AutoGenerateColumns="false" AllowPaging="true" Width="100%" AllowSorting="false" EnableViewState="false" BorderStyle="None">
02.    <PagerStyle AlwaysVisible="false" Mode="NumericPages" ShowPagerText="false" />
03.    <MasterTableView PageSize="10" AllowPaging="true" AllowSorting="false" ShowHeadersWhenNoRecords="false" TableLayout="Fixed" EnableViewState="false" BorderStyle="Solid" BorderWidth="1">
04.        <NoRecordsTemplate>
05.            <asp:Image runat="server" ID="imgNoRecord" ImageUrl="~/images/__banner.jpg" Width="60%" />
06.            <br />
07.            <asp:Label runat="server" ForeColor="Red" Font-Bold="true" ID="noRecord" Text="Non sono presenti delle porzioni per l'Unità Economica selezionata."></asp:Label>
08.        </NoRecordsTemplate>
09.        <Columns>
10.            <telerik:GridBoundColumn HeaderText="Porzione" DataField="Id" HeaderStyle-Width="100" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
11.            </telerik:GridBoundColumn>
12.            <telerik:GridBoundColumn HeaderText="Descrizione" DataField="Descrizione" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left">
13.            </telerik:GridBoundColumn>
14.        </Columns>
15.    </MasterTableView>
16.</telerik:RadGrid>

The Radgrid is inserted into of an ASP panel

Can you help me?

Regards

Cristian

Pavlina
Telerik team
 answered on 24 Aug 2011
4 answers
173 views
Hello to all

I have built the following scenario.
There is one table called "centers" which holds data for some public centers across a town.
There is another table called services having ID and Name of the Service.
The centers has many services (e.g. car rental, bike rental e.t.c.)
So I made another table (CenterServices), which holds the IDs of Centers and Services (to simulate the one to many relationship)

I built a page with a master and a separate detail grid, using your example in demos.
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectedvalue/defaultvb.aspx

I added edit and delete buttons to the detail grid.
The problem is that I can edit the record of the details grid, but I cannot delete it.
Can anyone help me please?
The sqldatasource is working fine (I think).
May be something is missing from the grid or the code.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ServiceCenter.aspx.vb" Inherits="ServiceCenter" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <telerik:RadScriptManager ID="RadScriptManager" runat="server"></telerik:RadScriptManager>
        <strong>Centers:</strong>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <ajaxsettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        <telerik:AjaxUpdatedControl ControlID="RadGrid2" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGrid2">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid2" />
                         
                    </UpdatedControls>
                </telerik:AjaxSetting>
                 
            </ajaxsettings>
        </telerik:RadAjaxManager>
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True"
            PageSize="5" DataSourceID="SqlDataSource1" GridLines="None" width="95%"
            CellSpacing="0">
            <clientsettings allowkeyboardnavigation="true" enablepostbackonrowclick="true">
                <Selecting AllowRowSelect="true" />
            </clientsettings>
            <mastertableview datakeynames="Center_ID" >
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
 
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
                <PagerStyle AlwaysVisible="True" />
            </mastertableview>
            <pagerstyle mode="NextPrevAndNumeric" AlwaysVisible="True" />
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
 
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
        </telerik:RadGrid>
        <br />
        <br />
        <strong>Services:</strong>
        <telerik:RadGrid ID="RadGrid2" runat="server" AllowAutomaticDeletes="True" AutoGenerateColumns="False"
            AllowAutomaticInserts="True"  AllowAutomaticUpdates="True"
            AllowPaging="True" CellSpacing="0" DataSourceID="SqlDataSource2" ShowStatusBar="True"
    GridLines="None" ShowFooter="True" Width="95%">
    <MasterTableView DataSourceID="SqlDataSource2" Width="100%"
            CommandItemDisplay="TopAndBottom" DataKeyNames="CenterServices_ID">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
 
    <Columns>
    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        <ItemStyle CssClass="MyImageButton" />
                    </telerik:GridEditCommandColumn>
        <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column"
            HeaderText="Service Name" UniqueName="TemplateColumn">
            <EditItemTemplate>
                <telerik:RadComboBox ID="RadComboBox1" Runat="server"
                    DataSourceID="SqlDataSource3" DataTextField="Service_Name"
                    DataValueField="Service_ID"
                    SelectedValue='<%# Bind("CenterServices_Service") %>'>
                </telerik:RadComboBox>
            </EditItemTemplate>
            <InsertItemTemplate>
                <telerik:RadComboBox ID="RadComboBox2" Runat="server"
                    DataSourceID="SqlDataSource3" DataTextField="Service_Name"
                    DataValueField="Service_ID"
                    SelectedValue='<%# Bind("CenterServices_Service") %>'>
                </telerik:RadComboBox>
            </InsertItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# Eval("Service_Name") %>'></asp:Label>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
            HeaderText="Center" UniqueName="TemplateColumn1">
            <EditItemTemplate>
                <asp:Label ID="Label2" runat="server"
                    Text='<%# Bind("CenterServices_Center") %>'></asp:Label>
            </EditItemTemplate>
            <InsertItemTemplate>
                <telerik:RadComboBox ID="RadComboBox3" Runat="server"
                    DataSourceID="SqlDataSource4" DataTextField="Center_Code"
                    DataValueField="Center_ID" SelectedValue='<%# Bind("CenterServices_Center") %>'>
                </telerik:RadComboBox>
            </InsertItemTemplate>
        </telerik:GridTemplateColumn>
         <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
    </Columns>
 
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
    <PagerStyle AlwaysVisible="True" />
</MasterTableView>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
 
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
    </telerik:RadGrid>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
        <br />
        <br />
        <strong>Orders details:</strong>
        <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="xxxxxxxxxxxx"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT Centers.Center_ID, countries.CO_Name, Centers.Center_Region, Centers.Center_City, Centers.Center_Street_Number, Centers.Center_ZipCode, Centers.Center_WorkingHours, Centers.Center_Code FROM Centers INNER JOIN countries ON Centers.Center_Country = countries.CO_id"
            runat="server"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="xxxxxxxxxxxx"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT CenterServices.CenterServices_ID, CenterServices.CenterServices_Center, CenterServices.CenterServices_Service, Services.Service_Name FROM CenterServices INNER JOIN Services ON CenterServices.CenterServices_Service = Services.Service_ID WHERE (CenterServices.CenterServices_Center = @CenterServices_Center)"
            runat="server"
            DeleteCommand="DELETE FROM CenterServices WHERE (CenterServices_ID = @CenterServices_ID)"
            InsertCommand="INSERT INTO [CenterServices] ([CenterServices_Center], [CenterServices_Service]) VALUES (@CenterServices_Center, @CenterServices_Service)"
             
             
             
             
            UpdateCommand="UPDATE [CenterServices] SET [CenterServices_Center] = @CenterServices_Center, [CenterServices_Service] = @CenterServices_Service WHERE [CenterServices_ID] = @CenterServices_ID">
            <DeleteParameters>
                <asp:Parameter Name="CenterServices_ID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="CenterServices_Center" Type="Int32" />
                <asp:Parameter Name="CenterServices_Service" Type="Int32" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="RadGrid1" Name="CenterServices_Center"
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="CenterServices_Center" Type="Int32" />
                <asp:Parameter Name="CenterServices_Service" Type="Int32" />
                <asp:Parameter Name="CenterServices_ID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
         
    </div>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server"
        ConnectionString="xxxxxxxxxxxx"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [Services]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource4" runat="server"
        ConnectionString="xxxxxxxxxxxx"
        ProviderName="System.Data.SqlClient"
        SelectCommand="SELECT [Center_ID], [Center_Code] FROM [Centers]">
    </asp:SqlDataSource>
    <br />
    </form>
</body>
</html>

The code page is the following:

Imports System
Imports System.Web.UI.WebControls
Imports Telerik.Web.UI
 
Partial Class ServiceCenter
    Inherits System.Web.UI.Page
    Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
        If RadGrid1.SelectedIndexes.Count = 0 Then
            RadGrid1.SelectedIndexes.Add(0)
        End If
        If RadGrid2.SelectedIndexes.Count = 0 Then
            RadGrid2.Rebind()
            RadGrid2.SelectedIndexes.Add(0)
        End If
    End Sub
 
    Protected Sub RadGrid1_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs) Handles RadGrid1.ItemCommand
        RadGrid2.SelectedIndexes.Clear()
    End Sub
 
 
    Protected Sub RadGrid2_ItemDeleted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDeletedEventArgs) Handles RadGrid2.ItemDeleted
        Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
        Dim id As String = item.GetDataKeyValue("CenterServices_ID").ToString()
 
        If Not e.Exception Is Nothing Then
            e.ExceptionHandled = True
            SetMessage("Service Type with ID " + id + " cannot be deleted. Reason: " + e.Exception.Message)
        Else
            SetMessage("Service Type with ID " + id + " is deleted!")
        End If
    End Sub
 
    Protected Sub RadGrid2_ItemUpdated(ByVal source As Object, ByVal e As Telerik.Web.UI.GridUpdatedEventArgs) Handles RadGrid2.ItemUpdated
        Dim item As GridEditableItem = DirectCast(e.Item, GridEditableItem)
        Dim id As String = item.GetDataKeyValue("CenterServices_ID").ToString()
 
        If Not e.Exception Is Nothing Then
            e.KeepInEditMode = True
            e.ExceptionHandled = True
            SetMessage("Service Type with ID " + id + " cannot be updated. Reason: " + e.Exception.Message)
        Else
            SetMessage("Service Type with ID " + id + " is updated!")
        End If
    End Sub
 
    Protected Sub RadGrid2_ItemInserted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridInsertedEventArgs) Handles RadGrid2.ItemInserted
        If Not e.Exception Is Nothing Then
            e.ExceptionHandled = True
            e.KeepInInsertMode = True
            SetMessage("Service Type cannot be inserted. Reason: " + e.Exception.Message)
        Else
            SetMessage("New Service Type is inserted!")
        End If
    End Sub
 
    Private Sub DisplayMessage(ByVal text As String)
        RadGrid2.Controls.Add(New LiteralControl(String.Format("<span style='color:red'>{0}</span>", text)))
    End Sub
 
 
    Private Sub SetMessage(ByVal message As String)
        gridMessage = message
    End Sub
 
    Private gridMessage As String = Nothing
    Protected Sub RadGrid2_DataBound(ByVal sender As Object, ByVal e As EventArgs) Handles RadGrid2.DataBound
        If Not String.IsNullOrEmpty(gridMessage) Then
            DisplayMessage(gridMessage)
        End If
    End Sub
 
End Class

Thanks in advanced
Velissarios
Top achievements
Rank 1
 answered on 24 Aug 2011
3 answers
272 views
Hi There,
I want t add format code block like one you have in this html editor.
would you please send me a sample about adding format code block functionality to a html editor?

Thanks
Rumen
Telerik team
 answered on 24 Aug 2011
2 answers
143 views
Hi,
I have 2 'google suggest' style RadComboBox with EnableLoadOnDemand="true". Is there an easy way to call the OnItemsRequested function every time the ComboBox gets focus?

I get the items the first time the ComboBox receives focus and if I start typing but the problem I have is the following:
1. I type something in ComboBox1.
2. I click in ComboBox2 and see filtered items based on ComboBox1.
3. I type something else in ComboBox1.
4. I click in ComboBox2 again and the old filtered items are there. It does not make another call to the codebehind handler for OnItemsRequested until I type something.

Thanks,
Dan
Dan Lehmann
Top achievements
Rank 1
 answered on 24 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
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?