Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
235 views
Is it not possible to export a RadGrid to PDF if it's bound client-side?

If not, why not?

If so, how can it be achieved? 
Veli
Telerik team
 answered on 10 Jan 2012
1 answer
86 views
Afer clicking the button click , i need to execute some code  and after that i need to show the confirm message.
if it successful i need to excecute  some other the code.

Can any one please help how to implement that.
Princy
Top achievements
Rank 2
 answered on 10 Jan 2012
1 answer
152 views
Hi Admin,

For the follwing code (asp.net Treeview), please give the telerik equivalent.

 

 

 

 

foreach (DataRow row in territories.Tables[0].Rows)
            {
                RadTreeNode newNode = new RadTreeNode(row["terr_rpt_grp_ttl"].ToString(), row["terr_rpt_grp"].ToString());
                newNode.PopulateOnDemand = true;
                newNode.SelectAction = TreeNodeSelectAction.Expand;
                node.ChildNodes.Add(newNode);
            }
        }

 

The markup defined for the asp.net TreeView is:-

<asp:TreeView Runat="Server" OnTreeNodePopulate="Node_Populate" ID="tvwauthors">
 
<Nodes>
 
<asp:TreeNode Text="ALL" PopulateOnDemand= "true" Value="0"/>
 
</Nodes>
 
</asp:TreeView>

  Please help regarding this. Just the telerik equivalent. (For ex. PopulateOnDemand, TreeNodeSelectionAction.Expand etc etc)

Thanks a lot
XORV

Princy
Top achievements
Rank 2
 answered on 10 Jan 2012
1 answer
47 views
Hi,

I have a radgrid, and I would like to display both text and image on the header. So I used following code to add a image to each of columns. But only last column displays both text and image, other columns still not display image.

 protected void RadGrid_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridHeaderItem)
            {
                GridHeaderItem headerItem = (GridHeaderItem)e.Item;
                HashSet<string> columnNames = (HashSet<string>)ViewState["Columns"];
                foreach (string columnName in columnNames)
                {
                    Image image = new Image();

                   image.ImageUrl = columnName + ".png";                     headerItem[columnName].Controls.Add(image);                 }             }         }
Could some one help me with displaying both text and image for each of the columns? Thanks very much.




Princy
Top achievements
Rank 2
 answered on 10 Jan 2012
3 answers
116 views
hi all,

i have a grid with two columns ID and Name in that i need the filter option by with the help of drop down contain numerical values.
i know how to do that in Server side code. can u please tell me how write the logic in java script.

aspx page:

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"
                  EnableLinqExpressions="false">
                  <MasterTableView PagerStyle-AlwaysVisible="true" AllowFilteringByColumn="true">
                      <Columns>
                          <telerik:GridBoundColumn HeaderText="ID" UniqueName="ID" DataField="ID" DataType="System.Int64">
                              <FilterTemplate>
                                  <telerik:RadComboBox ID="RadComboBoxDpi" DataTextField="ID" Width="50px" AppendDataBoundItems="true"
                                      runat="server" AutoPostBack="true" OnClientSelectedIndexChanged="DPIIndexChanged">
                                      <Items>
                                          <telerik:RadComboBoxItem Text="All" />
                                          <telerik:RadComboBoxItem Text="1" Value="1" />
                                          <telerik:RadComboBoxItem Text="2" Value="2" />
                                          <telerik:RadComboBoxItem Text="3" Value="3" />
                                          <telerik:RadComboBoxItem Text="4" Value="4" />
                                          <telerik:RadComboBoxItem Text="5" Value="5" />
                                          <telerik:RadComboBoxItem Text="6" Value="6" />
                                          <telerik:RadComboBoxItem Text="7" Value="7" />
                                          <telerik:RadComboBoxItem Text="8" Value="8" />
                                          <telerik:RadComboBoxItem Text="9" Value="9" />
                                          <telerik:RadComboBoxItem Text="10" Value="10" />
                                      </Items>
                                  </telerik:RadComboBox>
                              </FilterTemplate>
                          </telerik:GridBoundColumn>
                          <telerik:GridBoundColumn HeaderText="Name" UniqueName="Name" DataField="Name">
                          </telerik:GridBoundColumn>
                      </Columns>
                      <EditFormSettings>
                          <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                          </EditColumn>
                      </EditFormSettings>
                      <PagerStyle AlwaysVisible="True"></PagerStyle>
                  </MasterTableView>
                  <FilterMenu EnableImageSprites="False">
                  </FilterMenu>
              </telerik:RadGrid>

code :
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
   {
       dynamic data = new[] {
               new { ID = 1, Name ="Name1"},
               new { ID = 2, Name = "Name2"},
               new { ID = 3, Name = "Name3"},
               new { ID = 4, Name = "Name4"},
               new { ID = 5, Name = "Name5"},
               new { ID = 6, Name ="Name6"},
               new { ID = 7, Name = "Name7"},
               new { ID = 8, Name = "Name8"},
               new { ID = 9, Name = "Name9"},
               new { ID = 10, Name = "Name10"}
              
           };
 
       RadGrid1.DataSource = data;
   }
   protected void RadComboBoxDpi_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
   {
       RadComboBox rdcmb = (RadComboBox)sender;
       RadGrid1.MasterTableView.FilterExpression = "([ID] = " + rdcmb.SelectedValue + ")";
       GridColumn column = RadGrid1.MasterTableView.GetColumnSafe("ID");
       column.CurrentFilterFunction = GridKnownFunction.EqualTo;
       column.CurrentFilterValue = rdcmb.SelectedValue;
       RadGrid1.Rebind();
   }



the javascript code i tried for numeric sorting is not working  but the below the logic for string data is working fine ...still no luck on this can  u please help me out this issue

<script type="text/javascript">
 
       function DPIIndexChanged(sender, args) {
           debugger;
           var LangaugeView = $find("<%=RadGrid1.ClientID%>").get_masterTableView();
           LangaugeView.filter("ID", args.get_item().get_value(), "EqualTo");
       }
   </script>


        
Jayesh Goyani
Top achievements
Rank 2
 answered on 10 Jan 2012
1 answer
109 views
Hello,
            I have a problem with my RadaGrid. This is my ascx page :

<telerik:RadAjaxLoadingPanel  ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadSplitter ID = "RadSplitter1" runat ="server" Skin = "Windows7" SplitBarsSize = "" Width ="100%" Height ="650"  >
        <telerik:RadPane ID = "LeftPane" runat = "server" Scrolling ="None" Width ="20px"  >
            <telerik:RadSlidingZone ID = "SlidingZone1" runat ="server" >
                <telerik:RadSlidingPane ID = "RadSlidingPane1" Title = "User Groups" runat ="server" Width = "220" MinWidth ="220" MaxWidth ="400" EnableDock = "false" Scrolling ="Y" >
                     <telerik:RadAjaxPanel ID = "RadAjaxPanel1" runat ="server" LoadingPanelID = "RadAjaxLoadingPanel1"  >
                        <telerik:RadTreeView ID ="RadTreeView1"  runat ="server"  OnNodeExpand = "RadTreeView1_NodeExpand" Height ="520" LoadingStatusPosition ="BeforeNodeText" AllowNodeEditing ="true"
                           OnContextMenuItemClick = "RadTreeView1_ContextMenuItemClick"  ViewStateMode ="Enabled"
                           OnClientContextMenuShowing = "onClientContextMenuShowing" PersistLoadOnDemandNodes ="true"   >                           
                        </telerik:RadTreeView>                       
                     </telerik:RadAjaxPanel>                    
                </telerik:RadSlidingPane>
            </telerik:RadSlidingZone>
        </telerik:RadPane>
        <telerik:RadSplitBar ID = "Radsplitbar1" runat ="server"  ></telerik:RadSplitBar>
        <telerik:RadPane ID = "RightPane" runat = "server" Scrolling = "None"  Width ="100%" >
            <telerik:RadAjaxManager ID ="RadAjaxManager1" runat ="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
                        <telerik:RadGrid Width ="100%" ID="RadGrid1" runat ="server" AllowCustomPaging ="false" CssClass ="NextPrevAndNumeric"
                        AllowPaging ="true" AllowSorting ="true" PageSize ="20" ShowStatusBar ="true" GridLines ="Vertical"  EnableViewState ="false" >
                            <PagerStyle Mode ="NextPrevAndNumeric"   /> 
                            <FilterMenu EnableTheming="True">
                                <CollapseAnimation Duration="200" Type="OutQuint" />
                            </FilterMenu>
                            <MasterTableView Width="100%" AutoGenerateColumns ="false" EnableColumnsViewState ="false" >                           
                                <Columns>
                                    <telerik:GridBoundColumn  HeaderText ="User Name" DataField="AAA" ></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField ="BBB" HeaderText ="USer Id"></telerik:GridBoundColumn>                                   
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
        </telerik:RadPane>
        </telerik:RadSplitter>

Basically, i have two panes, the left(sliding) and the right(which has the grid). I am filling up the the tree(in the left pane) in the code behind. Now when i click a node in the tree, the grid(in the right pane) should change depending in the node i clicked. 
In the code behind i have this :
Private Sub RadTreeView1_NodeClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles RadTreeView1.NodeClick
        USerGroupSelected = CintG(e.Node.Value)
        RadGrid1.DataSource = Nothing
        RadGrid1.Rebind()
    End Sub
 
Private Sub RadGrid1_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
         Dim tb As New DataTable = GETDATA(USerGroupSelected)
        RadGrid1.DataSource = tb
    End Sub


But the grid is not getting refreshed. But when i keep a break point and see what is happening, everything is going as it should be, the tb is getting updated, but the grid is not getting refreshed. When i change the page size, then it is fine. Only when i click on the node, the problem comes. My aspx page has EnableViewState = false. Please help. Thanks
Jayesh Goyani
Top achievements
Rank 2
 answered on 10 Jan 2012
2 answers
112 views
While Export to excel, RadGrid.MasterTableView.Caption alignment should be in left. For me now its showing as center align. How to change this in left align. Anybody can help me in this.
Nithya Rani
Top achievements
Rank 1
 answered on 10 Jan 2012
2 answers
116 views
Hello,
Unable to apply my own css class to Appointments.
i created one Css class like 
.TaskView
{
Background-image:"~/Tak.png",
BackColor:#cfcfcf
}
and i tried to apply like bellow

if(e.Appointment.Type="Task")
{
e.Appointment.CssClass="TaskView";
}
Rad Scheduler default Css Class ovveriting my custom css.How i can create my custom Css for Appoinment.Please update me asap

Thanks And Regards
N.Vishnu Vardhan Reddy
Vishnu Vardhan Reddy
Top achievements
Rank 2
 answered on 10 Jan 2012
2 answers
154 views
In RadGrid i was using GridTemplateColumn, inside that i was using link button. While exporting to excel, only those column values are not exported to the grid.
This is my code
.aspx
<telerik:RadGrid ID="RadGrid_Invbystatus" runat="server" AllowPaging="True" AllowSorting="True"
                        GridLines="Both" EnableLinqExpressions="false" Width="95%" AutoGenerateEditColumn="false"
                        AutoGenerateColumns="False" OnPageIndexChanged="RadGrid_Invbystatus_PageIndexChanged"
                        Visible="false" OnExcelExportCellFormatting="RadGrid_Invbystatus_ExportCellFormatting"
                        GroupHeaderItemStyle-HorizontalAlign="Left">
                        <PagerStyle Mode="NextPrevAndNumeric" />
                        <HeaderStyle BorderStyle="Solid" Font-Bold="true" HorizontalAlign="Center" />
                        <ItemStyle HorizontalAlign="Left" Font-Underline="false" />
                        <AlternatingItemStyle HorizontalAlign="Left" Font-Underline="false" />
                        <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
                        </ExportSettings>
                        <MasterTableView AllowPaging="true" CommandItemDisplay="Top" GridLines="Both" ShowGroupFooter="true">
                            <GroupByExpressions>
                                <telerik:GridGroupByExpression>
                                    <SelectFields>
                                        <telerik:GridGroupByField FieldAlias="STATUS" FieldName="STATUS" HeaderText="Status">
                                        </telerik:GridGroupByField>
                                    </SelectFields>
                                    <GroupByFields>
                                        <telerik:GridGroupByField FieldName="STATUS" HeaderText="Status"></telerik:GridGroupByField>
                                    </GroupByFields>
                                </telerik:GridGroupByExpression>
                            </GroupByExpressions>
                            <CommandItemSettings ShowExportToPdfButton="true" ShowExportToWordButton="true" ShowExportToExcelButton="true"
                                ShowAddNewRecordButton="false" ShowRefreshButton="false" ShowExportToCsvButton="false" />
                            <Columns>
                                <telerik:GridTemplateColumn HeaderText="Product" UniqueName="Product" DataField="PROD_ID"
                                    ItemStyle-HorizontalAlign="Left" SortExpression="PROD_ID">
                                    <ItemStyle Width="10%" />
                                    <HeaderStyle Width="10%" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkprodNum" runat="server" OnClick="lnkprodNum_Click" ForeColor="DarkBlue"
                                            Text='<%# DataBinder.Eval (Container.DataItem, "PRODUCT_CODE") %>' ValidationGroup='<%# DataBinder.Eval (Container.DataItem, "PROD_ID") %>'>
                                        </asp:LinkButton>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn HeaderText="Description" UniqueName="Description" DataField="PROD_DESC"
                                    ItemStyle-HorizontalAlign="Left">
                                    <ItemStyle Width="15%" />
                                    <HeaderStyle Width="15%" />
                                </telerik:GridBoundColumn>
                                <telerik:GridCalculatedColumn HeaderText="Qty" UniqueName="qty" ItemStyle-HorizontalAlign="Right"
                                    DataFields="QTTY, PACKSHORT_DESC" Expression='{0}+ " " +{1}'>
                                    <ItemStyle Width="10%" />
                                    <HeaderStyle Width="10%" />
                                </telerik:GridCalculatedColumn>
                                <telerik:GridBoundColumn HeaderText="Lot" UniqueName="lot" DataField="LOT_CODE" ItemStyle-HorizontalAlign="Left">
                                    <ItemStyle Width="10%" />
                                    <HeaderStyle Width="10%" />
                                </telerik:GridBoundColumn>
                                <telerik:GridDateTimeColumn DataType="System.DateTime" HeaderText="Exp. Date" UniqueName="expDate"
                                    ItemStyle-HorizontalAlign="Left" DataField="EXP_DT" DataFormatString="<%$Appsettings:dateformat%>">
                                    <ItemStyle Width="10%" />
                                    <HeaderStyle Width="10%" />
                                </telerik:GridDateTimeColumn>
                                <telerik:GridDateTimeColumn DataType="System.DateTime" HeaderText="Received" UniqueName="recvDate"
                                    ItemStyle-HorizontalAlign="Left" DataField="RECV_DATE" DataFormatString="<%$Appsettings:dateformat%>">
                                    <ItemStyle Width="10%" />
                                    <HeaderStyle Width="10%" />
                                </telerik:GridDateTimeColumn>
                                <telerik:GridTemplateColumn HeaderText="Order No." UniqueName="Order_No." DataField="ORDER_NO"
                                    ItemStyle-HorizontalAlign="Left" SortExpression="ORDER_NO">
                                    <ItemStyle Width="10%" />
                                    <HeaderStyle Width="10%" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkOrdNum" runat="server" OnClick="lnkrefNum_Click" ForeColor="DarkBlue"
                                            CommandArgument='<%# DataBinder.Eval (Container.DataItem, "ORDER_NO2") %>' Text='<%# DataBinder.Eval (Container.DataItem, "ORDER_NO") %>'
                                            ValidationGroup='<%# DataBinder.Eval (Container.DataItem, "SRORDER_ID") %>'>
                                        </asp:LinkButton>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn HeaderText="Reference No" UniqueName="Reference_No" DataField="ORDER_NO2"
                                    ItemStyle-HorizontalAlign="Left">
                                    <ItemStyle Width="10%" />
                                    <HeaderStyle Width="10%" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Warehouse" UniqueName="Warehouse" ItemStyle-HorizontalAlign="Left"
                                    DataField="WAREHOUSE_CODE">
                                    <ItemStyle Width="10%" />
                                    <HeaderStyle Width="10%" />
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
.cs
protected void RadGrid_InvAdjus_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToExcelCommandName ||
                e.CommandName == Telerik.Web.UI.RadGrid.ExportToWordCommandName ||
                e.CommandName == Telerik.Web.UI.RadGrid.ExportToCsvCommandName)
            {
                ConfigureFilter();
            }
            else if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToPdfCommandName)
            {                
                filter = "Owner:" + ddlOwner.SelectedItem.Text + "Warehouse:" + ddlwarehouse.SelectedItem.Text;
                if (!string.IsNullOrEmpty(txtSupplier.Text))
                {
                    filter += "Supplier:" + txtSupplier.Text + "Supplier Description:" + txtsupplierdesc.Text;
                }
                if (!string.IsNullOrEmpty(txtproductcode.Text))
                {
                    filter += "Product Code:" + txtproductcode.Text + "Product Description:" + txtproddesc.Text;
                }
                filter += "Product Type:" + ddlprodtype.SelectedItem.Text + "Start Date:" + rdpStartDate.SelectedDate + "End Date:" + rdpEndDate.SelectedDate;
                //RadGrid_InvAdjus.MasterTableView.Caption = filter;
                RadGrid_InvAdjus.ExportSettings.Pdf.PageTitle = filter;
            }

         
        }

        protected void RadGrid_InvAdjus_ExportCellFormatting(object sender, ExcelExportCellFormattingEventArgs e)
        {
            GridDataItem item = e.Cell.Parent as GridDataItem;

            if (e.FormattedColumn.UniqueName == "Date")
            {
                e.Cell.Style["text-align"] = "left";
            }
            if (e.FormattedColumn.UniqueName == "Product")
            {
                e.Cell.Style["text-align"] = "left";
            }
            if (e.FormattedColumn.UniqueName == "Description")
            {
                e.Cell.Style["text-align"] = "left";
            }
            if (e.FormattedColumn.UniqueName == "qty")
            {
                e.Cell.Style["text-align"] = "right";
            }
            if (e.FormattedColumn.UniqueName == "lot")
            {
                e.Cell.Style["text-align"] = "left";
            }
            if (e.FormattedColumn.UniqueName == "Order_No")
            {
                e.Cell.Style["text-align"] = "left";
            }
            if (e.FormattedColumn.UniqueName == "Reference_No")
            {
                e.Cell.Style["text-align"] = "left";
            }
            if (e.FormattedColumn.UniqueName == "Warehouse")
            {
                e.Cell.Style["text-align"] = "left";
            }
            if (e.FormattedColumn.UniqueName == "Template1")
            {
                e.Cell.Style["text-align"] = "left";

            }

            GridHeaderItem HeaderItem = (GridHeaderItem)RadGrid_InvAdjus.MasterTableView.GetItems(GridItemType.Header)[0];
            foreach (TableCell cell in HeaderItem.Cells)
            {
                cell.Style["text-align"] = "left";
                cell.Style["color"] = "#ff0000";
                cell.Style["border"] = "thin solid black";
                cell.Style["background-color"] = "#cccccc";
                cell.Style["font-weight"] = "normal";               
            }  
        }

Add My excel will be like this(Product column is empty, and i want to left align the caption part)




Nithya Rani
Top achievements
Rank 1
 answered on 10 Jan 2012
1 answer
194 views
I am using a RAD Grid and I want to span column and rows in header..... how it can be possible??????
Shinu
Top achievements
Rank 2
 answered on 10 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?