Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
194 views
Hi,

I need to be able to show / hide (toggle) all columns in a grid view where the columns name begins with (A).  I've search and found this script:

function HideColumn(index)
           {
               var columnCount = RadGrid1.get_masterTableView().get_columns().length - 1;
               if (index < 0 || index > columnCount)
               {
                   alert("Invalid index! The valid range is: " + 0 + "-" + columnCount);
               }
               else
               {
                   RadGrid1.get_masterTableView().hideColumn(index);
               }
           }


Does anybody have any suggestions how it could be tailored to accomplish my goals?
Angel Petrov
Telerik team
 answered on 23 Sep 2014
4 answers
90 views
Hello!

I have a user control that searches recursively for an radajaxmanger in its page hierarchy. Then the control adds its components that should be ajaxified like that:

ajaxManager.AjaxSettings.AddAjaxSetting(btnEditValues, gridPanel, radLoadingPanel);

the page hierarchy looks like that

Page (with the Ajax Manager)
-Control
--gridPanel
---btnEditValues

Now every control in the gridPanel makes an ajaxpostback as well.
When I try to exclude the control from the AjaxRequest with a javascript (OnRequestStart for example) the Clientside event "OnRequestStart" is not even called. But still an ajax postback is made.

I successfully excluded other controls from the postback, like "btnEditValues".

Is it possible that control that are the updated ones a somehow implicitly the updating ones as well ??

I'm really stuck here...

thx in advance for your help,

kind regards,
 M
Steven
Top achievements
Rank 1
 answered on 23 Sep 2014
0 answers
80 views
I am trying to write a javascript code.  This is code I have right now.

<script type='text/javascript'>
function onCheckBoxClickctl00_Content_ddc1_CB1(){
var combo=$find('ctl00_Content_ddc1_CB1');
 var CountChecked=0;
var text='This is the text message';
var max ='4';
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){
CountChecked ++;
if(max < CountChecked) {
chk1.checked = false;
}
text+=item.get_text()+',';
 if(CountChecked > 3)
{ text = 'You have ' + CountChecked  + ' items selected :';}
}
}
 text=removeLastDelimiter(text);
if(text.length>0){combo.set_text(text);}else{combo.set_text('');}}
</script>

if(text.length>0){combo.set_text(text);}else{combo.set_text('');}}

I would like to write the text in the first line of the drop down.  Something like items._array[0].set_text(text).  But when I did this I get an error.  Can you please tell me how to do this.

Thank you
Kalyani
Top achievements
Rank 1
 asked on 22 Sep 2014
2 answers
121 views
Does anybody know how to hide all grid items in MastertableView and DetailTableVies after clicking on "Add new item" button?
I wont to Display only the insert form and hide all ofter GridView elements:


protected void GrdTicketsItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.InitInsertCommandName)
    {
        // show insert form works fine
        e.Item.OwnerTableView.EditFormSettings.UserControlName = "BackendControls/AddBillingAndTicket.ascx";
        e.Item.OwnerTableView.EditFormSettings.EditFormType = GridEditFormType.WebUserControl;
        e.Item.OwnerTableView.InsertItem();
 
        // How to hide all items in MasterTableView and all DetailsTables?
        // this doesn't work:
        foreach (GridDataItem item in GrdTickets.Items)
            item.Visible = false;
    }
}


Thank you for your help.
Christopher
kzimny
Top achievements
Rank 1
 answered on 22 Sep 2014
1 answer
103 views
I am working on a project that requires complex conditional validation and I want to be able to access the controls in the edit template on the server validate event. I have looked through the object model and I am not seeing anything I can use to access the page values. Any clues?

During an edit I can use the RadGrid1.EditItems but insert there are none there.
Jayesh Goyani
Top achievements
Rank 2
 answered on 22 Sep 2014
1 answer
102 views
Hi,

I have a  radgrid and the the radgrid is set to autogenerated columns =  true. Once the radcombo box is changed the grid should have null data and the columns are added based on listbox source to destination selection. Though i Make the Datasource = null i still see the column names. Do i have the ability to make the total grid empty and with no columns and rows . 

Thanks in advance,

Vamsi
Jayesh Goyani
Top achievements
Rank 2
 answered on 22 Sep 2014
1 answer
100 views
Hi,

I have a radgrid control that has 3 nested gridtableview within it. I'd like to
have button on the client side that expands a particular gridtableview when
clicked. I would expect it to expand all the gridtableview (i.e. 1 per row of
parent grid).

Any suggestions as to how I can set this up?
Pavlina
Telerik team
 answered on 22 Sep 2014
2 answers
294 views

Hi,

Plesae let us know how to achieve the following.

1. Avoid loading the user control in nested view template when outer grid/page loads.
2. Allow loading of user control ONLY for the expanded row of the outer grid.

Find below the source code to work on. Any prompt help on this is really appreciated.
Note: The source code really doesn't have any parent and child relation in the data that it displays because it just a sample.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="NVT._Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="PlayerDetails.ascx" TagName="PlayerDetails" TagPrefix="Player" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="scriptManager" runat="server"></telerik:RadScriptManager>
        <telerik:RadGrid ID="grdPlayers" runat="server" OnNeedDataSource="GetPlayers" AutoGenerateColumns="true"
         OnItemCommand="grdPlayers_ItemCommand" OnItemCreated="grdPlayers_ItemCreated" >
            <MasterTableView>
                <NestedViewTemplate>
                    <asp:Panel runat="server" ID="InnerContainer" Visible="false">
                        <Player:PlayerDetails id="ucPlayerDetails" runat="server"></Player:PlayerDetails>
                    </asp:Panel>
                </NestedViewTemplate>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data;
  
namespace NVT
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
  
        }
  
        protected void GetPlayers(object source, GridNeedDataSourceEventArgs e)
        {
            DataSet dsPlayers = new DataSet();
            DataTable tblPlayers = new DataTable();
            tblPlayers.Columns.Add("Name");
            tblPlayers.Columns.Add("Age");
  
            tblPlayers.Rows.Add("Sachin", "36");
            tblPlayers.Rows.Add("Virender", "30");
  
            dsPlayers.Tables.Add(tblPlayers);
  
            grdPlayers.DataSource = dsPlayers;
        }
  
        protected void grdPlayers_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item is GridDataItem)
            {
                ((GridDataItem)e.Item).ChildItem.FindControl("InnerContainer").Visible =
                    !e.Item.Expanded;
            }
        }
  
        protected void grdPlayers_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridNestedViewItem)
            {
                e.Item.FindControl("InnerContainer").Visible = ((GridNestedViewItem)e.Item).ParentItem.Expanded;
            }
        }
    }
}
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PlayerDetails.ascx.cs" Inherits="NVT.PlayerDetails" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
  
<telerik:RadGrid ID="grdPlayerDetails" runat="server" AutoGenerateColumns="true">
</telerik:RadGrid>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;
  
namespace NVT
{
    public partial class PlayerDetails : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            GetPlayerDetails();
            grdPlayerDetails.DataBind();
        }
  
        protected void GetPlayerDetails()
        {
            DataSet dsPlayerDetails = new DataSet();
            DataTable tblPlayerDetails = new DataTable();
            tblPlayerDetails.Columns.Add("Name");
            tblPlayerDetails.Columns.Add("Age");
  
            tblPlayerDetails.Rows.Add("Sachin", "36");
            tblPlayerDetails.Rows.Add("Virender", "30");
  
            dsPlayerDetails.Tables.Add(tblPlayerDetails);
  
            grdPlayerDetails.DataSource = dsPlayerDetails;
        }
    }
}

Thanks,
Kishore

Ángel
Top achievements
Rank 1
 answered on 22 Sep 2014
3 answers
183 views
I have a RadProgressArea on the page to track a specific operation.  I find, however, when the page is posted back for an unrelated operation that it starts polling.  How would you stop it from polling on all postbacks and focus just on the specific operation I want it to?
Hristo Valyavicharski
Telerik team
 answered on 22 Sep 2014
2 answers
103 views
For Custom filtering it is only working for "No filter" option. and for any other option e.g. "EqualTo" it is not even postbacking sometime.

I am attaching my sorted list (which is according to filter options) to grid.But it is still showing  except "No filter".i.e. all over inconsistant behaviour is there. 

I am using "ItemCommand" Event. and binding all data in "needDatasource" event.
Kostadin
Telerik team
 answered on 22 Sep 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?