Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
200 views

I have a page for which the ASPX consists of an empty RadMultiPage, plus a RadAjaxManager.  The RadMultiPage has a PageViewCreated handler, and the form has an asp:Timer which fires every 15 seconds to provide an auto-refresh.    The RadAjaxManager has ajax settings for the Timer object to update a label, a hidden field and the RadMultiPage.

In the Page_Load, within if (!IsPostBack) {}, I create a new RadTab + RadPageView for each page of my display.  In turn, when the page loads, all of the controls within each page are generated via C# code based on database information.   The controls include replicated blocks, and in each block there are a pair of ImageButtons (Plus, Minus) which are to update a value within the block.

When I create each of the two ImageButtons and the associated Label which contains the affected value, I add a handler into my code-behind, and I use RadAjaxManagerForm.AjaxSettings.AddAjaxSetting(<ImageButton>,<Label>).   I also save an Attribute to each button with the ID of the Label control so I can find it in the button Handler.

The handler used an Attribute on the 'sender' (ImageButton) to find the ID of the associated Label to be updated, and I tried two ways -- to save the Label control in a Dictionary<string,Label> in the PageViewCreated handler, and by using sender.Parent.Parent, etc to navigate through the tree to find the Label.  Both had the same result.

So, this sort of works for me, I can load the page, and I can click the plus/minus buttons and see the value change in the control associated with the buttons.   After a full page refresh, I can click Plus/Minus button and see a result in the Label.   I also see my value updated in the database, so it's functioned correclty so far.

The weird part is that when the page auto-refreshes.  all of the control blocks *except* the one I used Plus/Minus buttons on -- are updated to the value from the DB.  If I change all values, then they all reflect the new values except the one I clicked on.  If I then do a full page refresh, all values update correctly, and after that, will reflect the values from the DB normally.


So it appears that by finding the Label control in my button handler and updating it's Text, this control is now somehow locked into the ajax responses as some floating object and the underlying PageCreated handler doesn't seem to affect what the browser shows for that control.  If I *don't* update the Label in my button handler but instead wait for the page refresh, the Label will update from the database as I'd like -- but the user is confused because it takes as long as 15 seconds for the change to show.

So, what am I doing wrong here?  I could try to create a stand-alone sample but it might take hours to extract, so first I'm hoping someone sees my error outright.

 


Maria Ilieva
Telerik team
 answered on 22 Mar 2016
1 answer
92 views

Hi

I have seen the responsive nature of the Scheduler control and it seems to behave exactly how I want it.

My design however needs some responsive behaviour around the interface.

I want to have a calendar control on the left to select a date for the scheduler, and a top menu bar.

What needs to happen is my menu bar collapse to 'Hamburgers' and the left handed calendar control collapse to its icon.

Is this approach possible with the page layout controls.

Andy

Magdalena
Telerik team
 answered on 22 Mar 2016
1 answer
138 views

I have not been able to figure out why I am not getting the filter results I am expecting. In fact I always get no results.

When the page first loads all the data is displayed as expected.

When I enter as search query and click the Search button the RadListView control refreshes with no results. I see the spinner so I know it posted back via AJAX.

I debug the C# code and I can confirm that the search query value is passed to the BuildExpression for the filter. No errors or exceptions are thrown.

If I submit an empty query it should just Clear the Filter and all results should show, but that does not happen.

The datasource is a List<DeviceSearchResult>.

Any ideas?

Here is my markup:

<asp:Panel ID="pnlSearchView" runat="server" Visible="True">
    <h1>Search View</h1>
     
    <telerik:RadAjaxManager ID="RadAjaxManager" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="txtDeviceSearchQuerySubmit">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lvDeviceSearchResults" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
       <asp:TextBox ID="txtDeviceSearchQuery" runat="server"></asp:TextBox>
    <asp:Button ID="txtDeviceSearchQuerySubmit" runat="server" OnClick="txtDeviceSearchQuerySubmit_OnClick" Text="SEARCH"/>
    <telerik:RadListView ID="lvDeviceSearchResults" RenderMode="Lightweight" runat="server"
         OnNeedDataSource="lvDeviceSearchResults_NeedDataSource"
         ItemPlaceholderID="phDeviceSearchResult">
        <LayoutTemplate>
            <asp:PlaceHolder ID="phDeviceSearchResult" runat="server"></asp:PlaceHolder>
        </LayoutTemplate>
        <ItemTemplate>
            <%# ShowGroupRow(Eval("DeviceManufacturer").ToString())=="yes"
                    ? "<div class=\"manufacturer\"><strong>"+Eval("DeviceManufacturer")+"</strong></div>"
                    : ""  %>
            <div>- <%# Eval("DeviceName") %> | <%# Eval("DevicePackage") %> | <%# Eval("DevicePin") %></div>
            <asp:ListView ID="lvDeviceSearchResultAdapters" runat="server" ItemPlaceholderID="phDeviceSearchResultAdapters" DataSource='<%# Eval("DeviceAdapters") %>'>
                <LayoutTemplate>
                    <ul><asp:PlaceHolder ID="phDeviceSearchResultAdapters" runat="server"/></ul>
                </LayoutTemplate>
                <ItemTemplate>
                    <li><%# Container.DataItem.ToString() %></li>
                </ItemTemplate>
            </asp:ListView>
        </ItemTemplate>
    </telerik:RadListView>
</asp:Panel>

 

Here is my C#:

protected void lvDeviceSearchResults_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
{
    lvDeviceSearchResults.DataSource = TempDeviceSearchResults.OrderBy(d => d.DeviceManufacturer).ThenBy(d =>d.DeviceName);
}
 
protected void txtDeviceSearchQuerySubmit_OnClick(object sender, EventArgs e)
{
    lvDeviceSearchResults.FilterExpressions.Clear();
    var query = txtDeviceSearchQuery.Text.Trim();
    if (!string.IsNullOrEmpty(query))
    {
        lvDeviceSearchResults.FilterExpressions.BuildExpression(ex => ex
            .Contains("DeviceName", query)
            );
    }
    lvDeviceSearchResults.Rebind();
}

Chris
Top achievements
Rank 2
Veteran
 answered on 22 Mar 2016
14 answers
152 views

Hi,

after the last update (2013.1.403.40) we noticed a changed behaviour on the RadDateTimePicker component. If the user does not tab out from the component or goes to another input field before he does a callback the SelectedDate is null.

I'm pasting in a test project

Best regards

Robert

ASPX

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
 
<!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>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
        Instructions. Change time of the RadDateTimePicker component and press the TEST button.
    </div>
    <div>
        <telerik:RadDateTimePicker ID="rdtpTimeStamp" runat="server">
        </telerik:RadDateTimePicker>
           <hr />
         <telerik:RadTabStrip ID="tsFunctionMenu" runat="server" OnTabClick="tsFunctionMenu_TabClick"
            SkinID="FunctionMenuSkin">
        </telerik:RadTabStrip>
        <hr />
        <asp:Label ID="Label1" runat="server" Text="..."></asp:Label>
        <hr />
    </div>
    </form>
</body>
</html>

CS

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
 
public partial class Default : System.Web.UI.Page
{
 
    protected void Page_Init(object sender, EventArgs e)
    {
        RadTab tab = new RadTab("TEST", "TEST");
        tsFunctionMenu.Tabs.Add(tab);
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        Add("<hr>");
        Add("Page_Load");
        Add(String.Format("Date: {0}", rdtpTimeStamp.SelectedDate));
 
        if (!IsPostBack)
        {
            rdtpTimeStamp.SelectedDate = DateTime.Now;
        }
    }
 
    protected void tsFunctionMenu_TabClick(object sender, RadTabStripEventArgs e)
    {
        RadTabStrip ts = (RadTabStrip)sender;
        ts.SelectedIndex = -1;
 
        string cmd = e.Tab.Value;
 
        Add(String.Format("TabClick: {0}", cmd));
 
    }
 
    protected void Add(string text)
    {
        Label1.Text += "<br>" + text;
    }
    protected void Add(string text, object o)
    {
        Add(String.Format(text, o));
    }
 
 
}


Warnestam
Top achievements
Rank 1
 answered on 22 Mar 2016
2 answers
148 views

Hi telerik,

Strucked in getting resoluation, itemdatabound in radgrid firing twice in vb.net.

Thanks,

Lokesh

Loki
Top achievements
Rank 1
 answered on 22 Mar 2016
8 answers
420 views

Hi,
In my Pivot table i want to set the width for each column of row Filed.

I set the column width like this.

                        <telerik:PivotGridRowField DataField="Maintype"  Caption="" CellStyle-Width="60px"     >
                </telerik:PivotGridRowField>
                   <telerik:PivotGridRowField DataField="subtype"  Caption="" CellStyle-Width="60px"  >
                </telerik:PivotGridRowField               
                <telerik:PivotGridRowField DataField="Listtype"  Caption="" CellStyle-Width="110px"  >
                </telerik:PivotGridRowField>

but i found some stange result as the width for each column is in irregular form.
means first column width set to second column and last column with is not changing
Please check the attached image for details.

I dont want to use the RowHeaderCellStyle widh ,because this will set the same width for all the row field column.

I want to set the Individual column width of rowfield.



Konstantin Dikov
Telerik team
 answered on 22 Mar 2016
1 answer
168 views

Hi,

I'm interested in changing the order of the columns at runt-time for columns created in design-view. I have tried in Grid_PreRender but it doesn't work

Also, is it possible mix dynamically created columns with columns created in design?

 

Thanks,

catalin

Viktor Tachev
Telerik team
 answered on 22 Mar 2016
1 answer
109 views

Hi Telerik team,

i strucked in getting result in rad grid footer. bcoz itemdatabound firing twice in vb.net, result is getting doubled.

 

Dim total As Integer
    Protected Sub grdAddList_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grdAddList.ItemDataBound
        Try

            If TypeOf e.Item Is GridDataItem Then
                Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
                Dim fieldValue As Integer = Integer.Parse(dataItem("Amount").Text)
                total = (total + fieldValue)
            End If

            If TypeOf e.Item Is GridFooterItem Then
                Dim footerItem As GridFooterItem = CType(e.Item, GridFooterItem)
                footerItem("Amount").Text = "Total: " + total.ToString()
            End If
          

        Catch ex As Exception
            Dim strExpMsg As String
            strExpMsg = className & "." & MethodBase.GetCurrentMethod().Name & "()" & "->" & ex.Message.ToString()
            ExceptionHandler(strExpMsg, ex, Me.strUserName)
        End Try
    End Sub

 

Thanks,

Lokesh

 

Viktor Tachev
Telerik team
 answered on 22 Mar 2016
4 answers
389 views
Hey!

I have a GridTemplateColumn where I define a TextBox and a Button in the EditItemTemplate property. How is it possible to fire the onClick event of the button.

I have tried the following:
<asp:ImageButton ID="Button" runat="server" ImageUrl="~/Resources/key.png" OnClick="Button_Click" />

... but this doesn't work I always get the following compilation error "...does not contain a definition for 'Button_Click' and no extension method ... (are you missing a using directive or an assembly reference?)".

I don't know what I made wrong - can anybody help me?

Kostadin
Telerik team
 answered on 22 Mar 2016
5 answers
337 views

Hi there;

Two questions:

1.  I'm currently rendering a radar chart inside a DIV, which has text-align set to center.  The chart continually renders on the left side of the DIV, though.  Is there a trick I'm missing?

2.  Some of the x axis labels are truncated.  Is there a way to prevent this?

Thanks,

Jason

<div class="ChartContainer">
<telerik:RadHtmlChart ID="radarRCM" runat="server" Width="400px" >
    <Legend>
        <Appearance Visible="false"></Appearance>
    </Legend>
    <PlotArea>
        <Series>
            <telerik:RadarLineSeries DataFieldY="Score" Name="RadarLineSeries1">
                <LabelsAppearance Visible="false"></LabelsAppearance>
            </telerik:RadarLineSeries>
        </Series>
        <XAxis DataLabelsField="Discipline" >
        </XAxis>
    </PlotArea>
 
    <Zoom Enabled="False"></Zoom>
</telerik:RadHtmlChart>
</div>

Stamo Gochev
Telerik team
 answered on 22 Mar 2016
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?