Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
187 views
I am currently trying to follow the RadCalendar and RadTooltipManager demo for my project but an experiencing some strange behavior.

When I come to the page for the first time the day cells will not show their tooltips, however when I click a day which causes an AJAX postback I have setup with rad ajax manager, the tooltips will start showing normally.

I have also tried using a RadAjaxPanel with RadTooltipManager, RadCalendar, and RadListView all inside, as well as an asp UpdatePanel with UpdateMode conditional with the other controls inside it as well, when using these methods the tooltips will not appear at all even after postbacks.

I think it might have to do with adding the controls to the TargetControls collection?

Also, I am doing this as a module for DotNetNuke if that information helps at all.

Relevant ASCX Code:
<telerik:RadAjaxLoadingPanel ID="LoadingPanel" runat="server" Skin="Metro"></telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxManager ID="AjaxManager" runat="server" EnablePageHeadUpdate="false" EnableAJAX="true">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rcPassCalendar">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rlvDayClassesInfo" LoadingPanelID="LoadingPanel" />
                <telerik:AjaxUpdatedControl ControlID="rcPassCalendar" LoadingPanelID="LoadingPanel" />
                <telerik:AjaxUpdatedControl ControlID="TooltipManager" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadToolTipManager ID="TooltipManager" runat="server" OnAjaxUpdate="TooltipManager_AjaxUpdate" Position="MiddleRight" Width="300" Height="300" RelativeTo="Element"
    Animation="Fade" AnimationDuration="250" ShowDelay="0" Skin="Glow">
</telerik:RadToolTipManager>
 
<telerik:RadCalendar ID="rcPassCalendar" runat="server" AutoPostBack="True" ShowRowHeaders="False" ShowOtherMonthsDays="False" Width="100%"
    OnSelectionChanged="rcPassCalendar_SelectionChanged" OnDayRender="rcPassCalendar_DayRender" EnableMultiSelect="false" EnableMonthYearFastNavigation="true" CellVAlign="Top" DefaultCellPadding="0"
    ShowDayCellToolTips="false">
    <FooterTemplate>
        <asp:Panel ID="pnlCalendarInstruction" runat="server" CssClass="dnnFormMessage dnnFormWarning" style="margin-bottom:0px;">
            Please select a day in the calendar above to see the sessions occurring on that day below.
        </asp:Panel>
    </FooterTemplate>
    <CalendarDayTemplates>
        <telerik:DayTemplate ID="Class" runat="server">
            <Content>
                <asp:Panel ID="pnlDaySessions" runat="server" CssClass="classDay">
                     
                </asp:Panel>
            </Content>
        </telerik:DayTemplate>
    </CalendarDayTemplates>
</telerik:RadCalendar>

Relevant C# Codebehind:
protected void rcPassCalendar_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
        {
            DateTime calendarDate = e.Day.Date;
            var daySessionQuery = from session in MonthsSessions
                                  where session.StartDt.Date == calendarDate.Date
                                  select session;
 
            //Need to ad an ID to the calendar cells, they don't have one by default.
            string uniqueDayNumber = e.Day.Date.Day.ToString() + e.Day.Date.Month.ToString() + e.Day.Date.Year.ToString();
 
             
            e.Cell.Attributes.Add("id", "Calendar_" + uniqueDayNumber);
            TooltipManager.TargetControls.Add(e.Cell.Attributes["id"], e.Day.Date.Day.ToString(), true);
 
            if (daySessionQuery != null && daySessionQuery.Count() > 0)
            {
                //e.Cell.Controls.Add(BuildEventDayControls(daySessionQuery, e.Day.Date.Day.ToString()));
 
                if (calendarDate.Month == rcPassCalendar.FocusedDate.Month)
                {
                    rcPassCalendar.SpecialDays.Add(e.Day);
                }
                     
            }
        }
Danail Vasilev
Telerik team
 answered on 25 Jul 2014
5 answers
803 views
I have created a radgrid that displays labels in the first column and input controls in column 2. Column 2 can have either textbox or  DropDownList controls. What I can't figure out is how to get the values of the input controls when the form is submitted

I have tried the following but the XControl is always null. I would like to return the grid contents as XML if possible

foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
            {
                TextBox xControl = item["AttributeType"].FindControl("tb") as TextBox;
            }

Any help/ideas would greatly be appreciated!!!



ASPX Markup

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

<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<!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 runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server" style="height: 503px;" >
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
      <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="SpaceType" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="SpaceType">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <div>
    
    </div>
    <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None"
        OnItemCreated="RadGrid1_ItemCreated" Width="350px" Height="200px"  
        
        style="z-index: 1; left: 137px; top: 111px; position: absolute; height: 46px; width: 366px"
        AutoGenerateColumns="False" BorderStyle="None" >
<MasterTableView>
    <ItemTemplate>
    <%--This is required for Dynamic Creation of ItemTemplate Controls--%>
    </ItemTemplate>
    <Columns>
        <telerik:GridBoundColumn DataField="AttributeName" UniqueName="AttributeName"
            HeaderText="Space Attribute">
            <HeaderStyle Width="100px" />
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="AttributeType" UniqueName="AttributeType"
            HeaderText="Value">
            <HeaderStyle Width="75px" />
        </telerik:GridBoundColumn>
     </Columns>
</MasterTableView>
    </telerik:RadGrid>
    
    <asp:Button ID="Button1" runat="server" Text="Button"
        style="z-index: 1; left: 516px; top: 254px; position: absolute"
        onclick="Button1_Click" />
    
   
    <telerik:RadComboBox ID="SpaceType" Runat="server"
        style="z-index: 5; left: 273px; top: 63px; position: absolute; height: 22px; width: 160px; right: 486px;"
        DataSourceID="SqlDataSource1" DataTextField="Description" DataValueField="ID"
        onselectedindexchanged="SpaceType_SelectedIndexChanged"
        AutoPostBack="True">
     </telerik:RadComboBox>
     <div style="width: 231px; height: 31px; position: absolute; top: 525px; left: 13px; z-index: 1;">
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:UserConn %>"
        SelectCommand="SELECT ID,Description from SpaceTypes order by ID">
    </asp:SqlDataSource>
  </div>
     </form>
</body>
</html>

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Code Behind!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

using System;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;

public partial class ESManager : System.Web.UI.Page
{
    DataSet ds = new DataSet();
    
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            
        }
        else
        {
            foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
            {
                TextBox xControl = item["AttributeType"].FindControl("tb") as TextBox;
            }
        }
    }

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        try
        {
            if (e.Item is GridDataItem)
            {

                int idex = Convert.ToInt32(e.Item.ItemIndexHierarchical);
                string type = ds.Tables[0].Rows[idex]["type"].ToString();

                Label LabelControl = new Label();
                LabelControl.ID = "l1";
                LabelControl.Text = ds.Tables[0].Rows[idex].ItemArray[0].ToString();
                LabelControl.Width = 200;
                GridDataItem item = e.Item as GridDataItem;
                item["AttributeType"].Controls.Add(LabelControl);

                if (type.ToLower() == "textbox")
                {
                    
                        TextBox xControl = new TextBox();
                        xControl.ID = "tb";
                        xControl.Text = "";
                        try { xControl.ToolTip = ds.Tables[0].Rows[idex]["doc"].ToString(); }
                        catch { }
                        xControl.Width = 75;
                        xControl.MaxLength = 7;
                        xControl.ValidationGroup = "GridControls";
                        item["AttributeType"].Controls.Add(xControl);

                        RequiredFieldValidator validator = new RequiredFieldValidator();
                        validator.ControlToValidate = xControl.ID;
                        validator.ErrorMessage = "*";

                }
                if (type.ToLower() == "listbox")
                {
                    DropDownList xControl = new DropDownList();
                    xControl.ID = "lb1";
                    string[] items = ds.Tables[0].Rows[idex]["items"].ToString().Split(',');
                    foreach (string xitem in items)
                    {
                        xControl.Items.Add(xitem);
                    }
                    xControl.SelectedValue = items[0];
                    xControl.ValidationGroup = "GridControls";
                    item["AttributeType"].Controls.Add(xControl);
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
    
    protected void SpaceType_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["UserConn"].ToString()))
        {
            SqlCommand cmd = new SqlCommand("SELECT xmlTemplate from SpaceTypes where id=@ID", conn);

            cmd.Parameters.AddWithValue("@ID", SpaceType.SelectedValue.ToString());

            conn.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                try
                {
                    StringReader strReader = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + reader["xmlTemplate"].ToString());

                    ds.ReadXml(strReader, XmlReadMode.InferSchema);
                    RadGrid1.DataSource = ds;
                    RadGrid1.DataBind();
                }
                catch (Exception ex)
                {
                }
            }
        }
    }

 
    protected void Button1_Click(object sender, EventArgs e)
    {
 
    }
}

JJ
Top achievements
Rank 2
 answered on 25 Jul 2014
5 answers
1.1K+ views
Hello, I have a RadGrid with multiples textboxes to be edited.
When i made "submit" (Postback on page) i lose all values inserted on that textboxes because RadGrid loses is values.

How can i solve this problem?

Any solution?
Thanks, Bruno F.
JJ
Top achievements
Rank 2
 answered on 25 Jul 2014
3 answers
300 views
I have been following your examples and created a RadGrid very similar to http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx

in EditFormSettings I use PopUpSettings-Modal="true" and then <FormTemplate> I list a number of text boxes.

One of these text boxes is for a datetime field. I would like it so that when the user clicks "add new record" and the pop up shows up that in the form in this text box is prepopulated with the current date. I can't seem to get this working. This is my code:

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
        {
            String strDate = DateTime.Today.ToString(); 
if (e.CommandName == RadGrid.InitInsertCommandName) //Runs when "Add new" button clicked
        {
                //Code to prepopulate field (But Doesn't Work)
GridCommandItem item = (GridCommandItem)e.Item; /*If I try with data item I get error: Unable to cast object of type 'Telerik.Web.UI.GridCommandItem' to type 'Telerik.Web.UI.GridDataItem'. */
TextBox txtname = (TextBox)item.FindControl("txtDate"); //txtDate is the name of the txtbox I want to prepopulate
txtname.Text = strDate;
}

However because its in a pop up it can't find the control and I get error: "NullReferenceException was unhandled by usercode, Object reference not set to an instance of an object."
Is this(Prepopulating a form template textbox inside a popup) even possible to do?... If so how?... Thank You
Sai
Top achievements
Rank 1
 answered on 25 Jul 2014
2 answers
322 views
I am having trouble controlling a radtextbox. I have a radcombobox(ddlMaritalStatus) and a radtextbox(txtSpoueName) on my page. What I would like is that when a user selects "Single" from ddlMaritalStatus then txtSpouseName becomes disabled. My problem is that if a user selects "Married" and starts to type in txtSpouseName but then changes ddlMaritalStatus to "Single" the text is still in txtSpouseName. So how do I make it so that if user selects "Single" then txtSpouseName becomes disabled and any text is erased and when user selects "Married" txtSpouseName becomes enabled again?

<p>
<telerik:RadComboBox ID="ddlMaritalStatus" runat="server" EmptyMessage="--Select--" OnClientSelectedIndexChanged="DisableBox" TabIndex="15" AutoPostBack="false"></telerik:RadComboBox>
​<script type="text/javascript">

function DisableBox(sender, args) {
    var TextBox = $find("<%=txtSpouseName.ClientID %>");
    if (sender.get_selectedItem().get_value() == "Single") {
         document.getElementById(sender.get_id().replace("ddlMaritalStatus", "txtSpouseName")).value = "";
         //document.getElementById("txtSpouseName").disabled=true;
         document.getElementById("txtSpouseName").setAttribute("Enabled", "False");
     }   
     else {
         document.getElementById(sender.get_id().replace("ddlMaritalStatus", "txtSpouseName")).value = "";
         //document.getElementById("txtSpouseName").disabled = false;
         document.getElementById("txtSpouseName").
     }
}

</script>
<asp:RequiredFieldValidator ID="MaritalStatusValidator" runat="server" ErrorMessage="Please Select" ControlToValidate="ddlMaritalStatus"></asp:RequiredFieldValidator>
</p>
<p>
<telerik:RadTextBox ID="txtSpouseName" runat="server" Enabled="false" AutoPostBack="false" TabIndex="16"></telerik:RadTextBox>
<asp:RegularExpressionValidator ID="SpouseNameValidator" runat="server" ErrorMessage="First (Initial) Last" ValidationExpression="[A-Z][a-z]+ ?[A-Z]? ([A-Z][a-z]?')?([A-Z][a-z]+?-)?[A-Z][a-z]+" ControlToValidate="txtSpouseName"></asp:RegularExpressionValidator>
</p>



My script is not working
Jesse
Top achievements
Rank 1
 answered on 25 Jul 2014
4 answers
117 views
We are using Telerik's Grid in ASP.NET to create a form where users can view and edit data. The filter functionality does not appear to be working; a user can enter data in a filter field and click on the filter icon, but when the menu with the filter options pops up, the user cannot click on any of the filter options. This only happens in IE 11.

We are using the 2013.3.1324.40 release of Telerik.Web.UI. Because some components did not function properly in IE 11, we have specified x-ua-compatible as "IE=9,10" and enabled UseLegacyBrowserCaps. I suspect that updating to the latest version of Telerik and switching to 'edge' instead of specifying rollback behavior to IE 9 and 10 will resolve this.

Can you confirm that the filters work properly in IE 11 when running in Edge mode?
Konstantin Dikov
Telerik team
 answered on 25 Jul 2014
2 answers
144 views
Dear Support,

after updatin to the newest ui an error is raising



In this case the property this._functionality is undefined.

Whats wrong?

Kinde regards,
Christian 





Dobromir
Telerik team
 answered on 25 Jul 2014
4 answers
146 views
Hi  I have a user control that I am trying to populate within a nested Gridview  detail view,   the code below shows the casesOrdered value  but not in the user control uc1:BrandVisit  which accepts inputs as in casesMerchandised  How can I bind values to this user control?   Any ideas would be much appreciated


<asp:DetailsView ID="DetailsView1" AllowPaging="true" runat="server" GridLines="None" Width="100%" DataSourceID="
<asp:DetailsView ID="DetailsView1" AllowPaging="true" runat="server" GridLines="None" Width="100%" DataSourceID="SqlDataSourceVimto" Font-Italic="true" AutoGenerateRows="false">
               <Fields>
                   <asp:TemplateField><ItemTemplate>
                        Cases are  <%# Convert.ToDecimal(Eval("casesOrdered")) %>
                      
                          <uc1:brandVisit  runat="server" ID="brandVisit"   casesOrdered='<%# Bind("casesOrdered") %>'  OnDataBinding="brandVisit_DataBinding" casesMerchandised="12"   />
 
                   </ItemTemplate></asp:TemplateField>
               </Fields>
           </asp:DetailsView>
"
Font-Italic="true" AutoGenerateRows="false">
               <Fields>
                   <asp:TemplateField><ItemTemplate>
                        Cases are  <%# Convert.ToDecimal(Eval("casesOrdered")) %>
                      
                          <uc1:brandVisit  runat="server" ID="brandVisit"   casesOrdered='<%# Bind("casesOrdered") %>'  OnDataBinding="brandVisit_DataBinding" casesMerchandised="12"   />
 
                   </ItemTemplate></asp:TemplateField>
               </Fields>
           </asp:DetailsView>

 

The BradVisit User contro is like below
public decimal casesOrdered
  {
      get
      {
          return decimal.Parse(tbCasesOrdered.Text);
      }
      set{
          tbCasesOrdered.Text = value.ToString();
      }
    }




Gareth
Top achievements
Rank 1
 answered on 25 Jul 2014
6 answers
249 views
The issue is when I click on the series in the chart, OnClientSeriesClicked event is not firing. 
for the same type of chart OnClientSeriesHovered event is working fine.Please do the needful whether this type chart is not supports with OnClientSeriesClicked  event or Is there anything wrong with my code.?If not supports with OnClientSeriesClicked  event let me know the other alternative way for click event.

attached Output.

 <telerik:RadHtmlChart runat="server" ID="TemperatureRadHtmlChart" Width="900" Height="350"
                OnClientSeriesClicked="OnClientSeriesClicked" Transitions="true">
                <PlotArea>
                    <Appearance>
                        <FillStyle BackgroundColor="White"></FillStyle>
                    </Appearance>
                    <Series>
                        <telerik:CandlestickSeries Name="XAxis" DataCloseField="MaxTemp" DataHighField="MaxTemp"
                            DataOpenField="MinTemp" DataLowField="MinTemp">
                            <Appearance>
                                <FillStyle BackgroundColor="LimeGreen" />
                            </Appearance>
                            <TooltipsAppearance DataFormatString="{0}" Color="Black">
                                <ClientTemplate>
                                 #=dataItem.XAxis#:#=dataItem.MinTemp# to #=dataItem.MaxTemp#
                                </ClientTemplate>
                            </TooltipsAppearance>
                        </telerik:CandlestickSeries>
                    </Series>
                    <XAxis Step="100" MajorTickType="Outside" MinorTickType="Outside" Reversed="false"
                        Color="Black">
                        <LabelsAppearance RotationAngle="0">
                        </LabelsAppearance>
                        <MajorGridLines Color="White" Width="1"></MajorGridLines>
                        <MinorGridLines Color="White" Width="1"></MinorGridLines>
                        <TitleAppearance Position="Center" RotationAngle="0">
                        </TitleAppearance>
                    </XAxis>
                    <YAxis Color="Black" MajorTickSize="1" MajorTickType="Outside" MinorTickSize="1"
                        MinorTickType="Outside" Reversed="false">
                        <MajorGridLines Color="LightGray" Width="1"></MajorGridLines>
                        <MinorGridLines Color="LightGray" Width="1"></MinorGridLines>
                        <TitleAppearance>
                        </TitleAppearance>
                    </YAxis>
                </PlotArea>
                <Legend>
                    <Appearance Visible="false" />
                </Legend>
            </telerik:RadHtmlChart> 

<script type="text/javascript" language="javascript">
        function OnClientSeriesClicked(sender, args) {
            debugger;
            var s = args.get_seriesName() + ',' + args.get_category();
            //var s = args.get_category() + ',' + args.get_seriesName();
            $find("<%= RadAjaxManager.ClientID %>").ajaxRequest(s);
        }







Stamo Gochev
Telerik team
 answered on 25 Jul 2014
1 answer
312 views
Hello,

I am working on session handling for my project.

I have a parent aspx page which holds RadGrid. On RadGrid row click, new RadWindow opens new aspx page using javascript function - 

            function RowDblClick(sender, eventArgs) {
                var wnd = window.radopen("url");
                wnd.setSize(960, 700);
                wnd.Center();
            }

To get server know that session has expired, meta information header is used in each Page_Load event which refreshes page after 1 second of session timeout - 
         
                 Response.AddHeader("Refresh",Convert.ToString((Session.Timeout * 60) + 1));

After refresh if there is new session, then page is redirected to Login page.

This woks fine until there is timeout when RadWindow is open on parent page. If Radwindow is open, after refresh due to session timeout it just close down itself and browser displays parent aspx page with RadGrid.
 
The problem is how and where server can know that RadWindow is closed (which event) and as RadWindow is closed server do not have any handle to it so how can parent aspx page redirected to login page. In short, how server can first close RadWindow on parent aspx page and then redirect parent aspx page to login page.

Thanks! 

Princy
Top achievements
Rank 2
 answered on 25 Jul 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?