Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
123 views
Hi,

in my application, I made a custom Grid control who inherit from RadGrid.

I want every grid to have the ExportToExcel command. But I also want, in some grid, add another "custom" command.

So I create a class who implement the ITemplate interface in my custom grid control, I use this template. It works good.

But now, in some grid, I want to add a custom DropDoxnList in the Grid Command Item Display area. So I add a <CommandItemTemplate> tag in my aspx. But as I can see, this tag is override by my template.

Is it possible to mix programatic and declarative mode ?


Thanks !
Francis
Top achievements
Rank 1
 answered on 05 Dec 2012
1 answer
142 views
I have RadMenu in a RadDock and I want radmenu fit 100% width of RadDock, but it appear an horizontal scroll althought content of menu very small.
How to disappear horizontal scroll in menu?
Thanks.
http://i45.tinypic.com/o9k0i8.jpg
Code :

 <telerik:RadDockLayout runat="server" ID="RadDockLayout1">

     <telerik:RadDockZone ID="RadDockZone1" runat="server" Orientation="Vertical" Width="200px" MinHeight="400px">
     <telerik:RadDock ID="RadDock1" runat="server" Title="Blogs" EnableAnimation="true" Resizable="true" AutoPostBack="true">

         <ContentTemplate>

             <telerik:RadMenu ID="RadMenuVertical" runat="server" Width="100%" flow="Vertical" EnableShadows="true">

                 <Items>

                     <telerik:RadMenuItem Text="Books" />

                     <telerik:RadMenuItem Text="Cameras" />

                     <telerik:RadMenuItem Text="Music" />

                     <telerik:RadMenuItem Text="Software" />

                 </Items>

             </telerik:RadMenu>

         </ContentTemplate>

     </telerik:RadDock>

     </telerik:RadDockZone>

 </telerik:RadDockLayout>

Princy
Top achievements
Rank 2
 answered on 05 Dec 2012
3 answers
104 views
Hello

I add an extra menu in the menu bar of "Save the grid layout.
I have my menu that appears, but I am not able to capture the click on the item to make my own treatment.

Here is the code I add my item in the menu.
     Protected Overrides Sub OnPreRenderComplete (e As System.EventArgs)
         Sun Ace RadContextMenu menu = grdPendingRequest.HeaderContextMenu
         Sun separator As New RadMenuItem
         separator.IsSeparator = True
         menu.Items.Add (separator)

         Sun RadMenuItem item As New ()
         item.Text = "Save grid layout"
         item.NavigateUrl = ""
         item.PostBack = True
         item.Value = "Id"

         menu.Items.Add (item)

         MyBase.OnPreRenderComplete (e)
     End Sub

My version is 2010.3.1109.35

Thank you
Shinu
Top achievements
Rank 2
 answered on 05 Dec 2012
1 answer
87 views
Hello,

I am simply trying to obtain the date selected from the RadDatePicker control through javascript as I am trying to pass the value to another page as a parameter for an SQL query the page performs when loading.  However, I am having a problem with the format the date is returing.  I have tried both get_selectedDates and get_textBox with no luck in returning a date that is in a datetime format for the parameter.  With get_seletedDates I am getting a long formatted style not in the correct format while get_textBox doesn't return a date value, only that it is an HTMLelement or something along that lines.

Is there a way to get the date that is in the text box portion of the datepicker to return how it actually shows in the date picket, for instance 12/10/2012?

Thanks,
Ron
Princy
Top achievements
Rank 2
 answered on 05 Dec 2012
1 answer
63 views
Hi,

How to implement the updatecommand and deletecommand code for RAD Grid.? Is there any code samples

I have added the below code in updatecommand:
GridEditableItem editedItem = e.Item as GridEditableItem;
            DataTable ordersTable = this.GridData;
  
            //Locate the changed row in the DataSource
            DataRow[] changedRows = ordersTable.Select("Title = " + Convert.ToString(editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Title"]));

In the changedRows line, i am getting error as: Cannot perform '=' operation on System.String and System.Int32.

Thanks
Shinu
Top achievements
Rank 2
 answered on 05 Dec 2012
3 answers
2.0K+ views
Hi,

I am new to radcontrols. Started using this week.
My problem is I want to get the column value inside a row of a radgrid. I am using the cde bewlo

var mymultiplier = MasterTable.getCellByColumnUniqueName(dataItem, 'Multiplier');

Instead of getting the value of multiplier, I am getting the HTML. Please help.
Sabaratnam
Top achievements
Rank 1
 answered on 04 Dec 2012
2 answers
176 views
I have a rad grid that is AJAXified through a RadAjaxManager and I use a javascript function to stop the async request so I can export. This works perfectly in Chrome and Firefox. But does not seem to work in internet explorer. The page just refreshes. Any workarounds to this?

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <script type="text/javascript">
 
        Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(initRequest);
        function initRequest(sender, args) {
            if (args.get_postBackElement().id.indexOf("btn_ExcelExport") != -1) {
                args.set_cancel(true);  //stop async request
                sender._form["__EVENTTARGET"].value = args.get_postBackElement().id.replace(/\_/g, "$");
                sender._form["__EVENTARGUMENT"].value = "";
                sender._form.submit();
                return;
            }
        }
      
    </script>
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rg_Clients">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rg_Clients" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadGrid ID="rg_Clients" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
        ActiveItemStyle-BackColor="#004070" ActiveItemStyle-ForeColor="White" AllowSorting="True"
        CellSpacing="0" GridLines="Both" OnNeedDataSource="rg_Clients_NeedDataSource"
        Skin="WebBlue" OnItemCommand="rg_Clients_ItemCommand" AutoGenerateColumns="false"
        EnableLinqExpressions="false" HeaderStyle-Font-Bold="true" OnColumnCreating="rg_Clients_ColumnCreating"
        GroupingSettings-CaseSensitive="false" OnPreRender="rg_Clients_PreRender">
        <MasterTableView AutoGenerateColumns="false" AllowFilteringByColumn="True">
            <Columns>
                <telerik:GridTemplateColumn AllowFiltering="false" UniqueName="ClientID" HeaderStyle-Width="40px"
                    ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
                    <HeaderTemplate>
                        <asp:ImageButton ID="btn_ExcelExport" runat="server" ImageUrl="~/Images/Excel-icon.png"
                            Width="30" Height="30" OnClick="btn_ExcelExport_Click" CausesValidation="false" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Button ID="btn_View" CommandName="Select" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"ClientID") %>'
                            runat="server" Text="View" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <ExportSettings Excel-Format="ExcelML" FileName="ClientExport" IgnorePaging="true"
            OpenInNewWindow="true"  ExportOnlyData="true" />
    </telerik:RadGrid>


protected void btn_ExcelExport_Click(object sender, ImageClickEventArgs e)
        {
            string[] UserRoles = Roles.GetRolesForUser();
 
            rg_Clients.MasterTableView.GetColumn("ClientID").Visible = false;
 
            //Dont need to see the filter boxes in the excel sheet
            foreach (GridFilteringItem Filter in rg_Clients.MasterTableView.GetItems(GridItemType.FilteringItem))
                Filter.Visible = false;
 
            //Data Admin and Site Admin can export all Clients, Sales Admin can export their own and who they are supervising,
            //  and Sales Person can only export their own             
            if (UserRoles.Contains("Sales Admin"))
            {
                string Source = PageController.GetUserFullName((Guid)Membership.GetUser().ProviderUserKey);
                List<string> Sources = ClientController.GetSupervisorSources((Guid)Membership.GetUser().ProviderUserKey);
                if (rg_Clients.MasterTableView.FilterExpression != String.Empty)
                    rg_Clients.MasterTableView.FilterExpression += "AND ";
                string QueryFilter = "([Sources] LIKE \'%" + Source + "%\') ";
                foreach (string S in Sources)
                    QueryFilter += "OR ([Sources] LIKE \'%" + S + "%\') ";
 
                rg_Clients.MasterTableView.FilterExpression += QueryFilter;
            }
            else if (UserRoles.Contains("Sales Person"))
            {
                string Source = PageController.GetUserFullName((Guid)Membership.GetUser().ProviderUserKey);
                if (rg_Clients.MasterTableView.FilterExpression != String.Empty)
                    rg_Clients.MasterTableView.FilterExpression += "AND ";
                rg_Clients.MasterTableView.FilterExpression += "([Sources] LIKE \'%" + Source + "%\') ";
            }
 
            rg_Clients.MasterTableView.ExportToExcel();

The rest of the columns are created programmatically on the first page load as some of the grid bound columns implement custom filters for google-like filtering and some are dropdownlists etc.
Chris
Top achievements
Rank 1
 answered on 04 Dec 2012
2 answers
60 views
Hello,

I have a Grid that has XXXX set. When I use it w/o the SEOPagingQueryStringKey it works fine, but when I set the SEOPagingQueryStringKey="PageId" it does not work any more. (stays on page 1)
(I saw a simulair post from 2008: http://www.telerik.com/community/forums/aspnet-ajax/grid/seo-paging.aspx#533423)

Here is the code: (Version 2012.3.1016.40)
<telerik:RadGrid ID="RadGrid1" Width="100%" Height="400px" Skin="Office2010Black" runat="server">
    <mastertableview autogeneratecolumns="false" allowsorting="true" allowpaging="true" pagesize="5" datakeynames="Id" clientdatakeynames="Id">
        <Columns>
            <telerik:GridButtonColumn UniqueName="RowSelector1" CommandName="Select" CommandArgument="" ButtonType="ImageButton" Text="Open demand" ImageUrl="~/styles/images/icon/playblue_16x16.png" HeaderStyle-Width="25px" Resizable="false" />
            <telerik:GridBoundColumn DataField="Id" HeaderText="Id" AllowSorting="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Description" HeaderText="Description" AllowSorting="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Street" HeaderText="Street" AllowSorting="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ZipCode" HeaderText="ZipCode" AllowSorting="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="City" HeaderText="City" AllowSorting="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Picture" HeaderText="Picture" AllowSorting="true">
            </telerik:GridBoundColumn>
        </Columns>
        <PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric"
                      SEOPagingQueryStringKey="PageId" EnableSEOPaging="true" />      
    </mastertableview>
    <clientsettings allowcolumnhide="true" allowcolumnsreorder="false" allowdragtogroup="false" allowexpandcollapse="true" allowgroupexpandcollapse="true" enablepostbackonrowclick="false" enablerowhoverstyle="true" reordercolumnsonclient="true">
        <ClientEvents OnRowDblClick="prvOnRadGrid1_RowDblClick" />
        <Resizing AllowColumnResize="true" ShowRowIndicatorColumn="true" />
        <Selecting AllowRowSelect="true" />
        <Scrolling ScrollHeight="100%" AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" FrozenColumnsCount="0" />
    </clientsettings>
</telerik:RadGrid>

Regards,

Erik
Galin
Telerik team
 answered on 04 Dec 2012
6 answers
145 views
Hi,

I have a radchart and want to show multiple lines using datatable(I know datatable is not supported , but im adding series mannually). User selects thae date from calendar and I query the database for those range. so here is my code how I add the series I get one datatable at time and assign it to chart, i get datatable in this format :

Tours  agencyname  dtMonthno dtMonthBrand dtYear
6  agents May 2011
8  agents June 2011
agents 7  July 2011
23  agents 8  August 2011
126  agents 9  September 2011
101  agents 10  October 2011
85  agents  11  November 2011
92  agents 12  December 2011
115  agents 1  January 2012
102  agents 2  February 2012
48  agents March 2012  


foreach (string aId in aAgency)
                    {
                        DataTable dtBrands = count.GetBrandsChartData(Convert.ToDateTime(txtStartDate.Text), Convert.ToDateTime(txtEndDate.Text), Convert.ToInt32(aId));
 
                        bool morethenTwelve = false;
 
                        if (dtBrands.Rows.Count > 0)
                        {
                            ChartSeries brandChartSeries = new ChartSeries();
                            brandChartSeries.Name = dtBrands.Rows[0][1].ToString();
                            brandChartSeries.Type = ChartSeriesType.Line;
 
                            foreach (DataRow dr in dtBrands.Rows)
                            {
                                ChartSeriesItem chartitem = new ChartSeriesItem();
                                chartitem.YValue = Convert.ToDouble(dr["Tours"]);
 
                                if (morethenTwelve == false)
                                {
                                    dtMontno = Convert.ToInt32(dr["dtMonthno"]);
                                }
 
                                if (dtMontno == 12)
                                {
                                    chartitem.XValue = Convert.ToDouble(dr["dtMonthno"]);
                                    morethenTwelve = true;
                                    dtMontno = 13;
                                }
                                else if (dtMontno > 12)
                                {
                                    chartitem.XValue = Convert.ToDouble(dtMontno += 1);
                                    morethenTwelve = true;
                                }
                                else
                                {
                                    chartitem.XValue = Convert.ToDouble(dr["dtMonthno"]);
                                    morethenTwelve = false;
                                }
 
                                
                                brandChartSeries.AddItem(chartitem);
 
                                radBrands.PlotArea.XAxis[dtMonth - 1].TextBlock.Text = dr["dtMonthBrand"].ToString();
                            }
 
                            radBrands.PlotArea.XAxis.LayoutMode = Telerik.Charting.Styles.ChartAxisLayoutMode.Inside;
 
                            radBrands.ChartTitle.TextBlock.Text = "Brands";
                            radBrands.PlotArea.XAxis.AutoScale = false;
                             
                            radBrands.AddChartSeries(brandChartSeries);
                            radBrands.Series.Add(brandChartSeries);
                        }
                    }


Now I am doing the if statement in above code so that the line doesn't come back to 1 axis once the dtmonthno is more than 12.

My question is how do I show these month names in x-axis i have tried setting the autoscale to false and trying to set the x-axis but simply doesnt work here is my code for it that i add in the above foreach loop:

radBrands.PlotArea.XAxis.AddRange(1, 16, 1);
int dtMonth = Convert.ToInt32(dr["dtMonthno"]);
radBrands.PlotArea.XAxis[dtMonth - 1].TextBlock.Text = dr["dtMonthBrand"].ToString();

Your help would be greatly appreciated.

Thanks
Joseph
Top achievements
Rank 1
 answered on 04 Dec 2012
2 answers
90 views
I have a radchart with a dataTable but no legend.  I know it is possible to customize items in the chart legend, but is it possible to customize the legend on the radchart dataTable?  
Ed
Top achievements
Rank 1
 answered on 04 Dec 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?