Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
289 views
Hi Team,
    I am trying to add check boxes in group header dynamically,i found some code  http://www.telerik.com/community/forums/aspnet-ajax/ajax/groupging-columns-with-check-boxes.aspx in this link when i try with it i am unable to click the check boxes in header (disable mode) can you please help me.

Team, 
   Please find the attached screen shot of my requirement.high lighted area should get check boxes.

Using in aspx 

<telerik:RadGrid ID="gvSRSecurity" AutoGenerateColumns="false" runat="server" CellSpacing="0" ShowGroupPanel="true"  OnItemCreated="RadGrid1_ItemCreated"
          OnItemDataBound="RadGrid1_ItemDataBound"  AllowMultiRowSelection="True"
                            GridLines="None" Width="100%" PagerStyle-AlwaysVisible="true">
                            <ClientSettings>
                                <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
                            </ClientSettings>
                            <MasterTableView AutoGenerateColumns="False" TableLayout="fixed" DataKeyNames="ReportId"
                                GroupsDefaultExpanded="True" GroupLoadMode="Client" CommandItemDisplay="None">                              
                                <GroupByExpressions>
                                
                                    <telerik:GridGroupByExpression>
                                        <SelectFields>
                                            <telerik:GridGroupByField FieldName="DomainName" FieldAlias="Domain" FormatString=""
                                                HeaderText=" " HeaderValueSeparator=""></telerik:GridGroupByField>
                                                
                                        </SelectFields>
                                        <GroupByFields>
                                        
                                            <telerik:GridGroupByField SortOrder="Descending" FieldName="DomainName" FormatString=""
                                                HeaderText=""></telerik:GridGroupByField>
                                        </GroupByFields>
                                    </telerik:GridGroupByExpression>
                                    <telerik:GridGroupByExpression>
                                        <SelectFields>
                                            <telerik:GridGroupByField FieldName="SubjectAreaName" FieldAlias="SubjectArea" FormatString=""
                                                HeaderText=" " HeaderValueSeparator=""></telerik:GridGroupByField>
                                        </SelectFields>
                                        <GroupByFields>
                                            <telerik:GridGroupByField SortOrder="Descending" FieldName="SubjectAreaName" FormatString=""
                                                HeaderText=""></telerik:GridGroupByField>
                                        </GroupByFields>
                                    </telerik:GridGroupByExpression>
                                    <telerik:GridGroupByExpression>
                                        <SelectFields>
                                            <telerik:GridGroupByField FieldName="GroupName" FieldAlias="Group" FormatString=""
                                                HeaderText=" " HeaderValueSeparator=""></telerik:GridGroupByField>
                                        </SelectFields>
                                        <GroupByFields>
                                            <telerik:GridGroupByField SortOrder="Descending" FieldName="GroupName" FormatString=""
                                                HeaderText=""></telerik:GridGroupByField>
                                        </GroupByFields>
                                    </telerik:GridGroupByExpression>
                                   
                                </GroupByExpressions>
                                <Columns>
                              <%--   <telerik:GridCheckBoxColumn UniqueName="CheckBox1" HeaderText="CheckBox1"></telerik:GridCheckBoxColumn>
           <telerik:GridCheckBoxColumn UniqueName="CheckBox2" HeaderText="CheckBox2"></telerik:GridCheckBoxColumn>--%>
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>

in Cs file

 GridTemplateColumn tempcol = new GridTemplateColumn();
                //GridHeaderItem 
                //GridHeaderItem ghi = new GridHeaderItem();

                tempcol.ItemTemplate = new MySRCheckbox(i, true);
                tempcol.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                tempcol.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                tempcol.ItemStyle.Width = Unit.Pixel(60);
                tempcol.HeaderStyle.Width = Unit.Pixel(80);
                tempcol.HeaderText = cols[i];                
                gvSRSecurity.MasterTableView.Columns.Add(tempcol);

   --check boxes code which i found in above link
    #region add code for grouping

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {

        CreateHeaderControls(e);
    }

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridCommandItem)
        {
            CreateHeaderControls(e);
        }
    }

    void check_CheckedChanged(object sender, EventArgs e)
    {
        CheckBox check = (CheckBox)sender;
        GridGroupHeaderItem groupHeader = (GridGroupHeaderItem)check.NamingContainer;
        GridItem[] children = groupHeader.GetChildItems();
        foreach (GridItem child in children)
        {
            if (child is GridDataItem)
            {
                ((child as GridDataItem)["CheckBox1"].Controls[0] as CheckBox).Checked = (sender as CheckBox).Checked;
            }
        }
    }
    private void CreateHeaderControls(GridItemEventArgs e)
    {
        if (e.Item is GridGroupHeaderItem)
        {
            DataTable dtSRActions;
            dtSRActions = (DataTable)Session["dtSRActions"];
            List<string> cols = (from perm in dtSRActions.AsEnumerable()
                                 select perm.Field<string>("SRPermissionName").ToString()).ToList<string>();

         

            for (int i = 0; i < cols.Count; i++)
            {
                
                GridGroupHeaderItem item = e.Item as GridGroupHeaderItem;
                item.DataCell.Controls.Clear();
                DataRowView groupDataRow = (DataRowView)e.Item.DataItem;
                CheckBox check = new CheckBox();
                check.AutoPostBack = true;
              //  check.Enabled = true;
                check.ID = "CheckAll" + i;
                check.Text = ""; //cols[i];// "Check/Uncheck CheckBox1 column";
                check.CheckedChanged += new EventHandler(check_CheckedChanged);

                CheckBox check2 = new CheckBox();
                check2.AutoPostBack = true;
                check2.ID = "CheckAll_2" + i;
               // check.Enabled = false;
                check2.Text = "";// cols[i];//"Check/Uncheck CheckBox2 column";
                //check2.CheckedChanged += check2_CheckedChanged;
                check2.CheckedChanged +=new EventHandler(check2_CheckedChanged);                   
                item.DataCell.Controls.Add(check);
                item.DataCell.Controls.Add(check2);
            }            
            //Add CheckBox and event handler for every column 
        }
    }

    void check2_CheckedChanged(object sender, EventArgs e)
    {
        CheckBox check = (CheckBox)sender;
        GridGroupHeaderItem groupHeader = (GridGroupHeaderItem)check.NamingContainer;
        GridItem[] children = groupHeader.GetChildItems();
        foreach (GridItem child in children)
        {
            if (child is GridDataItem)
            {
                ((child as GridDataItem)["CheckBox2"].Controls[0] as CheckBox).Checked = (sender as CheckBox).Checked;
            }
        }
    }


    #endregion



Thank you.

Pavlina
Telerik team
 answered on 13 Jan 2014
1 answer
112 views
Hi,

I'm having four chart controls (RadHtmlChart) in a page with drill down option for each of it. I'm using onClientSeriesClicked event and thereby using the AjaxRequest event of the Ajax Manager. As I can have only one Ajax Manager in a page, all my chart controls are pointed to the same AjaxRequest event of the Ajax Manager.

Hence when I drill down on one of the charts, all the other charts are also getting refreshed and shows up empty charts. I do not want to load all the charts everytime I drill down. How can I refresh only one chart where I have drilled down and leave all others as is? Please suggest.

Regards,
Muthiah
Maria Ilieva
Telerik team
 answered on 13 Jan 2014
3 answers
135 views
Hi,

I have a RAD tree view where in i am loading only few levels of Hierarcy data. When i click on a parent node it gets the child nodes by making a call to the database. So basically Load on Demand works when i click on a parent node.

What i want to achieve is expand all parent nodes Programatically from Javascript i.e when i click expandALL it must load all parent nodes child nodes. Basically i want to trigger the onNodeExpand function (which executes on server) from javascript by looping thru all the parent nodes.


Thanks
-Sekhar
Hristo Valyavicharski
Telerik team
 answered on 13 Jan 2014
12 answers
224 views
Hi,
When I click on the Preview button and then again in the Design editor loses the cursor, I can write but can not see the cursor. I came to that as you click to a different place than the Iframe editor then it works and appears to back the cursor. I did also go to edit my own but it will not come. The error occurs in the latest Firefox, I checked the Opera is working properly. The same error is on your side in the demo.

aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!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>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadEditor ID="reEdytor" runat="server" EditModes="All"
            ContentFilters="MakeUrlsAbsolute" Width="100%" Height="93%" AutoResizeHeight="false"
            EnableResize="false" ToolsFile="~/Config/radeditor.xml">
        </telerik:RadEditor>
        <telerik:RadScriptBlock runat="server">
 
            <script type="text/javascript">
                Telerik.Web.UI.Editor.CommandList["FileEdit"] = function(commandName, editor, args) {
                    editor.set_mode(1);
                    setTimeout(function() {
                        editor.setFocus();
                    }, 10);
                }          
            </script>
 
        </telerik:RadScriptBlock>
    </div>
    </form>
</body>
</html>

Config/radeditor.xml

<root>
  <modules>
      <module name="RadEditorStatistics" dockingZone="Bottom" enabled="true" visible="true" dockable="true" />
      <module name="RadEditorDomInspector" dockingZone="Module" enabled="true" visible="true" dockable="true" />
      <module name="RadEditorNodeInspector" dockingZone="Module" enabled="true" visible="true" dockable="true" />
      <module name="RadEditorDiagnostics" dockingZone="Module" enabled="true" visible="true" dockable="true" />
      <module name="RadEditorHtmlInspector" dockingZone="Module" enabled="true" visible="false" dockable="true" />
  </modules>
    <tools enabled="true">
        <tool name="FileEdit"/>
         
    </tools>
 
    <links>
    </links>
     
    <snippets>
    </snippets>
 
    <symbols>
 
    </symbols>
    <fontNames>
    </fontNames>
    <fontSizes>
    </fontSizes>
 
    <colors>
    </colors>
    <classes>
    </classes>
 
    <paragraphs>
    </paragraphs>
 
    <dialogParameters>
    </dialogParameters>
    <languages>
    </languages>
</root>
Rakesh
Top achievements
Rank 1
 answered on 13 Jan 2014
3 answers
407 views
When a user changes the layout of the grid (e.g., by column resize or reorder), I set value that's read on page_load.  If the value is 1, I save the grid settings.  This works fine for column resize, but not for column reorder, the value doesn't get updated (it remains 0).  I have the column order client events pointing to the same event as column resize (as you can see below), but the method is never called.  (I put a breakpoint on the client function and it's only called on column resize, not reorder).

Here's the grid definition:

<telerik:RadGrid
    ID="grdHistory"
    runat="server"
    OnItemCreated="grdHistory_ItemCreated"
    OnItemDataBound="grdHistory_ItemDataBound"
    OnNeedDataSource="grdHistory_NeedDataSource"
    OnPreRender="grdHistory_PreRender"
    OnSortCommand="grdHistory_SortCommand"
    OnPageSizeChanged="grdHistory_SaveSettingsOnClose"
    AutoGenerateColumns="true"
    SkinID="worklist"
    AllowCustomPaging="true"
    AllowPaging="true"
    AllowFilteringByColumn="false"
    Width="99%" >
    <HeaderContextMenu
        OnClientItemClicking="GridHeaderContextMenuOnClientItemClicking">
    </HeaderContextMenu>
    <ClientSettings
        ColumnsReorderMethod="Reorder"
        EnablePostBackOnRowClick="false"
        ReorderColumnsOnClient="False"
        AllowColumnsReorder="True"
        AllowKeyboardNavigation="True">
        <Scrolling AllowScroll="true"
            SaveScrollPosition="true"
            UseStaticHeaders="true" />
        <Resizing ResizeGridOnColumnResize="false"
            AllowColumnResize="true"
            EnableRealTimeResize="false"
            AllowResizeToFit="true" />
        <ClientEvents
            OnColumnShown="SaveSettingsOnClose"
            OnColumnHidden="SaveSettingsOnClose"
            OnColumnResized="SaveSettingsOnClose"
            OnColumnClick="SaveSettingsOnClose"
            OnColumnSwapped="SaveSettingsOnClose"
            OnColumnMovingToLeft="SaveSettingsOnClose"
            OnColumnMovingToRight="SaveSettingsOnClose"
            OnColumnMovedToLeft="SaveSettingsOnClose"
            OnColumnMovedToRight="SaveSettingsOnClose"
            OnMasterTableViewCreated="MasterTableViewCreated"
            OnKeyPress="preventInlineEditing" />
    </ClientSettings>
    <MasterTableView
        commanditemdisplay="None"
        enablecolumnsviewstate="false"
        AllowPaging="True"
        AllowSorting="True"
        Width="100%">
        <HeaderStyle Width="200px" />
        <RowIndicatorColumn Visible="False">
        </RowIndicatorColumn>
    </MasterTableView>
</telerik:RadGrid>

And the method definition:

function SaveSettingsOnClose(sender, eventArgs) {
    triggerIsPostBack = true;
    document.getElementById('<%=hSaveSettingsOnClose.ClientID %>').value = "1";
}

Why isn't the SaveSettingsOnClose method being called when I reorder or sort the columns on the grid?

The second issue has to do with Column sort.  When I sort a column, the server OnSortCommand is called, but when I step through the code and check the grid sort expression count, it's always 0 (even though the visual state of the grid shows the proper sort method).  Here's the OnSortCommand and followon StoreSettings methods:

protected void grdHistory_SortCommand(object sender, GridSortCommandEventArgs e)
{
    StoreLastSort();
 
}


private void StoreLastSort()
{
    if (grdHistory.MasterTableView.SortExpressions.Count > 0)
    {
        //Store the column sorted on for when we reload
        foreach (GridSortExpression gse in grdHistory.MasterTableView.SortExpressions)
        {
            string direction = (gse.SortOrder == GridSortOrder.Ascending) ? "ASC" : "DESC";
            UserSettingHelper.SetUserSetting(SortSettingKey, gse.FieldName + "," + direction);
        }
    }
    else
    {
        UserSettingHelper.DeleteUserSetting(SortSettingKey);
    }
}

Why is the .SortExpressions.Count set to 0 even though the grid appears to be sorted properly when looking at it?
Konstantin Dikov
Telerik team
 answered on 13 Jan 2014
10 answers
235 views
Just want to make sure I'm not missing any options.

I have a screen with an html table and I need to put in multiple rows and columns with many radcombo boxes.  
I'm currently running Version 2012.2.607.40.  For 'political' reasons I can't upgrade at this time.

Is there any way at all to set the labels so that the labels and the dropdowns themselves all line up vertically?
(Other than blanking out the dropdown labels and using separate label controls in separate cells?)

Would upgrading to the latest Telerik control set offer any new options?
Boris
Top achievements
Rank 1
 answered on 13 Jan 2014
1 answer
154 views
Hi,

I am having the error while opening up certain pages:

"Error while executing filter ConvertFontToSpanFilter - InvalidCharacterError: The string contains invalid characters."

I know that I can disable the RadEditor filter and it works fine. But what I would like to know is do I have an option to disable showing this message instead of disabling the filter all together?


Thank you,
Ali.
Ianko
Telerik team
 answered on 13 Jan 2014
3 answers
154 views
Hello Forum,

My Name is Lukas, I am new to the Telerik Controls. First i want to say that these controls helped me a lot an you musst keep up your nice work!

So now to my Problem:

I got a Grid on my aspx.net Site filled with an EntityDataSource. The Data for this comes from an SQL-Server. On the Top of this Site there is an DropDownList filled with some example companys.

So when i change the company of the DropDownList i want to apply a Filter to the "CompanyID"-Row in the Grid-View with the Index of the selected Item in the DropDownList.

I got the Event from the DropDownList and the only thing i want to know is how i can filter the "CompanyID"-Row from the Grid to the selected Index of the DropDownList. So that the Grid only shows the data where "CompanyID" is for example 4.

Is this possibly and can you give me an example how to do that? I searched a lot in this forum but haven´t found an simple answer for this case.

Kind regards
Lukas
Lukas
Top achievements
Rank 1
 answered on 13 Jan 2014
2 answers
133 views

I would like to disable my menu item based on the Active directory login.

I am using SQL data source, My ASPX page and Menu control look like this

<telerik:RadMenu ID="RadMenu1" Runat="server" DataFieldID="ID"

    DataFieldParentID="Parent" DataNavigateUrlField="Url"

    DataSourceID="SqlDataSource1" DataTextField="Title" Skin="Glow"

         EnableRoundedCorners="true" style="z-index: 100000; left: 0px; top: 52px; position: absolute">

        <DefaultGroupSettings ExpandDirection="Down" RepeatDirection="Horizontal" />

</telerik:RadMenu>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

    ConnectionString="<%$ ConnectionStrings:PROJECT_STATUS %>"

    SelectCommand="PRS_GetWebSiteSiteMap" SelectCommandType="StoredProcedure">

</asp:SqlDataSource>

 I have another table which tell me the user login ID and pageID he has access to. So What I want based on the User login I would like to enable the menu pages.

So User Chris with domain\Chris only access to page 1,3,5. The menu control of page 1,3,5 are enabled and remaining all the of the menu control will be disabled.

I hope someone will be able to help me out

Thanks

Syed

Kate
Telerik team
 answered on 13 Jan 2014
3 answers
142 views
Hi,

I have a rad scheduler to show appointments and i have recently modified it to use web service binding. I have few client side events on it and one of it is OnClientAppointmentClick. When i click on an appointment, i want a new rad panel to show up adjacent to the scheduler. For this i use a dummy button to post back on the OnClientAppointmentClick event. The issue is that after modifying  the scheduler to web service binding, the OnClientAppointmentClick event seems to take for ever to load and it is affecting the performance. I am not sure if this is caused because post back is causing a conflict to the web service or not.

<telerik:RadScheduler runat="server"  ID="rsTicketsSchedule"
                                    OnResourcesPopulating="rsTicketsSchedule_ResourcesPopulating"
                                    SelectedView="TimelineView"
                                    OnTimeSlotCreated="rsTicketsSchedule_TimeSlotCreated"
                                    OnClientAppointmentsPopulated="OnClientAppointmentsPopulated"
                                          OnClientAppointmentsPopulating="OnClientAppointmentsPopulating"
                                    OnClientResourcesPopulating="OnClientResourcesPopulating"
                                    AppointmentStyleMode="Default"
                                    OnClientAppointmentClick="singleClick"
                                    OnClientAppointmentCreated="OnAppointmentCreated"
                                    OnClientAppointmentDoubleClick="rsClientAppointmentDoubleClick"
                                    OnClientAppointmentMoveEnd="AppointmentMoved"
                                    OnClientAppointmentResizeStart="OnAppointmentResizeStart"
                                    OnClientAppointmentResizeEnd="OnAppointmentResizeEnd"
                                    OnClientAppointmentWebServiceDeleting="OnAppointmentDeleting"
                                    OnClientAppointmentWebServiceUpdating="OnAppointmentUpdating"
                                    OnClientRequestSuccess="OnClientRequestSuccess"
                                    OnClientRequestFailed="OnClientRequestFailed"
                                    OnClientAppointmentMoveStart="StopTimer"
                                    OnClientAppointmentDataBound="OnClientAppointmentDataBound"
                                    OnClientDataBound="onSchedulerDataBound"
                                    AllowInsert ="False"
                                    DisplayDeleteConfirmation="True"
                                    Localization-HeaderToday="Today"
                                    EnableCustomAttributeEditing="True"
                                    EnableDescriptionField="True"
                                    Height="100%"
                                    EnableExactTimeRendering="true"
                                    EnableViewState="true"
                                    OverflowBehavior="Scroll"
                                    ShowAllDayRow ="false"  
                                    OnClientAppointmentContextMenu ="OnClientAppointmentContextMenu"
                                    OnClientAppointmentContextMenuItemClicked="handleClick"
                                    OnClientNavigationComplete = "OnClientNavigationComplete"
                                    OnClientNavigationCommand  = "OnClientNavigationCommand"
                                >
                                
                                <DayView UserSelectable="True" GroupBy="TechName" GroupingDirection="Horizontal" />
                                <WeekView UserSelectable="True" GroupBy="TechName" GroupingDirection="Vertical"  />
                                <MonthView UserSelectable="True" GroupBy="TechName" GroupingDirection="Vertical"  />
 
                                <TimelineView 
                                    GroupBy="TechName"
                                    ColumnHeaderDateFormat="h:mm tt"
                                    GroupingDirection="Vertical"
                                    HeaderDateFormat="MM/dd/yyyy h:mm tt"
                                    NumberOfSlots ="21" 
                                    SlotDuration="00:30:00"
                                    StartTime="08:00:00"  />
 
                                      <WebServiceSettings   Path="WorkforceServices/M4SchedulerWebService.asmx" ResourcePopulationMode="ServerSide" />
 
                                <AppointmentContextMenus >
                                    <telerik:RadSchedulerContextMenu ID="RsTicketsScheduleContextMenu" runat="server"   > </telerik:RadSchedulerContextMenu>
                                </AppointmentContextMenus>
 
                                <ResourceTypes>
                                    <telerik:ResourceType Name="TechName" />
                                    <telerik:ResourceType Name="TicketState" />
                                </ResourceTypes>
 
                      </telerik:RadScheduler>

This is the client side event I have the issue with:

OnClientAppointmentClick="singleClick"

function singleClick(sender, eventArgs) {
    var apptID1 = eventArgs.get_appointment().get_id();
    apptIDInfo = "ShowRadTabStrip|" + apptID1 + "|ApptID";
    __doPostBack("TestPanel1UpdBtn", apptIDInfo);  //Causes Postback to show RadTabstrip for TicketInfo
    return false;
}

Is there any way I can improve this?

Thanks,

Meera
Boyan Dimitrov
Telerik team
 answered on 13 Jan 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?