Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
109 views
Hello,

my Version:
Telerik ASP.NET AJAX v.2010.1.415.35

so i haven´t a property named EnableMarkMatches like in this demo
http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/keyboardsupport/defaultcs.aspx

so i can´t build the higlighting with "starts with" method.

also the property header/footertemplate is missed.

what is wrong?
Yana
Telerik team
 answered on 10 Aug 2010
1 answer
145 views
Hi,

I have 2 panels in an aspx page.
Panel1 - has 1 radiobuttonlist with Yes and No as options
Panel 2 - has 2 textboxes.

I want when Yes from radiobuttonlist is selected - the panel 2 to be displayed and the same to be hdden with No is selected.

The following the code i am using in aspx page:

<telerik:RadAjaxManager ID="RadAjaxManager2" runat="server">
    <AjaxSettings>     
      </telerik:AjaxSetting>
      <telerik:AjaxSetting AjaxControlID="pnlRadioButtons">
        <UpdatedControls>
          <telerik:AjaxUpdatedControl ControlID="pnlRadioButtons" />
        </UpdatedControls>
      </telerik:AjaxSetting>
      <telerik:AjaxSetting AjaxControlID="pnlMiddleData">
        <UpdatedControls>
          <telerik:AjaxUpdatedControl ControlID="pnlMiddleData" />
        </UpdatedControls>
      </telerik:AjaxSetting>
    </AjaxSettings>
  </telerik:RadAjaxManager>


The following is the C# code:

protected void RadBtnSystemUser_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (RadBtnSystemUser.SelectedValue.ToString() == "1")
        {
            pnlMiddleData.Visible = true;
            reqFldUserId.Enabled = true;
        }
        else
        {
            pnlMiddleData.Visible = false;
            reqFldUserId.Enabled = false;
        }
    }

This throws an error saying that since are in 2 seperate update panels an error occured.

Is this possible?
Please help.

--
Regards,
Debashis
Maria Ilieva
Telerik team
 answered on 10 Aug 2010
1 answer
165 views
Hi,

I want to change or modify the default CSS - WebBllue for Radgrid. Can I know how to achieve the same?

Thanks
-Phani
Princy
Top achievements
Rank 2
 answered on 10 Aug 2010
2 answers
152 views
I've been trying to have my sliding zone load with the Tab hidden.  This is proving difficult.  I have tried putting javascript in the page to run when the page is rendered.  That throws an error though, even when I put the script at the end of the page it runs before the controls are rendered on the page and throws a script error.  This also happens when I register client script block at the end of the pageload server side.

The one thing that come the closest to working is calling the javascript in the OnClientLoad event of the RadSplitter.  However, this throws a javascript error which I will note below.  Everything works, everything, but I cannot have a javascript error on my page for the end user.

The Error is 'Object doesn't support this property or method.'

The debugger shows the error at this code in the page:
getHandler:function(b){var a=this._getEvent(b);if(!a||a.length===0)return null;a=Array.clone(a);return function(c,d){for(var b=0,e=a.length;b<e;b++)a[b](c,d)}}

the highlighted error is at the end on

a

 

[b](c,d)

Clearly this is not being thrown in the javascript I am using.  Here is the code I am using.

 

<telerik:RadSplitter 
   ID="RadSplitter2" 
   runat="server" 
   Height="82px" 
   Width="100%"
   Orientation="Horizontal"
   VisibleDuringInit="false" 
   Skin="EPSS" 
   EnableEmbeddedSkins="false" 
   OnClientLoad="javascript:TogglePaneTabVisibility('<%=SlidingPane.ClientID %>')"
>

function TogglePaneTabVisibility(panelid)
      {
            var slidingZone = $find("<%=szCR.ClientID %>"); 
            var pane = slidingZone.getPaneById("<%=SlidingPane.ClientID %>"); 
              
          if (pane.isTabDisplayed())
           {
                pane.hideTab();
            }
            else
            {
                pane.showTab();
           }
      }


Any help is greatly appreciated.

Adam Heeg
Top achievements
Rank 1
 answered on 10 Aug 2010
1 answer
127 views
This is very weird.  I've got a RadTextBox that I am loading with text for client-side editing, then submitting the edited text to a database with a Callback.  This works exactly once.

After the first Callback, when I use the exact same javascript function call to re-load the RadTextBox with text to edit, no text appears.  However, there's no javascript error either.  And the rendered HTML in the browser that defines the RadTextBox is exactly the same both before and after the Callback.

When I click submit to do a second Callback, whatever I have typed into the RadTextBox is ignored, and the value passed to the Callback is whatever was typed in the RadTextBox the first time around.  It is as if, upon Callback, a new RadTextBox is being displayed which is visible to the browser, but not to the DOM.  And meanwhile the old RadTextBox is still visible to the DOM, but invisible to the browser.

What the heck is going on?

Thanks,

Jesse
Maria Ilieva
Telerik team
 answered on 10 Aug 2010
1 answer
105 views
Hi

I have problem in radeditor content background, the Editor is taking background color as my webpage background color. For this how can i solve please find attached file and let me know

Aspx Code:

<telerik:RadEditor ID="RadEditor1" ImageManager-EnableImageEditor="false" BackColor ="White" runat="server" EnableEmbeddedSkins="true" Width="97%"  AllowScripts="true" ContentFilters="none">
            <Content></content>
</telerik:RadEditor>   


Thanks
Rajiv
Princy
Top achievements
Rank 2
 answered on 10 Aug 2010
3 answers
161 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
163 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
221 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
95 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?