Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
246 views
Hi,
         Please could you provide me with a way of expanding the rad dock with a double click. It is an urgent need in my project.

Thank you

Regards,
Ajit
ajit
Top achievements
Rank 1
 answered on 31 Jul 2009
3 answers
130 views
We have a user control that allows us to enable/disable the filtering display on a grid via Javascript. The control looks like this:

<table cellpadding="2" cellspacing="2" border="0"> 
    <tr> 
        <td width="1"><asp:Image runat="server" ImageUrl="~/_assets/images/Filter.gif" /></td> 
        <td>Show Filtering Options: </td> 
        <td> 
            <input type="radio" name="<%=this.Grid.ClientID%>ButtonGroup" onclick="showFilterItem('<%=this.Grid.ClientID%>')" /> 
            <label for="<%=this.Grid.ClientID%>ButtonGroup">Yes</label> 
            <input type="radio" name="<%=this.Grid.ClientID%>ButtonGroup" checked="true" onclick="hideFilterItem('<%=this.Grid.ClientID%>')"/> 
            <label for="<%=this.Grid.ClientID%>ButtonGroup">No</label> 
        </td> 
    </tr> 
</table> 

The code-behind looks like this:

        protected void Page_Load(object sender, EventArgs e) 
        { 
            InitControl(); 
        } 
 
        protected void InitControl() 
        { 
            if (!Page.ClientScript.IsClientScriptBlockRegistered("CodeScript")) 
            { 
                string java = @"function showFilterItem(GridName) {
                        var c = document.getElementsByName(GridName + 'ButtonGroup');
                        c.item(0).checked = true;
                        $find(GridName).get_masterTableView().showFilterItem();}
        
                    function hideFilterItem(GridName) {
                        var c = document.getElementsByName(GridName + 'ButtonGroup');
                        c.item(1).checked = true;
                        $find(GridName).get_masterTableView().hideFilterItem();}
                    function GridCreated(sender, eventArgs) { 
                        hideFilterItem(sender.get_id());}"; 
 
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "CodeScript", java, true); 
                Grid.ClientSettings.ClientEvents.OnGridCreated = "GridCreated"; 
            } 
 
            //Grid.ClientSettings.ClientEvents.OnDataBound = "hideFilterItem('" + RadGridClientId + "')"; 
        } 
 
        public string RadGridId { get; set; } 
 
        RadGrid _Grid; 
        protected RadGrid Grid 
        { 
            get 
            { 
                if (_Grid == null) 
                { 
                    //_Grid = (RadGrid)((Novelis.MetalProcurement.Web.site)Page.Master).FindControl(this.Parent, RadGridId); 
                    _Grid = this.Parent.FindControlRecursive(this.RadGridId) as RadGrid; 
                    _Grid.ItemCreated += new GridItemEventHandler(_Grid_ItemCreated); 
                } 
                return _Grid; 
            } 
        } 
 
        void _Grid_ItemCreated(object sender, GridItemEventArgs e) 
        { 
            if (!IsPostBack && e.Item is GridFilteringItem) 
            { 
                //Grid.ClientSettings.ClientEvents.OnGridCreated = "hideFilterItem('" + RadGridClientId + "')"; 
                //e.Item.Style["display"] = "none"; 
            } 
        } 
 
        public string RadGridClientId 
        { 
            get { return Grid.ClientID; } 
        } 
 
        public string RadioGroupName 
        { 
            get { return RadGridClientId + "ButtonGroup"; } 
        } 
 

Everything works great on a "normal" grid on a page and it even works great when you have X grids inside X tabs that are all using this control. The issue I'm running into is when I have a grid inside a RadPanelBarItem like so:

                <telerik:RadPanelBar runat="server" ID="RadPanelBar1" Width="575px" ExpandMode="SingleExpandedItem"> 
                    <Items>                         
                        <telerik:RadPanelItem runat="server" Text="Step 1: Select Product" Value="ProductSelector" Expanded="true" Selected="true"> 
                            <Items> 
                                <telerik:RadPanelItem runat="server"> 
                                    <ItemTemplate> 
                                        <uc:rgfilman ID="ucFilMan" runat="server" RadGridId="rgProducts" /> 
                                        <telerik:RadGrid ID="rgProducts" SkinID="Selector" Width="575px" runat="server" OnNeedDataSource="rgProducts_NeedDataSource" OnSortCommand="rgProducts_SortCommand" AllowSorting="true" SortingSettings-SortedBackColor="Transparent" AllowFilteringByColumn="true" OnDataBound="rgProducts_DataBound"> 
                                            <MasterTableView AutoGenerateColumns="false" DataKeyNames="Id" AllowMultiColumnSorting="true" AllowNaturalSort="true" ItemStyle-Wrap="false"> 
                                                <Columns> 
                                                    <telerik:GridBoundColumn DataField="Id" UniqueName="Id" Visible="false"/> 
                                                    <telerik:GridBoundColumn HeaderText="Description" DataField="Name" UniqueName="Product" />                                                     
                                                </Columns>                                                   
                                            </MasterTableView> 
                                            <ClientSettings EnableRowHoverStyle="true" Selecting-AllowRowSelect="true"> 
                                                <ClientEvents OnRowDblClick="__rowSelected" /> 
                                            </ClientSettings> 
                                        </telerik:RadGrid> 
                                    </ItemTemplate> 
                                </telerik:RadPanelItem> 
                            </Items> 
                        </telerik:RadPanelItem> 
                    </Items> 
                </telerik:RadPanelBar> 
 

The control is in there (it's the one called "uc:rgfilman") but it won't enable/disable the filtering on the client when the individual radio buttons are selected. The really frustrating part is there are zero javascript errors when I select the yes/no options. Since there aren't any errors I'm not really certain where I can start to look as to why this isn't functioning.
Scott Salyer
Top achievements
Rank 1
 answered on 31 Jul 2009
1 answer
100 views
hello

i use radgid for organizing my dvd collection. i order them according genre with some infos bout total dvds of this section.
i can break down the parentitem and will see all the dvds belonging to this genre.
through some circumstances i have to bind the datasource from my c# code. i also have to run it every time i change the page. think that is cuz it's all on one page... anyway... for the first page of the grid it's working properly but as soon as i change to page 2 or even further the childgrid shows an empty entry although there should be several entrys.

my code:  (OnPageIndexChanged & OnPageSizeChanged)
  void bindDataSource(object sender, EventArgs e)
  {
      radgridDVD.DataSource = from genres in GenreCollection
                                                select genre;
      radgridDVD.MasterTableView.DetailTables[0].DataSource = DVDCollection;
      rgResultDepositSearch.DataBind();
  }

i ran the application in debug mode and it seams like it goes back to 'select genre' after the childDataSource was bound and the childDataSource gets lost.

and also the pagecount for the detailtable somehow shows the count of the mastertable.

thanks for your help!
beat
Sebastian
Telerik team
 answered on 31 Jul 2009
5 answers
838 views
I created a page and added some user controls using RAD ajax panel. When i click on a button in the user control, the control sends an AJAX request and reloads the control as per the logic. 
But the problem is that every time I do an ajax postback page load event for all the controls gets fired. 
Is there a way to avoid it?
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
 answered on 31 Jul 2009
4 answers
202 views
Hi,

I have dragged a search control on my web pages. I have a label inside the search text box, same as on this website (Search Site). I want to know, how I can get the text/label disappear, when someone clicks on the text box to enter value, and get it back when clicked outside the search box?
Can you please explain me in detail?

Thank you very much,
Jay Mehta.
Jay Mehta
Top achievements
Rank 1
 answered on 31 Jul 2009
6 answers
89 views
I am new to the telerik controls. I have looked at a bunch of examples but I cannot seem to get my panel bar to work. It just expands everything for both items and won't collapse. I'm sure it's something simple I just don't know what. Here is my aspx page.
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="ClickableCommunity.master.vb"
    Inherits="ClickableCommunity.ClickableCommunity" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager2" runat="server">
    </telerik:RadScriptManager>
    <div>
        <telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Web20" ExpandMode="SingleExpandedItem">
            <Items>
                <telerik:RadPanelItem Text="test 1" Expanded="True">
                    <ItemTemplate>
                        test<br />
                        test<br />
                    </ItemTemplate>
                </telerik:RadPanelItem>
            </Items>
            <Items>
                <telerik:RadPanelItem Text="Test 2">
                    <ItemTemplate>
                        test<br />
                        test<br />
                    </ItemTemplate>
                </telerik:RadPanelItem>
            </Items>
            <ExpandAnimation Type="InBounce" />
            <CollapseAnimation Type="InExpo" />
        </telerik:RadPanelBar>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

Web Services
Top achievements
Rank 2
 answered on 31 Jul 2009
2 answers
276 views
How to use 

 

foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items)

{


}

to get bound data value.  if I have 2 columns of bound items, one it regular bound item - item1, the other is build in drop down item -item2(NOT template item). I need to get grid cell value in view mode, NOT edit mode.

or there are some other ways to loop the whole grid to get the bound data value?

Thanks,
Jessie

 

Jessie
Top achievements
Rank 1
 answered on 31 Jul 2009
1 answer
248 views
I need a grid that will display formatted text and hyperlinks. There are no issues getting the grid to populate on the server, but I'm having an issue getting client side databinding to work properly. There doesn't seem to be any problem with using a GridBoundColumn, that one gets updated as expected, but other column types I've tried (GridTemplateColumn and GridHyperLinkColumn) don't produce any results.

Here is the script that takes a json array of objects and updates the grid.
The json is something like [{JobCode:"Code1",JobDesc:"Desc1",Primary:1},{JobCode:"Code2",JobDesc:"Desc2",Primary:0}]
<script> 
        function updateGrid(strJSON) { 
            var tableView = $find("grid1").get_masterTableView(); 
            // create the data source 
            var jsonObj = eval("(" + strJSON + ")"); 
            tableView.set_dataSource(jsonObj.RowData); 
            tableView.dataBind(); 
            tableView.get_owner().repaint(); 
        } 
</script> 


Here is the grid template.
                    <telerik:RadGrid ID="grid1" CssClass="grid" Skin="Office2007"  
                        AutoGenerateColumns="False" runat="server">  
                        <MasterTableView CellSpacing="-1">  
                            <NoRecordsTemplate>  
                                <div>  
                                    There are no records to display</div>  
                            </NoRecordsTemplate>  
                            <Columns>  
                                <telerik:GridBoundColumn DataField="JobCode" HeaderText="Job Code">  
                                </telerik:GridBoundColumn>  
                                <telerik:GridBoundColumn DataField="JobDesc" HeaderText="Job Desc">  
                                </telerik:GridBoundColumn>  
                                <telerik:GridTemplateColumn UniqueName="Primary" HeaderText="Primary">  
                                    <ItemTemplate>  
                                        <%#(DataBinder.Eval(Container.DataItem,"Primary").ToString()=="1")?"Y":"N"%>  
                                    </ItemTemplate>  
                                </telerik:GridTemplateColumn>  
                            </Columns>  
                            <AlternatingItemStyle CssClass="altRow" />  
                            <ItemStyle CssClass="row"></ItemStyle>  
                        </MasterTableView>  
                    </telerik:RadGrid>  

This all works well unless I use a column other than the GridBoundColumn.

I've looked in the RadGridScripts.js file to try and figure this thing out.
For the GridTemplateColumn, it tries to fill in the grid using the _fillTemplateEditorsData function. This function is expecting to find some control or element in which to put the contents of the data. There are two searches performed:
var _301 = $telerik.findControl((cell != null) ? cell: row, _300);
and
var _304 = $telerik.findElement((cell != null) ? cell: row, _300);

In both cases, they return nothing, so the function just returns without having updated the cell contents with text.

I would really like to be able to control the grid on the client pc. Can somebody let me know what, if anything, I'm doing wrong and how I can manipulate the grid on the client using columns other than the GridBoundColumn.

I should mention that I'm using  version 2009.1.311.35

Thank you





Sebastian
Telerik team
 answered on 31 Jul 2009
2 answers
226 views
I have been developing a control, using Radgrid, which will get its list of columns and mappings from a database. We had previously done this using the Radgrid control, wrapped in a composite control, but there were several complications, the work arounds for which turned the control into a rather daunting piece of code. We also had many difficulties in getting the filtering to work properly with the dynamic databinding and the dynamic fields. The result of all this was a difficult to maintain code base, with no ability to do filtering (weren't using Linq at that time).

Since then, I have rewritten the control, removing much of the logic which was extraneous to the function of the grid, and made it to use databinding through Linq to an IEnumerable object. I had alot of success inheriting from Radgrid (which I know you don't officially support) and have followed the recommendations I could find as best I could. There's really only one issue now that I am having difficulty getting past, and I'm not really sure where to look.

When there is a postback from either the built in Radgrid sort or Paging, the very first record in the result gets duplicated when it is rendered. The dataset it is bound to has 100 records, yet it renders 101 records, with two occurances of the first record on the first page. If I do a postback using either of the other controls built in (like a custom checkbox column), then the first record is not duplicated. The same is true on consecutive searches, no duplicate record.

I was wondering if you had a hint as to where I can look to see the process of binding the datasource to the grid, or perhaps you have an idea as to what is differrent on a sort or paging event, as opposed to a CheckChanged event. The only thing I can see is that I am calling the Rebind method on the CheckChanged event (which is bubbled to the enclosing user control) and for the Radgrid Paging and Sorting postbacks it is calling CreateTableView and NeedDataSource. On CreateTableView, I am building a GridTableView object based on the configured columns in the database and returning this, and on the NeedDataSource I am pulling the datasource from the session (and have verified this contains only 100 records).

Any ideas would be appreciated.
Thanks,
Tyson Brown
Rosen
Telerik team
 answered on 31 Jul 2009
1 answer
85 views
I have a license for Telerik Asp.net Ajax UI controls. And when I downloaded the Telerik controls, I cannot see the folder for skins on my hard drive. I want to customize the skins for the Radgrid. Where can I get the .css files for the built-in  skins for radgrid controls.
Thanks
Anil Makhija  
Sebastian
Telerik team
 answered on 31 Jul 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?