Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
547 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
158 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
229 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
115 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
1 answer
116 views
Hi Team,

I am using below code of rad time picker.
  <telerik:RadTimePicker ID="txtFromTime" runat="server" Width="80px" ToolTip="From time">                      
                            <TimeView Skin="Default" ShowHeader="False" Interval="00:30:00" Columns="4" runat="server" >
                            </TimeView>
                        </telerik:RadTimePicker>

Problem: when i select time 8.00am or 8.30am from timeview and again open timeview popup the selected time shown is 12.00 Am and 12.30 am respectively. Same proble happens when i select 9.00am and 9.30 am. With rest of time selections controls works fiine.
Can you suggest why this is happening so.

Thanks
Rupinder
    
Princy
Top achievements
Rank 2
 answered on 24 Aug 2011
2 answers
73 views
Hello

I have on the same aspx page RadDateTimePicker and RadEditor (Rad Ajax Controls 2011 Q2). I set EnableEmbeddedSkins="true" for both control and set Skin="Default" for RadEditor and Skin="Hay" for RadDateTimePicker. In FF (5.0,6.0) looks ok, but in IE8 RadDateTimePicker looks wrong. On another aspx page I have only RadDateTimePicker and it looks ok. Could you help me?

Małgorzata Filipek

  
Malgorzata Filipek
Top achievements
Rank 1
 answered on 24 Aug 2011
1 answer
95 views

I use BinaryImage in a RadListView (BinaryImage First Look example). Have problem if a Contact not have save image (BinaryImage)
I get "Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'."
Tips on how I get around if a contact person chooses not to store their personal contact picture in the database?
I use sql server 2008 and datatype varbinary(MAX)

Shinu
Top achievements
Rank 2
 answered on 24 Aug 2011
5 answers
87 views
I guess it's debatable whether this is the desired behaviour, but I noticed that when I use SetEffectiveRange it only accounts for the start date, not the end date.  To use a quick, realistic example, let's say we have an office that blocks off the time when they're closed with a recurring appointment from 5 PM to 8 AM.  If I parse all of the appointments on a given day, I get the equivalent of:

8 AM - 9 AM - Early appointment
12 PM - 1 PM - Lunch
5 PM - 8 AM tomorrow - Office closed

But I don't get:

5 PM yesterday - 8 AM today - Office closed

Similarly, if an appointment runs from Monday to Wednesday and I use SetEffectiveRange to show Tuesday's appointments, the effective "all day" appointment doesn't show.  I can work around this easily enough by setting a wider range and filtering with an If statement, but I don't know if this is considered the expected behaviour for this function.
Peter
Telerik team
 answered on 24 Aug 2011
7 answers
145 views
Hi,
I am using RadControls ver. 2011.2.712.40 and have this problem only in IE9.

For any button that I have in a RadWindow, the center part of the sprite moves down a couple px when depressed. Please see the screenshot..

I suspect an iframe css rule conflicting with the button styling but cannot narrow it down. Has anyone seen this problem before?

Thanks,
Dan
Dan Lehmann
Top achievements
Rank 1
 answered on 24 Aug 2011
1 answer
48 views
Hi everyone,

I have come across a very odd scenerio. I made the default document on my sever dashboard.aspx and when I navigate to the site ( http://apps.amortech.ca ) none of the listboxes seem to work but if I define the page ( http://apps.amortech.ca/dashboard.aspx ) everything works fine.

It works in Firefox both ways but none of the others (haven't tested in Chrome)

Has anyone come across this issue before? Im trying to figure out if its in IIS config or in the app.

You can navigate to those 2 pages to see as that is just a prototype.

Thank you for your time.
Genady Sergeev
Telerik team
 answered on 24 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?