Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
139 views
I have a RadListView with a RadDataPager (see below). Every time a user hits "FirstPrev"
 button the OnPageIndexChanged  event fires three times.

Why is this happening and how do I prevent it?

<telerik:RadListView ID="RadListView1" runat="server" AllowPaging="True" ItemPlaceholderID="PlaceHolder1"
    Skin="listview_2" EnableEmbeddedSkins="false" OnItemDataBound="RadListView1_ItemDataBound" AllowCustomPaging="true"
    DataKeyNames="id,filenameextension,typeAbbr,title,fidTimeOfDay" OnNeedDataSource="RadListView1_NeedDataSource" OnPageIndexChanged="RadListView1_PageIndexChanged" OnPageSizeChanged="RadListView1_PageSizeChanged" >
    <LayoutTemplate>
        <div class="RadListView RadListViewFloated RadListView_Windows7">
            <telerik:RadDataPager ID="RadDataPager1" runat="server" PageSize="25" PagedControlID="RadListView1"
                BorderWidth="0" OnFieldCreated="RadDataPager1_FieldCreated" CssClass="dataPagerClass">
                <Fields>
                    <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
                    <telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="5" />
                    <telerik:RadDataPagerButtonField FieldType="NextLast" />
                    <telerik:RadDataPagerPageSizeField PageSizeText="Page size: " />
                    <telerik:RadDataPagerGoToPageField CurrentPageText="Page: " TotalPageText="of" SubmitButtonText="Go"
                        TextBoxWidth="15" />
                    <telerik:RadDataPagerTemplatePageField>
                        <PagerTemplate>
                            <b>Total Number of Assets Found:
                                <asp:Label runat="server" ID="TotalItemsLabel" Text="<%# Container.Owner.TotalRowCount%>" />
                            </b>
                        </PagerTemplate>
                    </telerik:RadDataPagerTemplatePageField>
                </Fields>
            </telerik:RadDataPager>
            <asp:PlaceHolder ID="PlaceHolder1" runat="server" />
        </div>
    </LayoutTemplate>
    <ItemTemplate>
        <div style="float: left; width: 162px; height: 200px; background-color: White;">
            <asp:Panel ID="myThumb" runat="server" CssClass="myClass" Style="border: 0; white-space: normal; padding: 5px 4px 25px 2px; text-align: center; width: 160px; background-color: white; margin-left: 2px;">
                <div style="width: 150px; height: 150px; margin-left: 2px;">
                    <asp:HyperLink ID="HyperLink1" runat="server">
                        <telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" AutoAdjustImageControlSize="false"
                            CssClass="myClass" ImageUrl='<%# Eval("thumbUrl") %>' AlternateText="Click to view preview"
                            ToolTip="Click to view preview" />
                    </asp:HyperLink><br />
                </div>
                <asp:CheckBox ID="ChkImage" runat="server" Style="float: left; padding-top: 5px" /><small><asp:HyperLink
                    ID="lnkAsset1" runat="server" Visible="false" Style="float: left; padding-top: 5px; text-decoration: none; font-weight: normal; font-size: 7pt;">
                </asp:HyperLink><asp:HyperLink ID="lnkAsset2" runat="server" Style="float: left; text-decoration: none; font-weight: normal; font-size: 7pt;">
                </asp:HyperLink><asp:HyperLink ID="lnkAsset3" runat="server" Style="float: left; padding-left: 20px; text-decoration: none; font-weight: normal; font-size: 7pt;"></asp:HyperLink></small><br />
                <asp:HiddenField ID="hiddenAssetId" Value='<%# Eval("id") %>' runat="server" />
            </asp:Panel>
        </div>
    </ItemTemplate>
    <EmptyDataTemplate>
        No Assets Found
    </EmptyDataTemplate>
</telerik:RadListView>

Konstantin Dikov
Telerik team
 answered on 03 Mar 2015
1 answer
76 views
I'm having a problem with the telerik:radscheduler control. I have a calendar with three appointments on it (Tuesday 12:30-1:30, Wednesday 7-4, Thursday 12:30-1:30 named ctl00_MainContent_Scheduler_1_0,ctl00_MainContent_Scheduler_0_0, ctl00_MainContent_Scheduler_2_0 respectively).

If you open or move any of the events, the only appointment that is effected is the Wednesday (ctl00_MainContent_Scheduler_0_0) appointment that is affected. If you move the Thursday event up a week, the Wednesday event is the one that's moved. Same with Tuesday, effect Wednesday. If you open any of the events for details, the Wednesday events details are populated.

I've walked the code and confirmed that the datasource is populating everything correctly.

Here's my code:

The control itself
    <telerik:RadScheduler runat="server" ID="Scheduler" SelectedView="MonthView" DayStartTime="07:00:00" DayEndTime="21:00:00"
        FirstDayOfWeek="Monday" LastDayOfWeek="Friday" AllowInsert="False" AllowDelete="False" DataKeyField="MyID" DataSubjectField="MyName"
        DataStartField="MyDate" DataEndField="MyDateEnd" OnNavigationCommand="Scheduler_OnNavigationCommand" RowHeight="50px"
        Height="100%" CustomAttributeNames="MyOtherName, MyString, MyInfo, MyLocation,TimeZoneMessage,Type,MyPlace,MyReason,MyDate, MyDateEnd" OnAppointmentDataBound="Scheduler_OnAppointmentDataBound">
        <AppointmentTemplate>
            <div>
                <%# Eval("Subject") %>
            </div>
            <div>
            <%# Eval("MyName") %>  <%# Eval("MyString") %> 
                </div>
            <%# Eval("MyInfo") %>
        </AppointmentTemplate>
        <AdvancedForm Modal="True" />
        <AdvancedEditTemplate>
            <scheduler:AdvancedForm runat="server" ID="AdvancedForm" Mode="Edit" Subject='<%# Bind("Subject") %>'
                Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' MyName='<%# Bind("MyName") %>'
                MyString='<%# Bind("MyString") %>' MyInfo='<%# Bind("MyInfo") %>' Location='<%# Bind("Location") %>'
                TimeZoneMessage='<%# Bind("TimeZoneMessage") %>' Type='<%# Bind("Type") %>' MyPlace='<%# Bind("MyPlace") %>' MyReason='<%# Bind("MyReason") %>'/>
        </AdvancedEditTemplate>
    </telerik:RadScheduler>


In the AdvancedFormTemplate.ascx.cs:

        protected Appointment Appointment
        {
            get
            {
                SchedulerFormContainer container = (SchedulerFormContainer)BindingContainer;
                return container.Appointment;
            }
        }

container.Appointment always contains the Wednesday control, even if you click on the other two.

Code behind to populate:


            Scheduler.DataSource = items;
            Scheduler.DataBind();

I've verified items contains exactly what I expect (3 separate and correct events).

When the calendar month displays, the 3 appointments each display the correct information. It's almost like they load correctly but the appointment events are tied to the Wednesday appointment handlers.

Anyone have a clue for this?
Bozhidar
Telerik team
 answered on 03 Mar 2015
1 answer
100 views
Hi,

I am using telerik rad grid (v. 2014).
When I try to resize columns I get an unexpected result (attached screen shot) - there is a white space at the right side.

Is there any way that the grid will automatically use all the width?

Thanks 
Pavlina
Telerik team
 answered on 03 Mar 2015
4 answers
348 views
Hi All,

          we are using RadScheduler as a Calendar control. and we have a requirement of creating an Event spanning multiple days.
          ex: StartDate 02-Feb-2015 and EndDate 06-Feb-2015.
 
          and we want the Event Name to be shown spanning these 5 days( rather It should be covering all these 5 days).
          But in the current situation it is showning event on 2nd Feb and 6 Feb.
 
          is there any CSS class or property to be added to achieve this.

          Thanks!!

Regards,
Charan
Thomas
Top achievements
Rank 1
 answered on 03 Mar 2015
2 answers
83 views
Hi.
I try to use RadClientExportManager witch OpenStreetMaps control. When I plot *.gpx file on the map ClientExportManager have a problem with export to pdf or png those lines.
I dont have controls on the map after exoprt too.
See attachat pictures.
Capture1 - oryginal
Capture 2 - exported

Krzysztof

Peter Filipov
Telerik team
 answered on 03 Mar 2015
2 answers
159 views
I am seeing an intermittent problem where users are getting the exception above when RadListView perfoms a DataBind. I am not sure how it can happen, because my code creates a data table and assigns it to the RadListView. Even if it failed to add anything to the data table, it wouldn't cause an exception. Could this be caused by one of the controls in the template?

Here's the stack trace:
ERROR=Cannot perform this operation when DataSource is not assigned. STACK TRACE= 
at Telerik.Web.UI.ListViewNullEnumerable.get_DataSourceCount() 
at Telerik.Web.UI.RadListView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) 
at Telerik.Web.UI.RadListView.PerformDataBinding(IEnumerable data) 
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) 
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) 
at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at Telerik.Web.UI.RadListView.PerformSelect() 
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at Telerik.Web.UI.RadListView.DataBind() 
<my code..>

Here's the HTML:

<telerik:RadListView ID="RadListView1" runat="server" Width="100%" AllowPaging="true" ItemPlaceholderID="StylesHolder" DataKeyNames="StyleNumber" OnPageIndexChanged="RadListView1_PageIndexChanged">
    <LayoutTemplate>
        <fieldset style="width: 100%; border: none;" id="FieldSet1">
            <asp:Panel ID="StylesHolder" runat="server">
            </asp:Panel>
        </fieldset>
    </LayoutTemplate>
    <ItemTemplate>
        <div class="grid_3 SearchResults_Container">
            <a href="#" onclick="DetailClick('<%# Eval("StyleNumber") %>')">
                <%-- This div is necessary in that 'relative' is required in a div before 'absolute' is used in next dic --%>
                <div class="SearchResults_ImageContainer">
                    <%-- This div forces image to be vertical-aligned at bottom, just above text, but centered. --%>
                    <div class="SearchResults_ImageAlignment">
                        <%# GetStylePrimaryImage(Eval("StyleNumber") as string) %>
                    </div>
                </div>
                <%# Eval("StyleNumber") %><br />
                <%# Eval("ProductName") %>
            </a>
        </div>
    </ItemTemplate>
</telerik:RadListView>

The CodeBehind looks like this:
        radListView.DataSource = GetDataTable(strCollectionID, strCollectionName, strDesignerID, strDesignerName, strProductTypeID, strProductTypeName, strRoomID, strRoomName, strSearch);
        radListView.DataBind();
 
...
 
    public DataTable GetDataTable(string strCollectionID, string strCollectionName, string strDesignerID, string strDesignerName, string strProductTypeID, string strProductTypeName, string strRoomID, string strRoomName, string strSearch)
    {
        DataTable dt = new DataTable();
 
(Put some stuff in the table)
 
        return dt;
    }
Konstantin Dikov
Telerik team
 answered on 03 Mar 2015
1 answer
77 views
I have a simple radgrid (markup below) that is populated with a DataTable, such as the example below;

Flag  Rank
J        3
X       8

In the edit mode I want to change the values of the Rank column, and on update I want the grid to reflect the new value. I don't want to post the value back to the original datasource - I just want it to persist in the radgrid.  In another operation I will use the values in the radgrid after the user makes their edits.

I imagine this is simple to do but I am not seeing it.  Can you point me in the right direction?

protected void rgFlagsToRerank_UpdateCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem editedItem = e.Item as GridEditableItem;
    Hashtable newValues = new Hashtable();
    e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
    int valRank = int.Parse(newValues["Rank"].ToString());
     
    //todo - help please - how do I persist this value in the grid
 
}



<telerik:RadGrid ID="rgFlagsToRerank" runat="server" CellSpacing="0" GridLines="Both" Font-Names="Arial" Font-Size="8pt" Height="400" Width="310px"  AutoGenerateColumns="false" OnCancelCommand="rgTotalVsDissolved_CancelCommand"
                                            OnNeedDataSource="rgFlagsToRerank_NeedDataSource" OnUpdateCommand="rgFlagsToRerank_UpdateCommand" >
                                            <ClientSettings >
                                                <Scrolling AllowScroll="True" UseStaticHeaders="True"  />                                                                                                                                                         
                                            </ClientSettings>
                                            <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true"  ></ExportSettings>
                                            <MasterTableView Width="310px" Caption="Flags to Re-rank" EditMode="InPlace" CommandItemDisplay="Top" NoMasterRecordsText="No validation flags to re-rank"
                                                DataKeyNames="ValidationFlags,Rank"
                                                >
                                                <Columns>                                                       
                                                    <telerik:GridBoundColumn DataField="ValidationFlags" UniqueName="ValidationFlags" Display="true" HeaderText="Validation Flag" HeaderStyle-Width="100" ItemStyle-Width="95" ReadOnly="true"  ></telerik:GridBoundColumn>  
                                                    <telerik:GridBoundColumn DataField="Rank" UniqueName="Rank" Display="true" HeaderText="Rank" HeaderStyle-Width="100" ItemStyle-Width="95"   ></telerik:GridBoundColumn>                    
                                                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderText="Edit" HeaderStyle-Width="100px"  UpdateText="Update" CancelText="Cancel"></telerik:GridEditCommandColumn>
                                                </Columns>
                                                <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"  ShowRefreshButton="false"  ></CommandItemSettings>                                       
                                                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                                                    <HeaderStyle Width="20px" />
                                                </RowIndicatorColumn>
                                                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                                                    <HeaderStyle Width="20px" />
                                                </ExpandCollapseColumn>
                                                <EditFormSettings>
                                                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                                    </EditColumn>
                                                </EditFormSettings>
                                            </MasterTableView>
                                            <FilterMenu EnableImageSprites="False"></FilterMenu>
                                        </telerik:RadGrid>



Konstantin Dikov
Telerik team
 answered on 03 Mar 2015
1 answer
249 views
if I have a row selected (this is done to view and image in a rad window) and then
I hit a column header to sort, the selected index change event is fired
and the previous selected row fires off and shows the image again.

how can I stop this from happening.

Thanks Troy
Konstantin Dikov
Telerik team
 answered on 03 Mar 2015
1 answer
44 views
See above.
Nencho
Telerik team
 answered on 03 Mar 2015
2 answers
241 views
Hello

I am using a RadComboBox inside a RadGrid.

The RadComboBox is populated by a web service.

The radgrid is being used as a form, where the user can input data to the grid (one row at a time) then click on "insert".

When the user clicks "insert" I need to get access to the value chosen by the user in the RadComboBox.

Below I have put my aspx and then my code-behind for the OnInsert event.

How can I finish my OnInsert event so that I have access to the value chosen by the user in the RadComboBox?


<telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false" AllowPaging="true"
                    OnNeedDataSource="RadGrid1_NeedDataSource" AutoGenerateEditColumn="True" OnInsertCommand="RadGrid1_OnInsert" OnItemCreated="RadGrid1_ItemCreated" Width="99%" OnPreRender="RadGrid1_PreRender">
                    <MasterTableView  runat="server" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage" EditMode="InPlace" Width="100%" TableLayout="Auto">
                    <Columns>
                         
                      <telerik:GridTemplateColumn UniqueName="UserCol" HeaderText="proto user" DataField="UserID">
                            
                           <EditItemTemplate>
                               <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="false" CausesValidation="true"
                                            Width="240" MaxHeight="200px" OnItemsRequested="ddEmployee_ItemsRequested" AllowCustomText="true"
                                            EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                                            MarkFirstMatch="false" >
                                </telerik:RadComboBox>
                           </EditItemTemplate>
                       </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="FromFloor" HeaderText="From Floor" UniqueName="FFCol" ></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="FromStation" HeaderText="From Station" UniqueName="FSCol" ></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ToFloor" HeaderText="To Floor" UniqueName="TFCol" ></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ToStation" HeaderText="To Station" UniqueName="TSCol" ></telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn DataField="DateToRelocate" HeaderText="Date To Relocate" UniqueName="DateCol" ></telerik:GridDateTimeColumn>
                                         
                    </Columns>
                </MasterTableView>
                </telerik:RadGrid>


protected void RadGrid1_OnInsert(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
 
 
 
 
            GridEditableItem editedItem = e.Item as GridEditableItem;
            GridEditManager editMan = editedItem.EditManager;
            foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
            {
                if (column is IGridEditableColumn)
                {
                    IGridEditableColumn editableCol = (column as IGridEditableColumn);
                    if (editableCol.IsEditable)
                    {
                        IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
 
                        string editorText = "unknown";
                        object editorValue = null;
 
                        if (editor is GridTemplateColumnEditor)
                        {
 
 
                        }
 
                        if (editor is GridTextColumnEditor)
                        {
                            editorText = (editor as GridTextColumnEditor).Text;
                            editorValue = (editor as GridTextColumnEditor).Text;
                        }
 
 
                    }
                }
            }
 
        }




Dimitar
Telerik team
 answered on 03 Mar 2015
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?