Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
75 views
Is there a way to know which records are returned after applying a filter? I need to gather all values of the key field when the records in the grid changes.

I have tried collecting the key value of each record in ItemDataBound event but that only returned records in one page. When there are more than one page, records in subsequent pages cannot be accessed through ItemDataBound.
Shinu
Top achievements
Rank 2
 answered on 17 Sep 2011
1 answer
118 views
I would like to change the sort behavior of the columns in my RadGrid.  Currently, when you click on a column, it sorts ascending.  I agree this is probably by design, but of course my client wants the column sorting descending when you first click the column.  Is this something that can easily be done?  A grid property??

Thanks in advance.
Shinu
Top achievements
Rank 2
 answered on 17 Sep 2011
7 answers
181 views
hi all,
  I am using RadAlert for sisplaying messages to users. Project is multilingual and i can show localised message in the radalert byt passing localised message as parameters to the function. But any possibility to show the buttons like 'OK', 'CANCEL', YES' etc in localized language?

I read some article specifying 'language' property in the RAdWindowManager but i didnt found in my control. I am using Q3 2010. any possibility in Q1 2011? because i am going to use this latest version for next project
Akhil Raj
Top achievements
Rank 1
 answered on 17 Sep 2011
0 answers
102 views
I would like to implement a column chooser for the RADTreeList as the standard control does not have this functionality. Just wondered if anyone else has already done this and what method/control they have used. I had thought of using the RADWindow as this seemed to be a simple popup window which I could display when invoked (maybe from a context menu).

Unfortunately it seems that the RADWindow is not quite what I thought - I really wanted a simple popup container window.  Thanks for any other suggestions?
Chris
Top achievements
Rank 1
 asked on 16 Sep 2011
2 answers
99 views
Hi,

I already read this : 
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=grid

Basically i want to do the same thing, maybe you can point me to an example.

What i want to do is : 
I have a RadGrid that has 3 RadComboBox (in edit and insert mode).

For each radcombobox i want to have a hyperlink "Add new Item" that basically opens a new RadWindow (with a user controls inside), and when the user insert the new item, the radcombobox will be automatically updated, sorted and the new value selected without refreshing the page.

If anyone can hook me up with how to do this or any example ?

Thanks in advance
Al
Top achievements
Rank 1
 answered on 16 Sep 2011
4 answers
137 views
Hello,

Not all the skins have this error but I have noticed Outlook and WebBlue do. I'm not sure how to explain it which is why I have attached a screen shot. I am using Telerik version: 2010.1.519.35 and I have seen this in IE 7-9 as well as Safari 5.0.3 and Firefox 5.
Here is the code:

<telerik:RadMenu ID="RadMenu1" Skin="WebBlue" OnClientItemClicking="myClickFunction" runat="server" Flow="Horizontal">
    <ExpandAnimation Type="InOutQuad" />
</telerik:RadMenu>
Ramjet
Top achievements
Rank 1
 answered on 16 Sep 2011
4 answers
664 views
I have a RADGrid that requires that it's columns get removed and replaced per the context under which the data is being loaded. When the grid first loads, the Grouping operation runs fine. However, when the context changes and the Grid structure is reinitialized, when I try to group by any column I get the GridGroupByException: Expression cannot be null or empty error.

I start out with a Radgrid without column definitions. When the page loads, I invoke a procedure that first clears the Grids grouping, context menu, data binding and column settings then it runs an initialization routine to configure the grid for the data that will be loaded.

Here's the code for the ClearGridSettings method that's run first:

Private Sub ClearGridSettings()
       '   -   Clear Grouping/Sort Levels
       '   -   Clear Context Menus
       '   -   Clear Data Bindings
       '   -   Clear Columns
       With grdSubmission
           'Clear Grouping/Sort Levels
           .MasterTableView.GroupByExpressions.Clear()
           .MasterTableView.SortExpressions.Clear()
           'Clear Context Menus
           .ClientSettings.ClientEvents.OnRowContextMenu = ""
           'Clear Data Bindings
           .DataSource = ""
           .DataBind()
           'Clear Columns
           .Columns.Clear()
       End With
   End Sub

Here's the code for the first Intialization:
Private Sub InitializeSubmissionGrid(ByVal GridViewSchema As Int16)
    '##########################################
    'Initialize Data Grid for Submission Claims Review
    '   -   Reset Grid
    '   -   Get GridView Schema for Submissions Claim Listing
    '   -   Implement Column Structure
    '   -   Set Miscellaneous Parameters
    '###########################################
 
    ClearGridSettings()
 
    'Get Grid View Schema for Submissions View
    Dim objDW As New DWGlobals
    Dim ds As DataSet = objDW.GetGridViewSchema(GridViewSchema)
 
    With grdSubmission
        'Add Columns to Grid
        For Each objRow As DataRow In ds.Tables(0).Rows
            Dim objCol As New GridBoundColumn()
            .MasterTableView.Columns.Add(objCol)
            objCol.DataField = objRow("ColName")
            objCol.HeaderText = objRow("ColName")
            If Not IsDBNull(objRow("FormatString")) Then
                objCol.DataFormatString = objRow("FormatString")
            End If
            objCol = Nothing
        Next
 
        ' Set Miscellaneous parameters
        .ClientSettings.Resizing.AllowResizeToFit = True
        .ClientSettings.Resizing.AllowColumnResize = True
        .ClientSettings.Scrolling.AllowScroll = True
        .ClientSettings.Scrolling.UseStaticHeaders = True
        .AutoGenerateColumns = False
        .MasterTableView.GroupsDefaultExpanded = False
        .MasterTableView.GridLines = GridLines.Both
        .MasterTableView.AllowFilteringByColumn = False
        .MasterTableView.Caption = txtSubmLabel.Text & "...(Claim Qty: " & txtClaimQty.Text & " )"
    End With
 
End Sub

Here's the initialization code for the context change that's causing the error:



Private Sub InitializeFindingsGrid(ByVal GridViewSchema As Int16)
       '##########################################
       'Initialize Data Grid for Validation Findings Review
       '   -   Reset Grid
       '   -   Get GridView Schema for Validation Findings Listing
       '   -   Implement Column Structure
       '   -   Set Miscellaneous Parameters
       '###########################################
 
       ClearGridSettings()
 
       'Get Grid View Schema for Submissions View
       Dim objDW As New DWGlobals
       Dim ds As DataSet = objDW.GetGridViewSchema(GridViewSchema)
       objDW = Nothing
 
       Dim exp As New GridGroupByExpression()
       Dim gbf As New GridGroupByField()
 
       With grdSubmission
           'Add Columns to Grid
           For Each objRow As DataRow In ds.Tables(0).Rows
               Dim objCol As New GridBoundColumn()
               objCol.DataField = objRow("ColName")
               objCol.HeaderText = objRow("ColName")
               objCol.UniqueName = objRow("ColName")
               If Not IsDBNull(objRow("FormatString")) Then
                   objCol.DataFormatString = objRow("FormatString")
               End If
               objCol.GroupByExpression = objRow("ColName")
 
               'Add GroupByField to GroupByExpression
               'gbf = New GridGroupByField
               'With gbf
               '    .FieldName = objRow("ColName")
               '    .HeaderText = objRow("ColName")
               '    .HeaderValueSeparator = " HeaderValSep "
               '    .Aggregate = GridAggregateFunction.Count
               'End With
               'exp.SelectFields.Add(gbf)
               .MasterTableView.Columns.Add(objCol)
               objCol = Nothing
           Next
 
           'Add GroupByExpression object to table
           ' .MasterTableView.GroupByExpressions.Add(exp)
 
           ' Set Miscellaneous parameters
           .ClientSettings.Resizing.AllowResizeToFit = True
           .ClientSettings.Resizing.AllowColumnResize = True
           .ClientSettings.Scrolling.AllowScroll = True
           .ClientSettings.Scrolling.UseStaticHeaders = True
           .AutoGenerateColumns = False
           .MasterTableView.GroupsDefaultExpanded = False
           .MasterTableView.GridLines = GridLines.Both
           .MasterTableView.AllowFilteringByColumn = False
           .MasterTableView.Caption = "Findings For " & txtSubmLabel.Text & _
                                      "...( " & txtFindingType.Text & ")"
           'Enable Grid Options for Findings Review
           .AllowMultiRowSelection = True
           .ClientSettings.Selecting.AllowRowSelect = True
           .ClientSettings.Selecting.EnableDragToSelectRows = True
           .ClientSettings.ClientEvents.OnRowContextMenu = "RowContextMenu"
 
       End With
 
       exp = Nothing
       gbf = Nothing
 
   End Sub

As you can see by the commented out section I tried to explicitly set GridGroupByFields but that didn't work either. I also tried setting the GroupByExpression on a column by column basis with the same result.

What am I missing?
Michael Bierch
Top achievements
Rank 1
 answered on 16 Sep 2011
2 answers
183 views
Hi Every one,

this is what I am doing on client side

<telerik:RadCodeBlock runat="server">
        <script type="text/javascript">
            function OnClientSelectedIndexChanged_Country(sender, eventArgs) {
                var item = eventArgs.get_item();
                var inputElement = document.getElementById("<%= rpbMainInfo.FindItemByValue("CandidateInformation").FindControl("rtxtState").ClientID %>"); 
                 
                var Combo = document.getElementById("<%= rpbMainInfo.FindItemByValue("CandidateInformation").FindControl("rcbState").ClientID %>");
                if (item.get_selectedItem() == "United States") {
                    Combo.set_visible = true;
                    inputElement.set_visible = false;
                }
                else {
                    Combo.set_visible = false;
                    inputElement.set_visible = true;
                }
            }        
        </script>
    </telerik:RadCodeBlock>


<telerik:RadComboBox ID="rcbCountry" runat="server" DataSourceID="sdsCountries" DataTextField="COUNTRY"
                                                        DataValueField="COUNTRYCODE" Skin="Outlook" EmptyMessage="Please Select.."
                                                         OnClientSelectedIndexChanged="OnClientSelectedIndexChanged_Country">
                                                    </telerik:RadComboBox>


What I am trying to do is when the user selects the country as Unitedstates the combo box for states should be visible and when Country other than United states then the states would be a text box.I am able to do this on server side .But I am not able to get on client side .....

CAn we do it on client side or only sever side.




Can Any one help me with this please.


Thanks,
Sravanthi
sravanthi
Top achievements
Rank 1
 answered on 16 Sep 2011
3 answers
173 views
I've got a self-referencing hierarchical grid that displays the information as desired.  When the user clicks a row, s/he can then either view the row's details, reply to the thread or delete the thread.

The problem I'm having is capturing the Id of the selected row.  The Id is stored in the first column of the grid, which also contains the [+] button code (visible or not, depending on whether there's a child row).  For other columns, the following to retrieve the cell's contents as desired:

                        var rgGrid = $find("<%= grdNotes.ClientID %>");
                        var MasterTable = rgGrid.get_masterTableView();
                        var selectedRows = MasterTable.get_selectedItems();
                        for (var i = 0; i < selectedRows.length; i++)
                        {
                            var row = selectedRows[i];
                            var cell = MasterTable.getCellByColumnUniqueName(row, uniqueColName)
                            parentId = cell.innerHTML;
                        }                       

However, when the uniqueColName is the "Id" column, I also get back the HTML that creates the [+] button (when all I want is 21):

<input type="submit" name="ctl00$DetailBodyPlaceHolder$ucNotesGrid$grdNotes$ctl00$ctl10$MyExpandCollapseButton" value="" id="ctl00_DetailBodyPlaceHolder_ucNotesGrid_grdNotes_ctl00_ctl10_MyExpandCollapseButton" class="rgExpand" style="visibility:hidden;" />&nbsp;21

I've tried moving the button to its own column, but have been unsuccessful.

How can I read the Id value w/o getting the [+] code back as well?  Is there another property that will just return the value (e.g., 21)?

Also, how can I make the detail row line up with the parent row vs. being indented?
D
Top achievements
Rank 1
 answered on 16 Sep 2011
2 answers
166 views
Hi, I have this Radcombo with checkbox itemtemplate,  without any update panel it works perfectly as I wanted.
But if I add the update pannels in it won't load anymore unless user type in something on the radcombox box
Is there anyway to work around this. I need it to load without have to wait for user to type in a search string
and I also need the loadondemand because it is a huge amount of data to load to the radcombo
Thanks,
Quynh
Default.aspx
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="RadCombo._Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <style type="text/css">
        table
        {
            border-collapse: collapse;
        }
        table tr, td
        {
            padding: 3px;
        }
    </style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <asp:ObjectDataSource ID="PatientDS" runat="server" SelectMethod="GetPatient" 
        TypeName="RadCombo.DB"  >
                                <SelectParameters>
                                    <asp:ControlParameter Name="Study" ControlID="ddlStudy" Type="String" DefaultValue="%" />
                                    <asp:ControlParameter Name="Site" ControlID="ddlSite" Type="String" DefaultValue="%" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
      
    <div>
          
          
        <table>
            <tr>
                <td>
                    Study
                </td>
                <td>
                    <asp:DropDownList ID="ddlStudy" runat="server" Width="500px" AutoPostBack="true"
                        OnSelectedIndexChanged="ddlStudy_SelectedIndexChanged">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    Site
                </td>
                <td>
                    <asp:UpdatePanel ID="updatePanel1" runat="server">
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ddlStudy" EventName="SelectedIndexChanged" />
                        </Triggers>
                        <ContentTemplate>
                            <asp:DropDownList ID="ddlSite" runat="server" Width="500px" AutoPostBack="true"
                                >
                            </asp:DropDownList>
                              
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
            <tr>
                <td style="height: 130px;" valign="top">
                    Patient<br />
                    <asp:CheckBox ID="cbPatientAll" runat="server" Text="Check All" />
                </td>
                <td valign="top">
                    <asp:UpdatePanel ID="updatePanel2" runat="server">
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ddlStudy" EventName="SelectedIndexChanged" />
                            <asp:AsyncPostBackTrigger ControlID="ddlSite" EventName="SelectedIndexChanged" />
                        </Triggers>
                        <ContentTemplate>
                            <telerik:RadComboBox ID="cblPatient" runat="server" Skin="Office2007" DataSourceID="PatientDS"
                                EmptyMessage="All Patients" DataTextField="TEXT" DataValueField="VALUE" ShowMoreResultsBox="true"
                                ItemsPerRequest="250" LoadingMessage="Retrieving Patients" EnableAutomaticLoadOnDemand="true"
                                Filter="Contains" MaxHeight="100px" Height="100px" AllowCustomText="false" OnItemDataBound="CB1_ItemDataBound"
                                HighlightTemplatedItems="False" Width="300px" OpenDropDownOnLoad="true" OnClientDropDownClosing="onDropDownClosing"
                                OnDataBound="CB1_DataBound">
                                <ItemTemplate>
                                    <div onclick="StopPropagation(event)">
                                        <asp:CheckBox runat="server" ID="chk1" />
                                        <asp:Label runat="server" ID="label1" AssociatedControlID="chk1"><%# DataBinder.Eval(Container, "Text") %></asp:Label>
                                    </div>
                                </ItemTemplate>
                                <CollapseAnimation Duration="200" Type="OutQuint" />
                                  
                            </telerik:RadComboBox>
                              
                            <asp:HiddenField ID="HV1" runat="server" />
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
        </table>
    </div>
    <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript">
        // NOTE - these two functions can be moved to the page
        function StopPropagation(e) {
            //cancel bubbling 
            e.cancelBubble = true;
            if (e.stopPropagation) {
                e.stopPropagation();
            }
        }
  
        function onDropDownClosing(sender, eventArgs) {
            eventArgs.set_cancel(true);
        }
        function allchecked(box) {
            var combo = $find(box);
            var items = combo.get_items();
            for (var i = 0; i < items.get_count(); i++) {
                var item = items.getItem(i);
                var chk1 = $get(combo.get_id() + '_i' + i + '_chk1');
                if (!chk1.checked) return false;
            }
            return true;
        }
        function onCheckBoxClick(me) {
            var cb = $("#<%=cbPatientAll.ClientID%>");
            cb.attr('checked', allchecked('<%=cblPatient.ClientID%>'));
  
            var chk1 = $get(me.id);
            var i = me.id.replace("<%=cblPatient.ClientID%>", "").replace("_chk1", "").replace("_i", "");
            //alert(i);
            var combo = $find('<%=cblPatient.ClientID%>');
            var items = combo.get_items();
            var item = items.getItem(i);
            var keepValue = $("#<%=HV1.ClientID %>").val();
            if (chk1.checked) {
                keepValue += item.get_value() + ',';
  
            }
            else {
                keepValue = keepValue.replace(item.get_value() + ',', '');
            }
            $("#<%=HV1.ClientID %>").val(keepValue);
        }
        $(document).ready(function () {
            $("#<%= cbPatientAll.ClientID %>").click(function (event) {
                var keepValue = "";
                var combo = $find('<%=cblPatient.ClientID%>');
                var items = combo.get_items();
                for (var i = 0; i < items.get_count(); i++) {
                    var item = items.getItem(i);
                    var chk1 = $get(combo.get_id() + '_i' + i + '_chk1');
                    chk1.checked = $('#' + this.id).is(':checked');
                    if ($('#' + this.id).is(':checked')) {
                        keepValue += item.get_value() + ',';
                    }
                }
                $("#<%=HV1.ClientID %>").val(keepValue);
  
            });
  
        });
        function pageLoad(sender, args) {
            $("#<%= ddlSite.ClientID %>").change(function () {
                //var combo = $find('<%=cblPatient.ClientID%>');
                //combo.clearItems();
                //combo.requestItems(' ', false);
  
            });
  
        }
          
  
  
    </script>
</asp:Content>
  
Default.aspx.cs
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace RadCombo
{
    public partial class _Default : System.Web.UI.Page
    {
        private string Delimiter = ",";
        private DB myDBProc = new DB(); //DBProcessing Class Library
         
        protected void Page_Load(object sender, EventArgs e)
        {
  
            if (!this.IsPostBack)
            {
  
                myDBProc.GetStudy(ddlStudy);
            }
  
  
        }
        protected void CB1_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
        {
            (e.Item.FindControl("chk1") as CheckBox).Attributes["onclick"] = "onCheckBoxClick(this)";
            if (HV1.Value.Contains(e.Item.Value)) (e.Item.FindControl("chk1") as CheckBox).Checked = true;
        }
        protected void CB1_DataBound(object sender, EventArgs e)
        {
            HV1.Value = "";
            StringBuilder sbValues = new StringBuilder();
            foreach (Telerik.Web.UI.RadComboBoxItem rcbItem in cblPatient.Items)
            {
                //If the box is checked return a value
                CheckBox cb = (CheckBox)rcbItem.FindControl("chk1");
                if (null != cb && cb.Checked)
                {
                    sbValues.Append(rcbItem.Value);
                    sbValues.Append(Delimiter);
                }
            }
  
            HV1.Value = sbValues.ToString();
  
        }
  
        protected void btnExecute_Click(object sender, EventArgs e)
        {
            string test = HV1.Value;
        }
        protected void ddlStudy_SelectedIndexChanged(object sender, EventArgs e)
        {
            myDBProc.GetSite(ddlSite, ddlStudy.SelectedValue);
        }
    }
}
  
DB.cs
sing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.UI.WebControls;
namespace RadCombo
{
    public class DB
    {
        public void GetStudy( DropDownList list)
        {
  
            DataTable dt = new DataTable();
            dt.Columns.Add( new DataColumn("VALUE", typeof(int)));
            dt.Columns.Add(new DataColumn("TEXT", typeof(string)));
            DataRow dr = dt.NewRow();
            dr["Value"] = 1;
            dr["TEXT"] = "One";
            dt.Rows.Add(dr);
            list.DataValueField = dt.Columns["VALUE"].ColumnName;
            list.DataTextField = dt.Columns["TEXT"].ColumnName;
            list.DataSource = dt;
            list.DataBind();
            list.Items.Insert(0, new ListItem("Select a Study", ""));
        }
        public void GetSite( DropDownList list, string Study)
        {
              
            if (string.IsNullOrEmpty(Study) || Study == "%")
            {
                list.Items.Clear();
                return;
            }
  
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("VALUE", typeof(int)));
            dt.Columns.Add(new DataColumn("TEXT", typeof(string)));
            DataRow dr = dt.NewRow();
            dr["Value"] = 11;
            dr["TEXT"] = "Eleven";
            dt.Rows.Add(dr);
            list.DataValueField = dt.Columns["VALUE"].ColumnName;
            list.DataTextField = dt.Columns["TEXT"].ColumnName;
            list.DataSource = dt;
            list.DataBind();
            list.Items.Insert(0, new ListItem("All Sites", "%"));
            list.Items.Insert(0, new ListItem("Select a Site", ""));
        }
        public DataTable GetPatient(string Study, string Site)
        {
  
            if (string.IsNullOrEmpty(Study) || Study == "%" || string.IsNullOrEmpty(Site))
            {
  
                 
                return new DataTable();
            }
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("VALUE", typeof(int)));
            dt.Columns.Add(new DataColumn("TEXT", typeof(string)));
            DataRow dr = dt.NewRow();
            dr["Value"] = 100;
            dr["TEXT"] = "One Hundred";
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["Value"] = 101;
            dr["TEXT"] = "One Hundred And One";
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["Value"] = 102;
            dr["TEXT"] = "One Hundred And Two";
            dt.Rows.Add(dr);
  
             
            return dt;
        }
    }
      
  
}
Quynh
Top achievements
Rank 1
 answered on 16 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?