Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
292 views
Hi i use radgirid
with row select property in clientsettings as showen below

<ClientSettings EnableRowHoverStyle="true"> <Selecting EnableDragToSelectRows="false" AllowRowSelect="true"></Selecting>

 

 

</ClientSettings>
and i have a  gridselectcoloumn in grid
<telerik:GridClientSelectColumn UniqueName="Selection">  <HeaderStyle Width="22px"></HeaderStyle>  <ItemStyle HorizontalAlign="Center" Width="22px"></ItemStyle> </telerik:GridClientSelectColumn>

my problem  starts here ;
radgrid supports multirowselect if only Ctrl key pressed
if ctrl key is not pressed earlier selected row goes to unselected.
i want to select rows by click on it with the earlier selected row keeped.
(is there a configuration parameter for that on radgrid?)
how to accomplish this task?
tahnks

 

 

 

 

 

 

 

 

 

 

 

Pavlina
Telerik team
 answered on 20 Sep 2013
3 answers
627 views
I've got a RadGrid that's filled dynamically with content... the single grid on the page is used for a variety of queries, so it never knows what columns are going to fill it beforehand.

I've enabled Grouping, and it works... I can drag a column to the header, and the data groups just fine.

However, when I click on the grouped column to try to return it back to the grid (so I can group by a different criteria), I get the following error:

Server Error in '/' Application.

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index) +10587351
   Telerik.Web.UI.GridGroupByExpressionCollection.get_Item(Int32 index) +56
   Telerik.Web.UI.GridGroupPanel.Ungroup(String index) +363
   Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +985
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9642338
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045




Here is the code for the RadGrid I'm using:

 <telerik:RadGrid ID="lst" runat="server"  AllowPaging="True" PageSize="5"
    OnItemCommand="lst_ItemCommand"  CellSpacing="0" GridLines="None" ShowGroupPanel="True" AutoGenerateHierarchy="True"  >
       <ClientSettings AllowColumnsReorder="True" EnablePostBackOnRowClick ="true" AllowDragToGroup="True" >
          <Animation AllowColumnReorderAnimation="True" AllowColumnRevertAnimation="True" />
        </ClientSettings>
        <MasterTableView CommandItemDisplay="Top"  PageSize="100" GroupLoadMode="Client" AutoGenerateColumns="True" AllowSorting="True" EnableLinqGrouping="False" ShowGroupFooter="True" DataKeyNames="ID"  >
        <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="False" ShowExportToCsvButton="True"     ShowExportToPdfButton="True" ShowRefreshButton="False"></CommandItemSettings>

<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>

<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                   
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>

<BatchEditingSettings EditType="Cell"></BatchEditingSettings>

<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
        </MasterTableView>
        <GroupingSettings ShowUnGroupButton="True"   />
        <SortingSettings SortedBackColor="Yellow" />
        <ExportSettings SuppressColumnDataFormatStrings="false">
<Pdf>
<PageHeader>
<LeftCell Text=""></LeftCell>

<MiddleCell Text=""></MiddleCell>

<RightCell Text=""></RightCell>
</PageHeader>

<PageFooter>
<LeftCell Text=""></LeftCell>

<MiddleCell Text=""></MiddleCell>

<RightCell Text=""></RightCell>
</PageFooter>
</Pdf>

            <Excel Format="Biff"></Excel>
        </ExportSettings>

<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>

<FilterMenu EnableImageSprites="False"></FilterMenu>
    </telerik:RadGrid>
 


Is there a setting I'm missing somewhere?  



Many thanks in advance.


Jay
Konstantin Dikov
Telerik team
 answered on 20 Sep 2013
2 answers
86 views
Hi.
I want to remove the vertical bar between refresh and excel icon .? How to do it.?

Thanks, 
Ryann
Ryann
Top achievements
Rank 1
 answered on 20 Sep 2013
11 answers
2.4K+ views
Ok, so Ive read a bunch of posts on how to do this, but cant seem to get them to work. Can anyone give me some help on how to get this to work.
Thanks
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SchoolsAttended.ascx.cs"
    Inherits="Controls_SchoolsAttended" %>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function RowDblClick(sender, eventArgs) {
            sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
        }
        function openRadWin() {
            radopen("AddSchool.aspx", "RadWindow1");
        }
    </script>
</telerik:RadCodeBlock>
<telerik:RadGrid ID="rgSchoolsAttended" runat="server" ShowStatusBar="True" AllowSorting="True"
    PageSize="7" GridLines="None" AllowPaging="True" CellSpacing="0" DataSourceID="ldsSchoolsAttended"
    AutoGenerateColumns="False" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
    AllowAutomaticUpdates="True">
    <MasterTableView DataSourceID="ldsSchoolsAttended" DataKeyNames="SchoolAttendedID"
        TableLayout="Fixed" EditMode="InPlace" CommandItemDisplay="Bottom">
        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
        <CommandItemTemplate>
            <div style="padding: 5px 5px;">
                <button id="rbAddSchool" runat="server" onclick="openRadWin(); return false;">
                    Add School
                </button>
                   
                <asp:LinkButton ID="LinkButton2" runat="server" ToolTip="Add School Atteneded" CommandName="InitInsert"
                    Visible='<%# !rgSchoolsAttended.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/Huntsman/Grid/AddRecord.gif" /></asp:LinkButton>  
                <asp:LinkButton ID="LinkButton4" runat="server" ToolTip="Refresh" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/Huntsman/Grid/Refresh.gif" /></asp:LinkButton>
            </div>
        </CommandItemTemplate>
        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
            <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridEditCommandColumn HeaderStyle-Width="30" ButtonType="ImageButton" UniqueName="EditCommandColumn">
                <ItemStyle CssClass="MyImageButton" />
            </telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn DataField="SchoolAttendedID" DataType="System.Int32" FilterControlAltText="Filter SchoolAttendedID column"
                HeaderText="SchoolAttendedID" SortExpression="SchoolAttendedID" UniqueName="SchoolAttendedID"
                Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="SchoolID" DataType="System.String" FilterControlAltText="Filter SchoolID column"
                HeaderText="SchoolID" SortExpression="SchoolID" UniqueName="SchoolID" Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn HeaderStyle-Width="160" HeaderText="SchoolName" ItemStyle-Width="240px">
                <ItemTemplate>
                    <%#DataBinder.Eval(Container.DataItem, "SchoolAttendedName")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadComboBox runat="server" ID="rcbSchools" DataTextField="SchoolName" DataValueField="SchoolID"
                        DataSourceID="ldsSchools" SelectedValue='<%#Bind("SchoolID") %>'>
                    </telerik:RadComboBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridDateTimeColumn HeaderStyle-Width="160" DataField="BeginDate" DataType="System.DateTime"
                FilterControlAltText="Filter BeginDate column" HeaderText="Start" SortExpression="BeginDate"
                UniqueName="BeginDate" DataFormatString="{0:d}" Visible="false">
            </telerik:GridDateTimeColumn>
            <telerik:GridDateTimeColumn HeaderStyle-Width="160" DataField="EndDate" DataType="System.DateTime"
                FilterControlAltText="Filter EndDate column" HeaderText="End" SortExpression="EndDate"
                UniqueName="EndDate" DataFormatString="{0:d}">
            </telerik:GridDateTimeColumn>
            <telerik:GridBoundColumn HeaderStyle-Width="60" DataField="ReceivedDegree" FilterControlAltText="Filter ReceivedDegree column"
                HeaderText="Degree" SortExpression="ReceivedDegree" UniqueName="ReceivedDegree">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderStyle-Width="60" DataField="GPA" DataType="System.Decimal"
                FilterControlAltText="Filter GPA column" HeaderText="GPA" SortExpression="GPA"
                UniqueName="GPA">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Transcript" FilterControlAltText="Filter Transcript column"
                HeaderText="Transcript" SortExpression="Transcript" UniqueName="Transcript" Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridButtonColumn HeaderStyle-Width="30" ConfirmText="Are you sure you want to delete this?"
                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>
    </MasterTableView>
    <ClientSettings AllowColumnsReorder="True">
        <Selecting AllowRowSelect="true" />
        <ClientEvents OnRowDblClick="RowDblClick" />
    </ClientSettings>
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
    </HeaderContextMenu>
</telerik:RadGrid>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
    <Windows>
        <telerik:RadWindow ID="RadWindow1" runat="server" ShowContentDuringLoad="false" Width="400px"
            Height="400px" Top="" Title="Add School" Modal="true" Behaviors="Default" OnClientClose="RefreshParentPage">
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
<asp:LinqDataSource ID="ldsSchoolsAttended" runat="server" ContextTypeName="DAL.HuntsmanLinqDataContext"
    EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeName=""
    OnSelecting="ldsSchoolsAttended_Selecting" OrderBy="EndDate" TableName="SchoolAttendeds"
    Where="HNUMBER == @HNUMBER">
    <WhereParameters>
        <asp:QueryStringParameter Name="HNUMBER" QueryStringField="HNUMBER" Type="Int32" />
    </WhereParameters>
    <InsertParameters>
        <asp:QueryStringParameter Name="HNUMBER" QueryStringField="HNUMBER" Type="Int32" />
    </InsertParameters>
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsSchools" runat="server" ContextTypeName="DAL.HuntsmanLinqDataContext"
    EntityTypeName="" OrderBy="SchoolName" Select="new (SchoolID, SchoolName)" TableName="Schools">
</asp:LinqDataSource>
DogBizPro
Top achievements
Rank 1
 answered on 20 Sep 2013
2 answers
70 views
Hi,

How can I dynamically add contextmenu items to appointments on webservice bound scheduler. I would like to   create context menu/add context menu items only when  user right clicks an appointment.

Thanks,
Prava
Prava kafle
Top achievements
Rank 1
 answered on 20 Sep 2013
1 answer
147 views
Hi

I'm using RadFileExplorer to select multiple images, is there a way to preselect files either clientside or serverside?

/Thomas

Btw. thanks for these excellent tools :)
Dobromir
Telerik team
 answered on 20 Sep 2013
1 answer
115 views
I have a combobox on a page that loads other comboboxes dynamically when the user selects a value.  After this happens once, the user can no longer make a selection in the original combobox.  I made a simple project to reproduce this behavior.  Any ideas as to what I can do to fix this? 

Edit: Telerik version 2009.3.1314.35. Can't upgrade because of project specs.  Thanks.

WebForm1.aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="TestProject1.WebForm1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"> </script>
    <script type="text/javascript">
        var currentIndex = -1;
 
        function changeFilter(sender, args) {
            currentIndex++;
             
            $.ajax({
                type: "POST",
                url: "WebForm1.aspx?action=test&row=" + currentIndex,
                success: function (data) {
                    var arr = data.split("|");  //0 is result, 1 is html to add
                    var result = arr[0];
                    if (result == "success") {
                        var html = arr[1];
                        $(html).appendTo($("#container0"));
                    }
 
                }
            });
 
            return false;
        }
 
 
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager id="rsm1" runat="server"></telerik:RadScriptManager>
 
        <div>
            <telerik:RadComboBox ID="cmbxExistingFilters" runat="server" ClientIDMode="Static" AutoPostBack="false"
                     EmptyMessage="Saved Filters" RegisterWithScriptManager="false" AllowCustomText="false"
                    AppendDataBoundItems="true" EnableAutomaticLoadOnDemand="false" OnClientSelectedIndexChanged="changeFilter"
                    EnableVirtualScrolling="false" >
 
            </telerik:RadComboBox>
            <div id="hiddenContainer" runat="server" style="display:none;"></div>
            <div id="container0" runat="server"></div>
        </div>
    </form>
</body>
</html>

WebForm1.aspx.vb
Imports Telerik.Web.UI
Imports System.IO
 
Public Class WebForm1
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If HttpContext.Current.Request.Headers("X-Requested-With") = "XMLHttpRequest" Then ' if ajax postback
            Response.Clear()
            Dim row As String = Request.QueryString("row")
            Response.Write("success|" + RenderCustomControl(BuildStatesTextbox(row)) + _
                           RenderCustomControl(BuildSectorCombobox(row)) + "|")
 
        ElseIf IsPostBack Then
 
        Else
            Me.container0.ClientIDMode = UI.ClientIDMode.Static
            BindToCombo(Me.cmbxExistingFilters)
        End If
 
    End Sub
 
    Private Sub BindToCombo(ctrl As RadComboBox)
        ctrl.Items.Clear()
        For i As Integer = 0 To 5
            Dim rci As New RadComboBoxItem
            rci.Text = "hey_" + i.ToString
            rci.Value = "hey_" + i.ToString
            ctrl.Items.Add(rci)
        Next
        ctrl.DataBind()
    End Sub
 
    Private Function RenderCustomControl(ctrl As Control) As String
        Dim sb As New StringBuilder
        Try
            If ctrl IsNot Nothing Then
                Using sw As New StringWriter(sb)
                    Using html As New HtmlTextWriter(sw)
                        ctrl.Page = Me
                        'hiddenContainer.Controls.Add(ctrl)
                        ctrl.RenderControl(html)
                    End Using
                End Using
            End If
        Catch ex As Exception
            Response.Write(ctrl.ID + " Fail<br>")
        End Try
        Return sb.ToString
    End Function
 
 
 
    ''' <summary>
    ''' Create textbox to display states
    ''' </summary>
    ''' <param name="row"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Function BuildStatesTextbox(row As String) As RadTextBox
        Dim txtboxStates As New RadTextBox
        txtboxStates.Width = 150
        txtboxStates.ID = "tbxStates_" + row
        txtboxStates.ClientIDMode = UI.ClientIDMode.Static
        txtboxStates.Attributes("onclick") = "alert('" + row + "');"
        txtboxStates.AutoPostBack = False
        'txtboxStates.Style.Add("display", "none")
        txtboxStates.ReadOnly = True
        txtboxStates.RegisterWithScriptManager = False
        Return txtboxStates
    End Function
 
    ''' <summary>
    ''' Create combobox to let the user choose the sector
    ''' </summary>
    ''' <param name="row"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Function BuildSectorCombobox(row As String) As RadComboBox
        Dim cmbxSectors As New RadComboBox
        cmbxSectors.Width = 150
        cmbxSectors.ID = "cmbxSectors_" + row
        cmbxSectors.ClientIDMode = UI.ClientIDMode.Static
        For i = 0 To 5
            Dim cmbxItem As New RadComboBoxItem()
            cmbxItem.Text = "bye_" + i.ToString
            cmbxItem.Value = "bye_" + i.ToString
            cmbxSectors.Items.Add(cmbxItem)
        Next
        cmbxSectors.DataBind()
        cmbxSectors.AutoPostBack = False
        ' cmbxSectors.Style.Add("display", "none")
        cmbxSectors.RegisterWithScriptManager = False
        Return cmbxSectors
    End Function
 
End Class
Nencho
Telerik team
 answered on 20 Sep 2013
1 answer
100 views
We're having display issues with the Web20 theme formdecorator for the asp.net login control. The issue shows up in the iPhone and iPad, but not on Safari when run in Windows. The right side of the Login and Cancel buttons are repeated. We haven't customized the built-in themes at all.

Here is the code for the formdecorator in the page:
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Web20"  EnableEmbeddedSkins="true"
    DecoratedControls="All" />

Here is the code for the buttons in the login control:

<tr>
    <td></td>
    <td style="text-align:center">
        <asp:Button ID="LoginButton" runat="server"
        CommandName="Login" Text="Log In" AccessKey="l"
        ValidationGroup="Login1"/>
          
        <asp:Button ID="Button1" runat="server"
        Text="Cancel" AccessKey="c" />
    </td>
</tr>

I've attached a picture that shows the problem. (Ignore that the buttons themselves are repeated. This was for testing.) Look at the right sides of the buttons:



Luke
Top achievements
Rank 1
 answered on 20 Sep 2013
9 answers
213 views
Im working with the RAD Scheduler control.  I've declared a RAD Scheduler control on my ASPX page, and it's OnAppointmentUpdate attribute is as follows:

OnAppointmentUpdate="RadScheduler1_AppointmentUpdate"

In the code-behind, the event handler is defined as follows:

protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
{
    //CODE
}


Documentation says that by referencing e.ModifiedAppointment, I should be able to access the new Appointment values I've entered right before they're inserted into the database.

But -- These values are the same as the original Appointment object!  It appears as though any new values are not accessible via the e.ModifiedAppointment object.

Any ideas what's going on?  Seems easy, but I'm stumped!

TIA!
Mike

 

Plamen
Telerik team
 answered on 20 Sep 2013
8 answers
409 views
Hi, I want to filter on "Title" like in the code but when I apply the filter my Grid disappears and filter not work.
Can you help me and tell me why it doesn't work.
This is my code.

Thx
<telerik:GridTemplateColumn AllowFiltering="true" UniqueName="Title"  DataField="Title">
                        <ItemTemplate>
                            <asp:label ID="Title" Text='<%# DataBinder.Eval(Container.DataItem,"Title")%>' runat="server"></asp:label>
<asp:label ID="Description" Text='<%# DataBinder.Eval(Container.DataItem,"Description")%>' runat="server"></asp:label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
Wisedead
Top achievements
Rank 1
 answered on 20 Sep 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
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
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
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
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?