Telerik Forums
UI for ASP.NET AJAX Forum
27 answers
741 views
Hi,

I've got the following code:

default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs"
    Inherits="default" EnableSessionState="False" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Basic Filtering</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="30"
        BackColor="#dff3ff">
        <table style="height: 100%; width: 100%" border="0">
            <tr>
                <td width="100%" align="center" valign="middle">
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/AjaxLoader-0066cc-W32ByH32.gif"
                        Width="32" Height="32" Style="border: 0px;" />
                </td>
            </tr>
        </table>
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadCodeBlock runat="server" ID="radCodeBlock">
        <script type="text/javascript">
            function showFilterItem() {
                $find('<%=RadGrid1.ClientID %>').get_masterTableView().showFilterItem();
            }
            function hideFilterItem() {
                $find('<%=RadGrid1.ClientID %>').get_masterTableView().hideFilterItem();
            } 
        </script>
    </telerik:RadCodeBlock>
    <p>
        Show filtering item
        <input id="Radio1" type="radio" runat="server" name="showHideGroup" checked="true"
            onclick="showFilterItem()" /><label for="Radio1">Yes</label>
        <input id="Radio2" type="radio" runat="server" name="showHideGroup" onclick="hideFilterItem()" /><label
            for="Radio2">No</label>
    </p>
    <telerik:RadGrid AutoGenerateColumns="false" ID="RadGrid1" DataSourceID="SqlDataSource1"
        Width="780px" AllowFilteringByColumn="True" AllowSorting="True" PageSize="15"
        ShowFooter="True" AllowPaging="True" runat="server" GridLines="None" EnableLinqExpressions="false">
        <PagerStyle Mode="NextPrevAndNumeric" />
        <GroupingSettings CaseSensitive="false" />
        <MasterTableView AutoGenerateColumns="false" EditMode="InPlace" AllowFilteringByColumn="True"
            ShowFooter="True" TableLayout="Auto">
            <Columns>
                <telerik:GridNumericColumn DataField="Order Id" HeaderText="Order Id" SortExpression="Order Id"
                    UniqueName="Order Id" FilterControlWidth="40px" AutoPostBackOnFilter="false"
                    CurrentFilterFunction="equalto" ShowFilterIcon="false" />
                <telerik:GridBoundColumn FilterControlWidth="150px" DataField="Ship Name" HeaderText="Ship Name"
                    SortExpression="Ship Name" UniqueName="Ship Name" AutoPostBackOnFilter="true"
                    CurrentFilterFunction="Contains" ShowFilterIcon="false" />
                <telerik:GridDateTimeColumn FilterControlWidth="70px" DataField="Order Date" HeaderText="Order Date"
                    SortExpression="Order Date" UniqueName="Order Date" PickerType="None" DataFormatString="{0:d}" />
                <telerik:GridDateTimeColumn FilterControlWidth="150px" DataField="Shipped Date" HeaderText="Shipped Date"
                    SortExpression="Shipped Date" UniqueName="Shipped Date" PickerType="DatePicker"
                    DataFormatString="{0:D}">
                    <HeaderStyle Width="260px" />
                </telerik:GridDateTimeColumn>
                <telerik:GridMaskedColumn FilterControlWidth="100px" DataField="Ship ZIP/Postal Code"
                    HeaderText="Ship ZIP/Postal Code" SortExpression="Ship ZIP/Postal Code" UniqueName="Ship ZIP/Postal Code"
                    Mask="#####">
                    <FooterStyle Font-Bold="true" />
                </telerik:GridMaskedColumn>
                <telerik:GridNumericColumn HeaderStyle-Width="90px" FilterControlWidth="50px" DataField="Shipping Fee"
                    DataType="System.Decimal" HeaderText="Shipping Fee" SortExpression="Shipping Fee"
                    UniqueName="Shipping Fee" Aggregate="Sum">
                    <FooterStyle Font-Bold="true" />
                </telerik:GridNumericColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings>
            <Scrolling AllowScroll="false" />
        </ClientSettings>
    </telerik:RadGrid>
   <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:MicrosoftAccess_v2007_Northwind %>"
        ProviderName="System.Data.OleDb" SelectCommand="SELECT * FROM Orders" runat="server">
    </asp:SqlDataSource>
    </form>
</body>
</html>

There's nothing in the code-behind file defaualt.aspx.cs. Problem I'm getting is that when I click on the paging or filtering, the AJAX request is served (I can see the telerik:RadAjaxLoadingPanel running), but it runs indefinitely and the data doesn't change. The data source itself is an Access 2007 file (Northwind 2007.accdb) located in the App_Data folder of the application.

I'm using "RadControls_for_ASP.NET_AJAX_2009_3_1103" on VS.Net 2010. The project where this Default.aspx page is set up is a "Telerik RadControls CSharp Web Application".

Thanks in advance for any help.

Sanjay.

Johny
Top achievements
Rank 1
 answered on 11 Jul 2016
4 answers
315 views

Hi. I would like to know how do i integrate asp:Repeater with telerik:RadPanelBar. my final outcome would be each row in the repeater is able to show and hide as the content of the repeater might cause the whole page to be very long

i receive the following error

Telerik.Web.UI.RadPanelItemCollection must have items of type 'Telerik.Web.UI.RadPanelItem'. 'ItemTemplate' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.

my markup.

01.<asp:UpdatePanel ID="UpdatePanel2" runat="server">
02.    <ContentTemplate>
03.
04.         <asp:Repeater ID="Repeater2" runat="server">
05.
06.              <HeaderTemplate>
07.                  <telerik:RadPanelBar RenderMode="Lightweight" runat="server" ID="RadPanelBar1" Width="750" Height="250"
08.                                        Skin="Telerik" ExpandMode="FullExpandedItem">
09.                                        <Items>
10.               </HeaderTemplate>
11.               <ItemTemplate>
12.                  <telerik:RadPanelItem Expanded="true" CssClass="top-offers">
13.                      <ContentTemplate>
14.                           <tr>
15.                              <td>
16.                                <asp:Label runat="server" ID="lblEntry">Entry Type <%# Container.ItemIndex+1 %></asp:Label>
17.                              </td>
18.                           </tr>
19.                           <tr>
20.                             <td>Entry Qualification</td>
21.                             <td>
22.                               <telerik:RadEditor ID="txtQualification" runat="server" Content='<%# DataBinder.Eval(Container.DataItem, "qualification") %>' ToolsFile="/Users/benjamin/Desktop/editor/ToolsFile.xml" EditModes="Design">
23.                                                        <DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
24.                                                    </telerik:RadEditor>
25.                              </td>
26.                           </tr>
27.                           <tr>
28.                              <td>Academic Requirement</td>
29.                               <td>
30.                                  <telerik:RadEditor ID="txtRequirement" runat="server" Content='<%# DataBinder.Eval(Container.DataItem, "requirement") %>' ToolsFile="/Users/benjamin/Desktop/editor/ToolsFile.xml" EditModes="Design">
31.                                                        <DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
32.                                                    </telerik:RadEditor>
33.                               </td>
34.                             </tr>
35.                            <tr>
36.                              <td>Relavant Working Experience</td>
37.                              <td>
38.                                 <telerik:RadEditor ID="txtExperience" runat="server" Content='<%# DataBinder.Eval(Container.DataItem, "experience") %>' ToolsFile="/Users/benjamin/Desktop/editor/ToolsFile.xml" EditModes="Design">
39.      <DocumentManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
40.                                                    </telerik:RadEditor>
41.                              </td>
42.                          </tr>
43.                          <tr>
44.                            <td>
45.                              <asp:Button ID="btnRemoveCert" runat="server" Text="Remove Certificate"
46.                                                        CommandName="remove" CommandArgument='<%# Container.ItemIndex %>' />
47.                            </td>
48.                          </tr>
49.                          <tr>
50.                             <td colspan="2"><hr /></td>
51.                         </tr>
52.                 </ContentTemplate>
53.            </telerik:RadPanelItem>
54.         </ItemTemplate>
55.         <FooterTemplate>
56.                  <tr>
57.                    <td>
58.                      <asp:Button ID="btnAddEntry" runat="server" Text="Add Entry" OnClick="btnAddEntry_Click" />
59.                     </td>
60.                  </tr>
61.                  </Items>
62.              </telerik:RadPanelBar>
63.        </FooterTemplate>
64.     </asp:Repeater>
65.
66.  </ContentTemplate>
67.</asp:UpdatePanel>

Veselin Tsvetanov
Telerik team
 answered on 11 Jul 2016
1 answer
133 views

I've hooked up RadGrid to an EntityDataSource control. It shows data fine, but won't update. Here is how I have the data source control setup:

<ef:EntityDataSource ID="EntityDataSource1" runat="server" EntitySetName="Events" DefaultContainerName="" EnableInsert="True" EnableUpdate="True" ContextTypeName="DataAccess.SurveyContext" EnableFlattening="False" AutoPage="False" AutoSort="False" EnableViewState="True"></ef:EntityDataSource>

Any ideas why update won't work?

David McCarter

 

 

 

Viktor Tachev
Telerik team
 answered on 11 Jul 2016
1 answer
204 views

I've got a Grid which holds quite a few columns of information.The first column of each row is a button with a unique ID that, when clicked, expands the DetailTables with relevant information to the row. The button executes the following command: CommandName="expandCollapse" .

 

How can I make it so that whenever I click a row it would expand the DetailTables? Any help would be much appreciated. 

Viktor Tachev
Telerik team
 answered on 11 Jul 2016
2 answers
435 views

I have some code I'm troubleshooting from our offshore team.  We have a datagrid that we want to enable paging on, the problem is that the CurrentPageIndex of the RadGrid is always 0.  We aren't using a DataSource property but retrieving our data via a service layer in the code-behind that calls a stored proc that uses OFFSET and FETCH to return the subset of rows based on the page index and page size.

Here's the ASPX code for the RadGrid:

<telerik:RadGrid ID="EnrollmentPeriodCompanyElectionsGrid" runat="server" AllowSorting="true" AutoGenerateColumns="false" PageSize="20" AllowPaging="True" AllowCustomPaging="true" OnPageIndexChanged="EnrollmentPeriodCompanyElectionsGrid_PageIndexChanged"
    OnPageSizeChanged="EnrollmentPeriodCompanyElectionsGrid_PageSizeChanged" OnNeedDataSource="EnrollmentPeriodCompanyElectionsGrid_NeedDataSource" OnItemDataBound="EnrollmentPeriodCompanyElectionsGrid_ItemDataBound" EnableViewState="true">
 
    <MasterTableView NoMasterRecordsText="Nothing was found for this election period">
        <Columns>
            <telerik:GridBoundColumn DataField="HrpClientID" HeaderText="ID" SortExpression="HrpClientID" />
            <telerik:GridHyperLinkColumn HeaderText="COMPANY" UniqueName="Company" SortExpression="CompanyName" DataTextField="CompanyName" DataNavigateUrlFields="CompanyID,BenefitEnrollmentPeriodID" DataNavigateUrlFormatString="~/Admin/Companies/Company.aspx?companyID={0}&page=Exhibits&periodID={1}"
                HeaderStyle-Width="300px" />
            <telerik:GridBoundColumn DataField="CompanyType" HeaderText="TYPE" SortExpression="CompanyType" />
            <telerik:GridBoundColumn DataField="HRP" HeaderText="HRP" SortExpression="HRP" />
            <telerik:GridBoundColumn DataField="HRC" HeaderText="HRC" SortExpression="HRC" />
            <telerik:GridBoundColumn DataField="EnrollmentStatus" SortExpression="EnrollmentStatus" HeaderText="STATUS" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Here's the NeedDataSource method:

protected void EnrollmentPeriodCompanyElectionsGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            try
            {
                var enrollmentId = Request.QueryString["PeriodID"] != null ? int.Parse(Request.QueryString["PeriodID"]) : 0;
                {
                    RadGrid enrollmentPeriodCompanyElectionsGrid = (RadGrid)sender;
 
                    int currentPageIndex = EnrollmentPeriodCompanyElectionsGrid.CurrentPageIndex;
                    var dataSource = GetBenefitEnrollmentCompanies(enrollmentId, currentPageIndex, pageSize);
 
                    enrollmentPeriodCompanyElectionsGrid.DataSource = dataSource.BenefitEnrollmentCompanyDetail;
 
                    // set this only once.
                    if (enrollmentPeriodCompanyElectionsGrid.VirtualItemCount == 0)
                        enrollmentPeriodCompanyElectionsGrid.VirtualItemCount = dataSource.TotalRecordsCount;
                }
 
            }
            catch (Exception ex)
            {
                ErrorHandler.HandleError<Exception>(ex, new { UserID = CurrentUser.UserID, CompanyID = CurrentCompany.CompanyID, ViewingUserID = CurrentUser.UserID, PageIndex = 1, PageSize = pageSize });
            }
        }

and PageIndexChanged:

protected void EnrollmentPeriodCompanyElectionsGrid_PageIndexChanged(object sender, GridPageChangedEventArgs e)
    {
        try
        {
            // reset this property to new page after.
            EnrollmentPeriodCompanyElectionsGrid.CurrentPageIndex = e.NewPageIndex + 1;
        }
        catch (Exception ex)
        {
            ErrorHandler.HandleError<Exception>(ex, new { UserID = CurrentUser.UserID, CompanyID = CurrentCompany.CompanyID, ViewingUserID = CurrentUser.UserID, PageIndex = e.NewPageIndex, PageSize = pageSize });
        }
    }

However, no matter what the CurrentPageIndex is 0.  I've verified by manually changing the CurrentPageIndex in Visual Studio that, when set, paging works correctly, it just is always being set to 0.  I've tried everything, but I can't get the paging to recognize that I'm selecting a new page.

Kostadin
Telerik team
 answered on 11 Jul 2016
4 answers
84 views

I have a DDT binding server side to Id & Name, I also have checkboxes

rdtLocation.DataSource = locations;
rdtLocation.DataTextField = "Name";
rdtLocation.DataFieldID = "Id";
rdtLocation.DataValueField = "Id";
rdtLocation.DataFieldParentID = "ParentId";
rdtLocation.DataSource = locations;
rdtLocation.DataBind();

With one selected item when I look at the selectedValue I get a comma separated list containing 2 instances of the id. ie - "2,2"

See attached screen shot.

Why is this and what is the fix.

Andy

Eyup
Telerik team
 answered on 11 Jul 2016
1 answer
193 views

Hi there,

I need to show next and prev button above rad grid so that when my site is open on mobile view, user can navigate to rest of the columns. Every column is given fixed width. But the issue I am facing that I must have to freeze at least one column.

Current code:

<MasterTableView DataKeyNames="UserID" HeaderStyle-Width="100px" TableLayout="Auto" CommandItemDisplay="TopAndBottom" CommandItemSettings-ShowAddNewRecordButton="false" CommandItemSettings-ShowRefreshButton="false" CommandItemSettings-NextFrozenColumnText="Next Column" CommandItemSettings-PrevFrozenColumnText="Previous Column">

 <ClientSettings>
         <Scrolling AllowScroll="true" UseStaticHeaders="true" FrozenColumnsCount="1" EnableNextPrevFrozenColumns="true" />
 </ClientSettings>

When I set FrozenColumnsCount="0", next and prev button stop working.

Kindly provide the solution so that no column would get freezed.

 

Viktor Tachev
Telerik team
 answered on 11 Jul 2016
1 answer
426 views

I have a radgrid which is batch edit mode. How can I get one column value and set Max value to another Column in grid.

Thank You.

Eyup
Telerik team
 answered on 11 Jul 2016
1 answer
129 views

Hello, 

As far as I know the RadMap is missing a Scale control.

Researching what to do i came across the following example to manually add one: http://dojo.telerik.com/ogAke

I have implemented this but its not satisfying, in bigger zooms there is a bug and the numbers go smaller. (i believe the javascript var is overflowing)

Anyhow, do you have any suggestions about which alternative could i follow to implement a nice scale? Is Telerik planning on adding the scale?

Thank you!

 

 

Ianko
Telerik team
 answered on 11 Jul 2016
4 answers
228 views
Hi there,

I have a radwindow that performs a search on data and displays a list within a repeater of options the user may select.
What I need to do is collect the repeater object and send back to the parent. 

I looked at some of your examples using javascript, the problem is using javascript to grab the data within the repeater is quite ugly.

Is there a way I can pass the code back via code behind?
So in my repeater I have a button "select" when user clicks the "select" button the radwindow closes and
the parent receives the selection. 

My repeater code

​<asp:Repeater ID="rptStores" runat="server" OnItemDataBound="rptStores_ItemDataBound">
<HeaderTemplate>
<table>
<tr style="color:#ffd700; font-weight:bold;">
<td>Store Name</td>
<td>City</td>
<td>Street</td>
<td>Distance(Mi.)</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="color:#fff;" onmouseover="this.style.backgroundColor='blue'" onmouseout="this.style.backgroundColor=''" class="<%# If(Container.ItemIndex Mod 2 = 0, "TRNormal", "TRAlt") %>">
<td style="padding: 4px;">
<asp:Label ID="lblDBAName" runat="server" Text='<%# Eval("DBAName") %>' />
<asp:HiddenField ID="hfRowID" runat="server" Value='<%# Eval("id") %>' />
</td>
<td style="padding: 4px;">
<asp:Label ID="lblCity" runat="server" Text='<%# Eval("State") +"-"+ Eval("City")%>' />
<asp:HiddenField ID="hfState" runat="server" Value='<%# Eval("state") %>' />
</td>
<td style="padding: 4px;">
<asp:Label ID="lblStreet" runat="server" Text='<%# Eval("Street1") %>' />
<asp:HiddenField ID="hfPhone" runat="server" Value='<%# Eval("phone") %>' />
</td>
<td style="padding: 4px;">
<asp:Label ID="lblDistance" runat="server" Text='<%# Eval("distance") %>' />
</td>
<td>
<telerik:RadButton runat="server" Text="Select" ID="storeSelection2" CommandName="Process" Skin="Black" OnClientClicked="returnToParent"></telerik:RadButton>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
<asp:Label ID="lblEmptyData" Text="No Data To Display" runat="server" Visible="false"></asp:Label>
</td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>


my vb

Protected Sub rptStores_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rptStores.ItemCommand

Dim dbaName As Label
dbaName = CType(e.Item.FindControl("lblDBAName"), Label)

Dim city As Label
city = CType(e.Item.FindControl("lblCity"), Label)

Dim state As HiddenField
state = CType(e.Item.FindControl("hfState"), HiddenField)

Dim phone As HiddenField
phone = CType(e.Item.FindControl("hfPhone"), HiddenField)

Dim street1 As Label
street1 = CType(e.Item.FindControl("lblStreet"), Label)

Dim selectedID As HiddenField
selectedID = CType(e.Item.FindControl("hfRowID"), HiddenField)

ProcessButton(dbaName.Text, street1.Text, city.Text, state.Value, phone.Value, selectedID.Value)

End Sub

ProcessButton is called AFTER a return to parent javascript call.

Is this an option or do i really need to send object via javascript back to parent and then push into code behind.

Julius
Top achievements
Rank 1
 answered on 10 Jul 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?