Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
180 views
I have a RadListView that is paged by a RadDataPager. The ListView is loaded correctly on the initial page load. After that the needdatasource method correctly retrieves the next set of results, but they are never displayed. From my investigation, it appears that it is related to the fact that the listview always has a page count of 1 while the datapager correctly calculates 2(13 items, with a page size of 10). The list view changes page index correctly, which retrieves the next page of results to set for the datasource. After setting the datasource the new items are never displayed. I am doing something very similar to the listview image gallery demo, so if it at least tried to add the new images and failed, I should get broken image links.  I think the listview is skipping binding the new results, since the list view thinks its out of its page range. Its worth noting we are using the 2013 Q2 controls, since this is new work for a customer with an existing site. We want to avoid updating versions to limit risk to the rest of the site.

<telerik:RadListView runat="server" ID="ImageGalleryDisplay" OnNeedDataSource="ImageGalleryDisplay_NeedDataSource" OnItemCreated="RadListView1_ItemCreated"
                AllowPaging="true" ItemPlaceholderID="ImagePlaceHolder" OnItemDataBound="RadListView_ItemDataBound">
                    <LayoutTemplate>
                       <asp:PlaceHolder ID="ImagePlaceHolder" runat="server">
                       </asp:PlaceHolder>
                       <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="ImageGalleryDisplay"
                        PageSize="10">
                        <Fields>
                            <telerik:RadDataPagerButtonField FieldType="FirstPrev"></telerik:RadDataPagerButtonField>
                            <telerik:RadDataPagerButtonField FieldType="Numeric"></telerik:RadDataPagerButtonField>
                            <telerik:RadDataPagerButtonField FieldType="NextLast"></telerik:RadDataPagerButtonField>
                        </Fields>
                        </telerik:RadDataPager>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("ImageURL")%>' />
                    </ItemTemplate>
                    <AlternatingItemTemplate>
                        <asp:Image ID="Image2" runat="server" ImageUrl='<%#Eval("ImageURL")%>' />
                    </AlternatingItemTemplate>
                </telerik:RadListView>      


protected void ImageGalleryDisplay_NeedDataSource (object source, RadListViewNeedDataSourceEventArgs e)
            {           
            _photos = new List<Photo> ();
            LoadData ();
            ImageGalleryDisplay.DataSource = _photos;
            }

        protected void LoadData ()
            {         
            //dataSearch is our own special search type that returns a datatable and estimated hit count, they return the correct values

            DataTable fileIds = dataSearch.Retrieve<DataTable> (ImageGalleryDisplay.CurrentPageIndex * ImageGalleryDisplay.PageSize + 1, ImageGalleryDisplay.PageSize);
            ImageGalleryDisplay.VirtualItemCount = dataSearch.EstimateHitCount > 0 ? dataSearch.EstimateHitCount : 0;

            foreach (DataRow row in fileIds.Rows)
                {
                int id = Convert.ToInt32 (row["fileId"].ToString ());

                Photo photo = new Photo (id, String.Format("Handlers/ImageHandler.ashx?id={0}&height=100&width=100",id));
                _photos.Add (photo);
                }
            }

        protected void RadListView_ItemDataBound (object sender, RadListViewItemEventArgs e)
            {
            if (e.Item is RadListViewDataItem)
                {
                var dataItem = ((RadListViewDataItem)e.Item).DataItem;

                }
            }

        protected void RadListView1_ItemCreated (object sender, RadListViewItemEventArgs e)
            {
            if (e.Item is RadListViewDataItem)
                {
                Image img = e.Item.FindControl ("image1") as Image;
                }
            }

        protected void Comand2 (object sender, RadListViewPageChangedEventArgs e)
            {
            ImageGalleryDisplay.CurrentPageIndex = e.NewPageIndex;
            string i = ImageGalleryDisplay.PageCount.ToString();
            }


khadeer
Top achievements
Rank 1
 answered on 18 Sep 2017
1 answer
91 views

Hello,

i created a grid with multi-line footer according to this example:

http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/totals-in-grid-footers

and added an excel export according to this tutorial:

http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/functionality/exporting/overview

but opening the extracted xls file file i see footer data messed up with values concatenated in a single cell.

How to get a proper xls extraction?

Regards.

DrGiorgini
Top achievements
Rank 1
 answered on 18 Sep 2017
1 answer
69 views

I am using RadListView and trying to bind the ItemTapped to my MVVM.

I can't seem to get this to work.  I can't find any examples online either.  

 

Thanks in advance.

Will

wil
Top achievements
Rank 1
 answered on 18 Sep 2017
0 answers
41 views

Hi, we are consdiering purchasing your UI for ASP.net packages.

I reviewed your ASP.net AJAX demo and came across the image editor control which seems like a control we would like to use and customize.

I saw there is an option to draw circles/rectangles, is there an option to edit their coordinates after they are drawn? is there an option to draw programmatically?

Thanks,

 

Oren

Oren
Top achievements
Rank 1
 asked on 17 Sep 2017
0 answers
85 views
Telerik radAsyncUpload is not working in google chrome once application host in server. But if I run application in local its working.
Tikaram
Top achievements
Rank 1
 asked on 17 Sep 2017
0 answers
68 views

Hi Team,

Telerik radAsyncUpload is not working in google chrome once application host in server. But if I run application in local its working.

using IE its working in both.

Tikaram
Top achievements
Rank 1
 asked on 17 Sep 2017
0 answers
77 views
I am working with an older web application that has assembly version 2010 what is the best way to add the necessary files so I can work on this app
Perry
Top achievements
Rank 1
 asked on 15 Sep 2017
0 answers
67 views

Hi ,

We are using radgrid menu and we don't want users to un-check all columns from columns menu of context menu.

Is there a way to hide or stop user unchecking some columns of columns menu item?

I tried this below code:

  void HeaderContextMenu_ItemCreated(object sender, RadMenuEventArgs e)
        {
                     if (e.Item.Value.Contains("Reference#") && e.Item.Controls.Count > 0)
                (e.Item.Controls[0] as CheckBox).Enabled = false;
        }

It will make readonly for that column option on first load, but once i un-check another column, it will get enabled for check/uncheck.

Is there any other way to achieve this?

Thanks

vijay
Top achievements
Rank 1
 asked on 15 Sep 2017
14 answers
1.0K+ views
We are using a rad grid with edit form that opens in popup on the Edit event of each row. Currently grid refreshes each time the edit link is clicked and take time to open the Popup which is impacting the performance. Moreover if we cancel or close the popup
(handled by cancel event) the grid again refreshes and this action also takes time which in fact should be immediate.

Is there anyway to control the rebind of grid on these events.
Structure of grid:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="radGridComingSoon">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="radGridComingSoon">
                </telerik:AjaxUpdatedControl>
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="comingSoonRadAjaxLoadingPanel" runat="server">
</telerik:RadAjaxLoadingPanel>

                            <telerik:RadGrid ID="radGridComingSoon" AllowSorting="True" AllowPaging="True" runat="server"
                                OnItemCreated="radGridComingSoon_ItemCreated" OnItemDataBound="radGridComingSoon_ItemDataBound"
                                GridLines="None" OnInsertCommand="radGridComingSoon_InsertCommand" OnUpdateCommand="radGridComingSoon_UpdateCommand"
                                OnDeleteCommand="radGridComingSoon_DeleteCommand" OnItemCommand="radGridComingSoon_ItemCommand"
                                BorderStyle="Solid" AutoGenerateColumns="false" AllowMultiRowEdit="false" EnableViewState="true"
                                OnPreRender="radGridComingSoon_PreRender" AllowCustomSorting="true">
                                <PagerStyle Mode="NextPrevAndNumeric" PrevPageText="Prev" FirstPageText="First" NextPageText="Next"
                                    LastPageText="Last"></PagerStyle>
                                <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="StandardNumber"
                                    AutoGenerateColumns="false" InsertItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnFirstPage"
                                    EditMode="PopUp">
                                    <EditFormSettings InsertCaption="Add Coming Soon" CaptionFormatString="Edit Coming Soon">
                                        <PopUpSettings Modal="true" Width="742px" Height="1400px" ZIndex="201" />
                                    </EditFormSettings>
                                    <ItemTemplate>
                                        <table class="expandable standards-table">
                                            <tbody>
                                                <tr data-id='<%# Eval("ComingSoonId") %>'>
                                                    <td width="100px">
                                                        <asp:Label runat="server" ID="StandardNumberLabel" Text='<%# Eval("StandardNumber") %>'></asp:Label>
                                                          <td class="icon-column" width="50px" id="tdEditDeleteLink" runat="server">
                                                        <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="Edit" CssClass="Edit-Summary"><i class="icon edit"></i></asp:LinkButton>
                                                        <asp:LinkButton ID="lnkBtnDelete" runat="server" CommandName="Delete" CssClass="delete"><i class="icon remove delete"></i></asp:LinkButton>
                                                    </td>
                                                    <td>
                                                        <asp:Label runat="server" ID="lblChange" Text='<%# Eval("ComingSoonId") %>' CssClass="hide"></asp:Label>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </ItemTemplate>
                                    <Columns>
                                        <telerik:GridTemplateColumn HeaderText="Standard No." SortExpression="StandardNumber"
                                            UniqueName="StandardNumber" DataField="StandardNumber" ItemStyle-CssClass="ColorClass">
                                     
                                        <telerik:GridTemplateColumn HeaderText="ComingSoonId" SortExpression="ComingSoonId"
                                            UniqueName="ComingSoonId" DataField="ComingSoonId" Display="false" EditFormHeaderTextFormat="">
                                        </telerik:GridTemplateColumn>
                                    </Columns>
                                    <NoRecordsTemplate>
                                        <div>
                                            No records to display</div>
                                    </NoRecordsTemplate>
                                    <EditFormSettings EditFormType="Template">
                                        <FormTemplate>
                                            <div class="modal coming-soon-modal">
                                                <h3 class="brand modal-sub-title">
                                                    Brand: <strong>'<%#strBrandName %>'</strong></h3>
                                                <div class="modal-form">
                                                   
                                                        <asp:TextBox ID="txtCompDate" runat="server" CssClass="datepicker"></asp:TextBox>
                                                        <asp:Button ID="btnUpdate" CssClass="btn" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                            runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
                                                        </asp:Button>&nbsp;
                                                        <asp:Button ID="btnCancel" Text="Cancel" CssClass="cancel" runat="server" CausesValidation="False"
                                                            CommandName="Cancel"></asp:Button>
                                                    </fieldset>
                                                  
                                                </div>
                                            </div>
                                        
                                        </FormTemplate>
                                    </EditFormSettings>
                                    <CommandItemSettings AddNewRecordText="Add new record" AddNewRecordImageUrl="/_layouts/images/HBSImages/add-record-icon.gif"
                                        RefreshText="Refresh" RefreshImageUrl="/_layouts/images/HBSImages/refresh-icon.gif"
                                        ShowRefreshButton="false"></CommandItemSettings>
                                </MasterTableView>
                                <ClientSettings>
                                    <ClientEvents OnRowDblClick="RowDblClick"></ClientEvents>
                                </ClientSettings>
                            </telerik:RadGrid>
                      
M
Top achievements
Rank 1
 answered on 15 Sep 2017
4 answers
411 views
I have this RadGrid
<telerik:RadGrid ID="gvMembers" runat="server"
            AutoGenerateColumns="false"
            OnNeedDataSource="gvMembers_NeedDataSource"
            AllowSorting="true"
            AllowPaging="true"
            PageSize="10"
            AllowAutomaticUpdates="true"
            AllowAutomaticInserts="true"
            AllowAutomaticDeletes="true"
            OnItemCreated="gvMembers_ItemCreated"
            OnItemInserted="gvMembers_ItemInserted"
            OnPreRender="gvMembers_PreRender"
            OnInsertCommand="gvMembers_InsertCommand"
            OnItemDataBound="gvMembers_ItemDataBound"
            OnUpdateCommand="gvMembers_UpdateCommand"
            OnDeleteCommand="gvMembers_DeleteCommand"
 
            >
            <HeaderStyle CssClass="GridHeader" />
            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
            <MasterTableView AutoGenerateColumns="false" DataKeyNames="UserID" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
                <Columns>
                    <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="UserID" HeaderText="UserID" ReadOnly="true" UniqueName="UserID"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" UniqueName="firstname"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FirstName" HeaderText="Last Name" SortExpression="LastName" UniqueName="lastname"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="UserName" HeaderText="User Name" SortExpression="UserName" UniqueName="username"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="EmailAddress" HeaderText="Email" SortExpression="EmailAddress" UniqueName="email"></telerik:GridBoundColumn>
 
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Role">
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server"
                                Text='<%# DataBinder.Eval(Container.DataItem, "Role") %>'>
                            </asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:DropDownList ID="ddlRole" runat="server" DataTextField="Role1" DataValueField="RoleID"></asp:DropDownList>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridButtonColumn ConfirmText="Delete this Member?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="PushButton" Text="Delete" CommandName="Delete" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

 

I am using a stored procedure to to my updates and have this C# code:

protected void gvMembers_UpdateCommand(object sender, GridCommandEventArgs e)
        {
            var editableItem = ((GridEditableItem)e.Item);
            var memberId = (int)editableItem.GetDataKeyValue("UserID");
            int Role = 1;
            CheckBox active = (CheckBox)editableItem["valid"].Controls[0];
            Boolean bactive = Convert.ToBoolean(active);
            string str = active.Text;
            string strFirstName = (editableItem["firstname"].Controls[0] as TextBox).Text;
            string strLastName = (editableItem["lastname"].Controls[0] as TextBox).Text;
            string strUserName = (editableItem["username"].Controls[0] as TextBox).Text;
            string strEmail = (editableItem["firstname"].Controls[0] as TextBox).Text;
 
 
 
            try
                {
                //save chanages to Db
DbContext.AAHomicideLogMembersUpdate(memberId, Role, strFirstName, strLastName, strUserName, strEmail, active);
                }
                catch (System.Exception)
                {
                   string srtt="Dosomething";
                }
            }

 

I get an error message when attempting to convert the checkbox value to a boolean value.

 

How can I accomplish this?

Perry
Top achievements
Rank 1
 answered on 15 Sep 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?