Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
154 views
Hello team,

    How to set pageview to a tab using client method? 
    I added a tab and a pageview with client method, but when I click this new tab, the new pageview can not be shown.I think it's because of that I didn't set the pageview to tab, but I don't know how to achieve it with client side method, it seems server side has a method ,but client side not.

Below is the function which I use:

             var tabStrip =  $find("<%= RadTabStrip1.ClientID %>");
             var tab = new Telerik.Web.UI.RadTab();
             tab.set_text("New Tab");
             tabStrip.trackChanges();
             tabStrip.get_tabs().add(tab);             
             tabStrip.commitChanges();
             
             var multiPage = $find("<%=RadMultiPage1.ClientID %>");            
             multiPage.trackChanges();
             var pageView = new Telerik.Web.UI.RadPageView();

             multiPage.get_pageViews().add(pageView);
             pageView.get_element().innerHTML = "<iframe src='http://www.google.com' width='100%' height='600px'>";
             multiPage.commitChanges();

thanks

Yana
Telerik team
 answered on 10 Aug 2010
1 answer
154 views
Hi,

I have a page with several UserControls on it. Each Control Contains Dropdownlists and Textboxes.
When a user enters the page all Controls on it are disabled and the user has to press a button to switch all controls in edit mode.
To achieve this, every Usercontrol has an Enable method which is called in the edit button click method.

With RadAjaxManager I found no way to implement this. I can enable Controls that are placed directly on the page, but how can I enable the Usercontrols? The enable method is called but the Controls are not rendered because I cannot add a usercontrol to the RadAjaxManager. Is there a way to solve my problem?

Thanks in advance.
Peter
Maria Ilieva
Telerik team
 answered on 10 Aug 2010
1 answer
212 views

Hello,

I am using RadControls for ASP.NET AJAX 2009.1.527.20 and I have a RadGrid that requires some custom filtering.

For the first custom filter, I want a RadComboBox to drop down with a CheckBoxList.  Each item in the CheckBoxList contains a CheckBox, an Image, and a Description.  Then below that I would like "OK" and "Cancel" buttons.  OK would apply the filter, and Cancel would just close the RadComboBox dropdown and not affect the RadGrid.

For the next custom filter, I have 5 columns of integers.  I want one RadComboBox to drop down with a CheckBoxList.  Each item in the CheckBoxList contains a CheckBox and a Description.  Then below that I would like "OK" and "Cancel" buttons.  OK would apply the filter, and Cancel would just close the RadComboBox dropdown and not affect the RadGrid.

I have (sort of) been able to create the <FilterTemplate> for each of these, but I do not know how to do a few things:

  1. How do I add the "OK" and "Cancel" buttons to the template?

  2. How do I apply the results of the CheckBoxes in the CheckBoxList to the RadGrid filter functionality?

 

I have provided a sample VS 2010 web application that demonstrates what I have and want.  In this sample, I am using an XmlDataSource so I can provide sample data.  In my real application, I am binding the RadGrid using the OnNeedDataSource event.

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RadGridSample.Default" %>
  
<%@ Register Namespace="Telerik.Web.UI" TagPrefix="telerik" Assembly="Telerik.Web.UI" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  
<head id="Head1" runat="server">
  <title>RadGrid Sample - Custom Filtering</title>
</head>
<body>
  <form id="form1" runat="server">
  <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
  
  <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <style type="text/css">
      html
      {
          overflow: hidden;
      }
      html,
      body,
      form
      {
          margin: 0;
          height: 100%;
      }
      .GridWrapper
      {
        height: 100%;
        width: 100%;
      }
      body
      {
        background-color: #F5DEB3;
        color: #660000;
        font-family: Tahoma, Verdana, Arial, Sans-Serif;
        font-size: 8pt;
      }
      .combo-item-template input,
      .combo-item-template label
      {
        vertical-align:middle;
      }
      .combo-item-template img
      {
        vertical-align:top;
      }
      .rcbSlide,
      .RadComboBoxDropDown_Default
      {
        width: 300px !important;
      }
      .StatusGreen
      {
        background: url('../images/1_green_light.gif') no-repeat center;
      }
      .StatusYellow
      {
        background: url('../images/2_yellow_light.gif') no-repeat center;
      }
      .StatusRed
      {
        background: url('../images/3_red_light.gif') no-repeat center;
      }
      .StatusWarning
      {
        background: url('../images/4_warning_light.gif') no-repeat center;
      }
      .StatusPending
      {
        background: url('../images/5_pending_light.gif') no-repeat center;
      }
    </style>
  </telerik:RadCodeBlock>
  
  <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
      OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <AjaxSettings>
      <telerik:AjaxSetting AjaxControlID="RadGrid1">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
        </UpdatedControls>
      </telerik:AjaxSetting>
    </AjaxSettings>
  </telerik:RadAjaxManager>
  
  <div class="GridWrapper">
  
    <!-- Grid start -->
    <telerik:RadGrid runat="server"
      ID="RadGrid1"
      AllowFilteringByColumn="true"
      AllowPaging="True"
      AllowSorting="True"
      AutoGenerateColumns="False"
      DataSourceID="XmlDataSource1"
      Height="300px"
      OnItemCommand="RadGrid1_ItemCommand"
      OnItemDataBound="RadGrid1_ItemDataBound"
      OnPreRender="RadGrid1_PreRender"
      PageSize="10"
      Width="800px"
      >
  
      <ClientSettings EnableRowHoverStyle="true">
        <Resizing AllowColumnResize="true"
                  ClipCellContentOnResize="true"
                  EnableRealTimeResize="true" />
        <Selecting AllowRowSelect="true" />
        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
      </ClientSettings>
  
      <MasterTableView AllowPaging="true" TableLayout="Fixed">
        <Columns>
          <telerik:GridBoundColumn
            DataField="Status"
            AllowFiltering="true"
            AllowSorting="true"
            FilterControlWidth="42px"
            HeaderText="Status"
            SortExpression="Status"
            UniqueName="Status"
            >
            <HeaderStyle HorizontalAlign="Center" Width="56px" />
            <ItemStyle HorizontalAlign="Center" />
  
            <FilterTemplate>
              <telerik:RadComboBox runat="server"
                ID="RadComboBox1"
                HighlightTemplatedItems="true"
                Width="42"
                >
                <Items>
                  <telerik:RadComboBoxItem Text="" Count="1"
                     Info="All needed updates installed"
                     Image="../images/1_green_light.gif" />
                  <telerik:RadComboBoxItem Text="" Count="2"
                     Info="Some updates pending or unknown"
                     Image="../images/2_yellow_light.gif" />
                  <telerik:RadComboBoxItem Text="" Count="3"
                     Info="Some updates failed"
                     Image="../images/3_red_light.gif" />
                  <telerik:RadComboBoxItem Text="" Count="4"
                     Info="Deregistered or timed out"
                     Image="../images/4_warning_light.gif" />
                  <telerik:RadComboBoxItem Text="" Count="5"
                     Info="Waiting for rollup information"
                     Image="../images/5_pending_light.gif" />
                </Items>
                <ItemTemplate>
                  <div onclick="StopPropagation(event)"
                       class="combo-item-template">
                    <asp:CheckBox runat="server" ID="chk1" Checked="true"
                         onclick="onCheckBoxClick_Status(this)"/>
                    <asp:Label runat="server" ID="Label1"
                         AssociatedControlID="chk1">
                      <span class="NoWrap">
                        <img id="img<%# DataBinder.Eval(Container, "Attributes['Count']") %>"
                            src="<%# DataBinder.Eval(Container, "Attributes['Image']") %>"
                            alt="<%# DataBinder.Eval(Container, "Attributes['Info']") %>" />
                        <%# DataBinder.Eval(Container, "Attributes['Info']")%></span></asp:Label>
                  </div>
                </ItemTemplate>
              </telerik:RadComboBox>
              <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                <script type="text/javascript" language="javascript">
                  function onCheckBoxClick_Status(chk)
                  {
                    var combo = $find('<%# ((GridItem)Container).FindControl("RadComboBox1").ClientID %>');
                    var text  = "";
                    var values = "";
  
                    // Get the collection of all items.
                    var items = combo.get_items();
  
                    // Enumerate all items.
                    for (var i = 0; i < items.get_count(); i++)
                    {
                      // Get the checkbox element of the current item.
                      var chk1 = $get(combo.get_id() + "_i" + i + "_chk1");
                      if (chk1.checked)
                      {
                        var item = items.getItem(i);
                        var info = item.get_attributes().getAttribute("Count");
                        text += info + ",";
                      }
                    }
  
                    // Remove the last comma from the string.
                    text = removeLastComma(text);
                    //alert("text: " + text);
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Status," + text );
                  }
  
                  // This method removes the ending comma from a string.
                  function removeLastComma(str)
                  {
                    str = str.substr(0, str.length - 1);
                    return str;
                  }
  
                  function StopPropagation(e)
                  {
                    // Cancel bubbling.
                    e.cancelBubble = true;
                    if (e.stopPropagation)
                    {
                      e.stopPropagation();
                    }
                    //alert("Stop Propagation done.");
                  }
                </script>
              </telerik:RadScriptBlock>
            </FilterTemplate>
  
          </telerik:GridBoundColumn>
  
          <telerik:GridBoundColumn
            DataField="DNSName"
            AllowFiltering="true"
            FilterControlWidth="150px"
            HeaderText="Computer Name"
            Resizable="true"
            SortExpression="DNSName"
            UniqueName="DNSName"
            >
            <HeaderStyle Width="190px" />
          </telerik:GridBoundColumn>
  
          <telerik:GridBoundColumn
            DataField="CountInstalled"
            AllowFiltering="true"
            FilterControlWidth="34px"
            HeaderText="Installed"
            SortExpression="CountInstalled"
            UniqueName="CountInstalled"
            >
            <HeaderStyle HorizontalAlign="Center" Width="66px" />
            <ItemStyle HorizontalAlign="Center" />
  
            <FilterTemplate>
              <telerik:RadComboBox runat="server"
                ID="RadComboBox2"
                HighlightTemplatedItems="true"
                Width="60"
                >
                <Items>
                  <telerik:RadComboBoxItem Text="" Value="Installed" />
                  <telerik:RadComboBoxItem Text="" Value="Needed" />
                  <telerik:RadComboBoxItem Text="" Value="Not Needed" />
                  <telerik:RadComboBoxItem Text="" Value="Failed" />
                  <telerik:RadComboBoxItem Text="" Value="Unknown" />
                </Items>
                <ItemTemplate>
                  <div onclick="StopPropagation(event)"
                       class="combo-item-template">
                    <asp:CheckBox runat="server" ID="chk2" Checked="true"
                       onclick="onCheckBoxClick_Counts(this)"/>
                    <asp:Label runat="server" ID="Label2"
                        AssociatedControlID="chk2">
                      <span class="NoWrap">
                        <%# DataBinder.Eval(Container, "Value")%>
                      </span>
                    </asp:Label>
                  </div>
                </ItemTemplate>
              </telerik:RadComboBox>
            </FilterTemplate>
  
          </telerik:GridBoundColumn>
  
          <telerik:GridBoundColumn
            DataField="CountNeeded"
            AllowFiltering="false"
            FilterControlWidth="34px"
            HeaderText="Needed"
            SortExpression="CountNeeded"
            UniqueName="CountNeeded"
            >
            <HeaderStyle HorizontalAlign="Center" Width="63px" />
            <ItemStyle HorizontalAlign="Center" />
          </telerik:GridBoundColumn>
  
          <telerik:GridBoundColumn
            DataField="CountNotNeeded"
            AllowFiltering="false"
            FilterControlWidth="34px"
            HeaderText="Not Needed"
            SortExpression="CountNotNeeded"
            UniqueName="CountNotNeeded"
            >
            <HeaderStyle HorizontalAlign="Center" Width="70px" />
            <ItemStyle HorizontalAlign="Center" />
          </telerik:GridBoundColumn>
  
          <telerik:GridBoundColumn
            DataField="CountFailed"
            AllowFiltering="false"
            FilterControlWidth="34px"
            HeaderText="Failed"
            SortExpression="CountFailed"
            UniqueName="CountFailed"
            >
            <HeaderStyle HorizontalAlign="Center" Width="56px" />
            <ItemStyle HorizontalAlign="Center" />
          </telerik:GridBoundColumn>
  
          <telerik:GridBoundColumn
            DataField="CountUnknown"
            AllowFiltering="false"
            FilterControlWidth="34"
            HeaderText="Unknown"
            SortExpression="CountUnknown"
            UniqueName="CountUnknown"
            >
            <HeaderStyle HorizontalAlign="Center" Width="72px" />
            <ItemStyle HorizontalAlign="Center" />
          </telerik:GridBoundColumn>
  
          <telerik:GridBoundColumn
            DataField="ResponsiblePerson"
            AllowFiltering="true"
            AutoPostBackOnFilter="true"
            FilterControlWidth="50px"
            FilterDelay="1000"
            HeaderText="PID"
            SortExpression="ResponsiblePerson"
            UniqueName="ResponsiblePerson"
            >
            <HeaderStyle Width="70px" />
          </telerik:GridBoundColumn>
  
          <telerik:GridBoundColumn
            DataField="SUSClientId"
            UniqueName="SUSClientId"
            Visible="false"
            />
        </Columns>
      </MasterTableView>
  
      <PagerStyle Mode="NextPrevAndNumeric" />
    </telerik:RadGrid>
  </div>
    
  <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/RadGrid_SampleData.xml">
  </asp:XmlDataSource>
  
  </form>
</body>
</html>

Default.aspx.cx

using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
using Telerik.Web.UI;
  
namespace RadGridSample
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
  
  
        #region .  RadAjaxManager1_AjaxRequest()  .
        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            string strArgument = e.Argument.ToString();
            string[] astrValues = strArgument.Split(',');
            string[] astrImages = new string[5] { "green", "yellow", "red", "warning", "pending" };
  
            if (astrValues[0] == "Status")
            {
                StringBuilder sbWhere = new StringBuilder();
                for (int i = 1; i < astrValues.Length; i++)
                {
                    sbWhere.Append(String.Format("(Status = \"{0}_{1}_light.gif\") OR ",
                                                    astrValues[i],
                                                    astrImages[i]));
                }
                // Remove trailing " OR ".
                sbWhere.Length -= 4;
  
                string strWhere = sbWhere.ToString();
                string strFilter = RadGrid1.MasterTableView.FilterExpression;
  
                RadGrid1.MasterTableView.FilterExpression = strWhere;
                RadGrid1.Rebind();
            }
  
        }   // RadAjaxManager1_AjaxRequest()
        #endregion
  
  
        #region .  RadGrid1_ItemCommand()  .
        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.FilterCommandName)
            {
                Pair oFilterPair = (Pair)e.CommandArgument;
                string strFirst = oFilterPair.First.ToString();
                string strSecond = oFilterPair.Second.ToString();
  
                TextBox txtFilterBox = (e.Item as GridFilteringItem)[strSecond].Controls[0] as TextBox;
  
                string strFilterBoxText = txtFilterBox.Text;
  
                string strCurrentFilterExpression = String.Format("Current Filter Expressioin:  [{0}] {1} {2}",
                                                                    strSecond,
                                                                    strFirst,
                                                                    strFilterBoxText);
            }
  
        }   // RadGrid1_ItemCommand()
        #endregion
  
  
        #region .  RadGrid1_ItemDataBound()  .
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            try
            {
                if (e.Item is GridPagerItem)
                {
                    // Get the number of rows returned in the data set.
                    int intCountComputers = (e.Item as GridPagerItem).Paging.DataSourceCount;
                }
                else if (e.Item is GridDataItem)
                {
                    GridDataItem oItem = (GridDataItem)e.Item;
  
                    // Setup the stoplight graphic and tooltip.
                    string strCssClass = "";
                    string strStatus = oItem["Status"].Text;
                    string strToolTip = "";
  
                    switch (strStatus.Substring(0, 1))
                    {
                        case "1":   // Green
                            strCssClass = "StatusGreen";
                            strToolTip = "All needed updates installed";
                            break;
                        case "2":   // Yellow
                            strCssClass = "StatusYellow";
                            strToolTip = "Some updates pending install or unknown";
                            break;
                        case "3":   // Red
                            strCssClass = "StatusRed";
                            strToolTip = "Some updates failed";
                            break;
                        case "4":   // Yellow Exclamation Mark
                            strCssClass = "StatusWarning";
                            strToolTip = "Deregistered or timed out";
                            break;
                        case "5":   // Purple
                            strCssClass = "StatusPending";
                            strToolTip = "Waiting for rollup information";
                            break;
                    }
                    oItem["Status"].CssClass = strCssClass;
                    oItem["Status"].ToolTip = strToolTip;
                    oItem["Status"].Text = strStatus.Substring(0, 1);
  
                    // Create the link for the DNS Name column to open the computer
                    // info in a popup window.
                    oItem["DNSName"].Text =
                        String.Format("<a href=\"JavaScript: ShowComputer('{0}','{1}')\">{2}</a>",
                                        oItem["SUSClientId"].Text,
                                        "1",
                                        oItem["DNSName"].Text);
  
                    // Get the update counts.
                    int intInstalled = Convert.ToInt32(oItem["CountInstalled"].Text);
                    int intNeeded = Convert.ToInt32(oItem["CountNeeded"].Text);
                    int intNotNeeded = Convert.ToInt32(oItem["CountNotNeeded"].Text);
                    int intFailed = Convert.ToInt32(oItem["CountFailed"].Text);
                    int intUnknown = Convert.ToInt32(oItem["CountUnknown"].Text);
  
  
                    // Check status:  Active, Inactive, Deregistered.
                    string strActive = oItem["IsActive"].Text;
                    switch (strActive)
                    {
                        case "":
                        case "1":
                            oItem["IsActive"].Text = (strActive == "" ? "(Active)" : "Active");
  
                            // Set the font color for the days ago field.
                            string strColorDaysAgo = "";
                            string strDaysAgo = oItem["DaysAgo"].Text;
                            if (strDaysAgo.StartsWith("Not"))
                            {
                                strColorDaysAgo = " ColorRed";
                                oItem["DaysAgo"].CssClass = strColorDaysAgo;
                            }
                            else if (strDaysAgo.IndexOf(" ") != -1)
                            {
                                int intDaysAgo = int.Parse(strDaysAgo.Substring(0, strDaysAgo.IndexOf(" ")));
                                if ((intDaysAgo > 1) && (intDaysAgo < 8))
                                    strColorDaysAgo = " ColorYellow";
                                else if (intDaysAgo > 8)
                                    strColorDaysAgo = " ColorRed";
                                oItem["DaysAgo"].CssClass = strColorDaysAgo;
                            }
  
                            // Set the font colors for the update counts fields.
                            if (intInstalled != 0) oItem["CountInstalled"].CssClass += " ColorGreen";
                            if (intNeeded != 0) oItem["CountNeeded"].CssClass += " ColorYellow";
                            if (intNotNeeded != 0) oItem["CountNotNeeded"].CssClass += " ColorYellow";
                            if (intFailed != 0) oItem["CountFailed"].CssClass += " ColorRed";
                            if (intUnknown != 0) oItem["CountUnknown"].CssClass += " ColorYellow";
                            break;
  
                        case "0":
                            oItem["DNSName"].CssClass = "GrayLink";
                            oItem["IsActive"].Text = "Deregistered";
                            oItem.Font.Italic = true;
                            oItem.ForeColor = Color.FromArgb(255, 140, 140, 140);
                            break;
  
                        case "-1":
                            oItem["DNSName"].CssClass = "GrayLink";
                            oItem["IsActive"].Text = "Timed Out";
                            oItem.Font.Italic = true;
                            oItem.ForeColor = Color.FromArgb(255, 140, 140, 140);
                            break;
                    }
  
  
                }
            }
            catch (Exception ex)
            {
            }
  
        }   //RadGrid1_ItemDataBound()
        #endregion
  
  
        #region .  RadGrid1_PreRender()  .
        protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            if (ViewState["filterRawString"] != null)
            {
                foreach (GridFilteringItem item in RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem))
                {
                    RadComboBox combo = (RadComboBox)item.FindControl("RadComboBox1");
                    foreach (RadComboBoxItem comboItem in combo.Items)
                    {
                        if (ViewState["filterRawString"].ToString().Contains(comboItem.Text.ToString()))
                        {
                            CheckBox chk = (CheckBox)comboItem.FindControl("chk1");
                            chk.Checked = true;
                        }
                        else
                        {
                            CheckBox chk = (CheckBox)comboItem.FindControl("chk1");
                            chk.Checked = false;
                        }
                    }
                }
            }
  
        }   // RadGrid1_PreRender()
        #endregion
  
    }
}

Can you provide a sample of how to make this work?

Thanks,

Randall Price
Senior Programmer Analyst
Virginia Tech
1700 Pratt Drive
Blacksburg, VA  24061

 

Daniel
Telerik team
 answered on 10 Aug 2010
1 answer
94 views
Hi

i am new to telerik controls but enjoying working on these controls.

during the development i stuck at a point, where i need to set default dropdown values in edit form. Here is the sample code
<label for='<%= PriorityDropDown.ClientID %>'>
    Priority:</label><%--
        Leaving a newline here will affect the layout, so we use a comment instead.
                            --%>
    <telerik:RadComboBox runat="server" ID="PriorityDropDown" Skin='<%# Owner.Skin %>' Width="100px" AutoPostBack="true">
            <Items>
                    <telerik:RadComboBoxItem Text="Low" Value="Low" Selected='<%# Convert.ToBoolean((Convert.ToString(Eval("Priority")) == "Low")) %> ' />
                    <telerik:RadComboBoxItem Text="Medium" Value="Medium" Selected='<%# Convert.ToBoolean((Convert.ToString(Eval("Priority")) == "Medium")) %> ' />
                    <telerik:RadComboBoxItem Text="High" Value="High" Selected='<%# Convert.ToBoolean((Convert.ToString(Eval("Priority")) == "High")) %> ' />
            </Items>
    </telerik:RadComboBox>

I have added Priority attribute in custom names collection like : CustomAttributeNames="Priority"
Whenever i write 
<%(Convert.ToString(Eval("Priority")) == "Low") %>

it gives me "True" string but when i convert it to Boolean value It always give me false. please help me to sort out this problem.

Regards
Manmeet Singh
Peter
Telerik team
 answered on 10 Aug 2010
1 answer
202 views
I am using RadMenuItem Control on my Login Page as a Login Button. When i click on this Login Button the OnItemClick event is called. Now the requirement is that when i hit the Enter Key from wherewere in the Page the OnItemClick event should get called.

Please help me in accompolishing this.
Peter
Telerik team
 answered on 10 Aug 2010
2 answers
202 views
Hello,

I have a panel bar on my page setup similiar to that of Outlook 2007+ on the left hand side and everything seems to work perfectly with expanding and collapsing.  However, the problem I seem to have revolves around text placed inside a template item.  For some reason the test for the <h5> tag is much different from an <h5> outside of the panel bar where it appears both font and size differ.  I do have a rad form decorator applying the same style to h4h5h6.  I do not have any font modification in my CSS, the only font modifications comes from the built in telerik skins applied.  Also, it appears that the text and margins definitions within a template item are double spaced.  So a 10px margin becomes 20 while text is also double spaced.

Any ideas why everything is much different inside the panel bar versus outside of it even though I am applying the same skin both in and out and not defining any additional cutomizations anywhere.

Attached is a screenshot of the difference between the left side with the panel bar and the right side without.

Thanks,
Ron Montecalvo
Kamen Bundev
Telerik team
 answered on 10 Aug 2010
5 answers
202 views
I need to update the value in a row and column of a Label in radgrid with a value I have from Javascript.
The value is a return arrg from a popup radwindow.

Is it possible and if so how please.

Thx
Neal
Neal
Top achievements
Rank 1
 answered on 10 Aug 2010
2 answers
336 views
Hi

I've tried several options to retrieve a label and or textboxes via javascript on my grid in the OnClientClose (which retrieves values I want to insert into a (checkbox) selected row.

I get as far as getting into the "iterating thru the dataitems " ,(loops thru 16 rows correctly)  
BUT,  getting the column or/and the labels by their unique id is a problem.
I am using Telerik RaControls v2009.2

The column markup is

<telerik:GridTemplateColumn   UniqueName ="ORateCBX" > 
    <ItemTemplate> 
        <asp:CheckBox            ID="cbxORate" 
                runat="server"  Width="100%" height = "18px"   AutoPostBack="true" 
                OnCheckedChanged="cbxORate_CheckedChanged"/> 
        <asp:Label                   id="lblORate_Id" " 
                runat="server    Visible="false" Width="5px" height = "18px"></asp:Label> 
        <asp:TextBox                id="txtORate" 
                runat="server"   Visible="false" Width="5px" height = "18px"></asp:TextBox> 
        <asp:TextBox                id="txtReason"
                runat="server"  Visible="false" Width="5px" height = "18px"></asp:TextBox>
   </ItemTemplate>
</telerik:GridTemplateColumn>

The javascript (in onClientClose)

 

var arg = args.get_argument();

if (arg)

{

  var RatePerc = arg.RatePerc;

  var seldate = arg.Reason;

  var masterTableView;

  var length;

  var grid = $find("<%

= grvCoverelements.ClientID %>");

 

  if (grid)

  {

    masterTableView = grid.get_masterTableView();

  }

  if (masterTableView)

  {

    var firstDataItems = masterTableView.get_dataItems();

    if (firstDataItems)

    {

       length = firstDataItems.length;

       // alert("length = " + length);

    }

    for (var i = 0; i < length; i++)

    {

       alert(i ); //Successful

       var dataItem = firstDataItems[i].get_element("ORateCBX");

      if (dataItem)

      {

         //unsuccessful condition everytime...i.e. not getting the GridTemplateColumn UniqueName ="ORateCBX"

         alert("dataItem is " + dataItem);

         // 1. Is it the correct row (the one the user clicked on to insert (via popup) the new values from args.

 

        if (checkBox && checkBox.checked )

       {

            // 1. Get the rate textbox

            var txtRate = dataItem.findElement("txtORate");

            //2. Is it the correct row and checkbox

             if ( txtRate.value =" " )

           {

               //3. Insert the new value from Arg.RatePerc

                txtRate.value = Arg.RatePerc;

               //4 Insert the new value from Arg.Reason

                var txtReason = dataItem.findElement("txtReason");

                txtReason.value = Arg.Reason;

            }

        }

    }

}

__doPostBack(

"NewOrate", arg);

}

 

In other words it never finds the Column (GridTemplate col with the unique name of "ORateCBX" ???

I have tried this approach as well, but it does not even iterate thru the grids rows!

// for (var i=0; i < masterTableView.Rows.length; i++)

// {

    // alert("looping" ); //...............//NOT successful

    // var cell = masterTableView.GetCellByColumnUniqueName(masterTableView.Rows[i] , "ORateCBX");

    // if (cell) {alert("Cell")};

        // var dataItem = dataitems[i].findElement("txtORate")[0];

        // if (checkBox && checkBox.checked)

        // {

             // Find the textboxes   "txtRate and TxtReason and populate them from args

       /// }

// }


Thanks
Neal
Neal
Top achievements
Rank 1
 answered on 10 Aug 2010
2 answers
73 views
After sorting on any of the columns, the data is disappers from page 2 onwards. Verified and found that needDataSource is firing on page index change and also when sorting. The grid properties are listed below. Any help is much appreciated.
<telerik:RadGrid ID="rdCodes" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                                                Width="990px" Skin="new" EnableEmbeddedSkins="False" AllowPaging="True"
                                                GridLines="None" PagerStyle-AlwaysVisible="true"
                                                SelectedItemStyle-BackColor="AppWorkspace" OnItemDataBound="rdReconCodes_ItemDataBound"
                                                OnPreRender="rdReconCodes_PreRender" OnPdfExporting="rdReconCodes_PdfExporting"
                                                OnNeedDataSource="rdReconCodes_NeedDataSource"
                                                OnPageIndexChanged="rdReconCodes_PageIndexChanged" OnPageSizeChanged="rdReconCodes_PageSizeChanged"
                                                OnInsertCommand="rdReconCodes_InsertCommand" OnUpdateCommand="rdReconCodes_UpdateCommand"
                                                OnExcelMLExportStylesCreated="rdReconCodes_ExcelMLExportStylesCreated">
Prasanth
Top achievements
Rank 1
 answered on 10 Aug 2010
2 answers
161 views
Hi,

I have a RadGrid similar to the example (http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectedvalue/defaultcs.aspx) it has EnablePostBackOnRowClick="true" and this works fine. However my problem is when you introduce a ClientSelectColumn which then triggers a postback on every selection, I don't want it to. I want to keep my action on row click yet i also want a user to be able to select multiple rows with ease without the interuption of a postback. I have looked to try to find something i can use to determine what was clicked but the ItemCommand "RowClick" doesn't provide much and looking through client side is taking a while, any suggestions?

Shane
Shane Leipper
Top achievements
Rank 1
 answered on 10 Aug 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?