Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
180 views
Hello,

I'm stuck here. I basically have RadToolBar to perform few functions on my RadGrid (such as Clear Filters, Export to Pdf, etc).

I handled the RadToolBarButton click events in the code behind like this:

    Protected Sub RadToolBar1_ButtonClick(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles RadToolBar1.ButtonClick 
        If TypeOf e.Item Is RadToolBarButton Then 
            Dim button As RadToolBarButton = TryCast(e.Item, RadToolBarButton) 
 
            If button.CommandName = "FullList" Then 
                For Each column As GridColumn In RadGrid1.MasterTableView.Columns 
                    column.CurrentFilterFunction = GridKnownFunction.NoFilter 
                    column.CurrentFilterValue = String.Empty 
                Next 
                RadGrid1.MasterTableView.FilterExpression = String.Empty 
                RadGrid1.MasterTableView.Rebind() 
 
            ElseIf button.CommandName = "ExportToPdf" Then 
                RadGrid1.MasterTableView.ExportToPdf() 
            End If 
        End If 
    End Sub 

My aspx:

   <telerik:RadToolBar runat="server" ID="RadToolBar1" OnButtonClick="RadToolBar1_ButtonClick" onclientButtonClicking="radToolBarClientClicked"
        <Items> 
            <telerik:RadToolBarButton Text="Full List" CommandName="FullList" ImageUrl="~/Images/AwardsGrid/Table.gif"></telerik:RadToolBarButton> 
            <telerik:RadToolBarButton Text="Print" CommandName="Print" ImageUrl="~/Images/AwardsGrid/Printer.gif"></telerik:RadToolBarButton> 
            <telerik:RadToolBarButton Text="Export to Pdf" CommandName="ExportToPdf" ImageUrl="~/Images/AwardsGrid/Printer.gif"></telerik:RadToolBarButton> 
        </Items> 
    </telerik:RadToolBar> 
 
    <telerik:RadGrid ID="RadGrid1" runat="server" ShowStatusBar="true" GridLines="Both" CssClass="RadGridCustomClass" AllowFilteringByColumn="true" OnItemCommand="RadGrid1_ItemCommand" >  
        <!-- my RadGrid contents --> 
    </telerik:RadGrid> 

Funny thing is when I debug, the event is captured. However after it finishes executing, nothing happens.. (filters are not cleared, no pdf exported) etc. Basically it does nothing.


However if I use normal buttons (not RadToolBar) like this:
    <asp:LinkButton ID="LinkButton3" runat="server" type="button" Text="[ Export to Pdf ]" 
        OnClick="LinkButton3_ButtonClick" Font-Underline="false" ForeColor="Black" /> 

    Protected Sub LinkButton3_ButtonClick(ByVal sender As ObjectByVal e As EventArgs) Handles LinkButton3.Click 
        RadGrid1.MasterTableView.ExportToPdf() 
    End Sub 

I can get the pdf exported.

Any idea why and how to fix it?

One more thing, I tried clearing filters using client javascript :

            function RefreshGrid() { 
                var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView(); 
                masterTable.filter("AwardID""", Telerik.Web.UI.GridFilterFunction.StartsWith, true); 
                masterTable.filter("AwardName""", Telerik.Web.UI.GridFilterFunction.StartsWith, true); 
            } 

It works, but the my current filter setting is gone. It becomes 'No Filter' . How do I persist my default filter?


Thanks!

Andreas
waircit
Top achievements
Rank 1
Veteran
 answered on 07 Jul 2010
1 answer
426 views
Hi

I am using multiple radwindow in my page...
i want to get active radwindow id ...

thanks in advance..
Shinu
Top achievements
Rank 2
 answered on 07 Jul 2010
4 answers
244 views
Hi,

In my current project, on one of the web page I have a RadGrid with Add/Insert, Edit, Delete.

The web page is similar to as follows http://www.gouw.ws/RadGrid.aspx

When the Delete link on the RadGrid's row is clicked, a popup is displayed as follows http://www.gouw.ws/RadGridDelete.jpg

The title of the popup is "Message from webpage" instead of "Delete" as assigned to the ConfirmTitle on the ASPX.

Can you please tell me why this is so? How can I change the popup title to "Delete"?

The code of the web page is as follows:
ASPX
<form id="form1" runat="server"
<div> 
    <telerik:RadScriptManager ID="radScriptManager" runat="server" /> 
    <telerik:RadGrid ID="radGrid" AutoGenerateColumns="false" AllowSorting="true" OnNeedDataSource="radGrid_NeedDataSource" runat="server"
        <ClientSettings> 
            <Scrolling UseStaticHeaders="true" /> 
        </ClientSettings>  
        <MasterTableView AllowMultiColumnSorting="true" CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add new founder" CommandItemSettings-ShowRefreshButton="false" EditMode="InPlace" TableLayout="Fixed"
            <Columns> 
                <telerik:GridBoundColumn DataField="Name" DataType="System.String" HeaderText="Name" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" SortExpression="Name" AllowSorting="true" UniqueName="Name" /> 
                <telerik:GridBoundColumn DataField="Founder" DataType="System.String" HeaderText="Founder" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" SortExpression="Founder" AllowSorting="true" UniqueName="Founder" /> 
                <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderStyle-Width="5%" UniqueName="Edit" /> 
                <telerik:GridButtonColumn ButtonType="ImageButton" ConfirmDialogType="RadWindow" HeaderStyle-Width="5%" ConfirmText="Delete this founder?" ConfirmTitle="Delete" CommandName="Delete" /> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid>   
</div> 
</form> 

Regards,
Herman
Herman Gouw
Top achievements
Rank 2
 answered on 07 Jul 2010
1 answer
88 views
Any time I specify to display more than one month (i.e.: multiple columns), the next and previous month navigation stops working. I don't even get a hover for the arrows on the right. I get a hover for the arrows on the left but clicking does nothing. This seems like a rather common thing to do. Does it not support this? If not why does it bother to show the arrows??

 <telerik:RadCalendar ID="rcalStartDateRange" runat="server" 
                                Skin="Office2007" ShowRowHeaders="False"
                                UseColumnHeadersAsSelectors="false" EnableMultiSelect="false" MultiViewColumns="2">
                            </telerik:RadCalendar>

Thanks in advance!
Levi


Levi
Top achievements
Rank 1
 answered on 07 Jul 2010
1 answer
115 views
I have the following template:
                                <EditFormSettings EditFormType="Template">  
                                    <FormTemplate> 
                                        <table id="Table1" cellspacing="1" cellpadding="1" width="400px" border="0">  
                                            <tr> 
                                                <td align="right">  
                                                    Company Name:  
                                                </td> 
                                                <td align="left">  
                                                    <telerik:RadComboBox ID="rcbCompany" runat="server" AppendDataBoundItems="true" 
                                                        DataTextField="CompanyName" DataValueField="CompanyId">  
                                                        <Items> 
                                                            <telerik:RadComboBoxItem Text="Select a Company" Value="" /> 
                                                        </Items> 
                                                    </telerik:RadComboBox> 
                                                </td> 
                                            </tr> 
                                            <tr> 
                                                <td align="right">  
                                                    Role Name:  
                                                </td> 
                                                <td align="left">  
                                                    <telerik:RadComboBox ID="rcbRole" runat="server" DataTextField="RoleName" DataValueField="ApRoleId" 
                                                        Enabled="false">  
                                                        <Items> 
                                                            <telerik:RadComboBoxItem Text="Select a Role" Value="" /> 
                                                        </Items> 
                                                    </telerik:RadComboBox> 
                                                </td> 
                                            </tr> 
                                            <tr> 
                                                <td align="right" colspan="2">  
                                                    <asp:Button ID="Button1" Text="Insert" runat="server" CommandName="PerformInsert" />&nbsp;  
                                                    <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel" /> 
                                                </td> 
                                            </tr> 
                                        </table> 
                                    </FormTemplate> 
                                </EditFormSettings> 
 
And I would like to bind the data of the RadComboBoxes in the CodeBehind on the fly.
Which event do I tie into to accomplish this?

I have two events:

    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)  
    {  
        if (e.CommandName == "InsertChild")  
        {  
            GridDataItem item = (GridDataItem)e.Item;  
            Guid _sysUserId = (Guid)item.GetDataKeyValue("SysUserId");  
            GridTableView tableView = (GridTableView)item.ChildItem.NestedTableViews[0];  
            tableView.IsItemInserted = true;  
            tableView.Rebind();  
        }    
 
 
and
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if (e.Item.OwnerTableView.IsItemInserted && e.Item is GridEditFormInsertItem)  
        {  
            GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;  
 
            RadComboBox rcbCompany = (RadComboBox)item.FindControl("rcbCompany");  
 
            if (rcbCompany != null)  
            {  
                Database db = DatabaseFactory.CreateDatabase();  
                string sqlCommand = "uspGetUserCompaniesAvailable";  
 
                DbCommand dbdbCommand = db.GetStoredProcCommand(sqlCommand);  
 
                db.AddInParameter(dbCommand, "@SYSUSER_ID", DbType.Guid, new Guid(""));  
 
                DataSet ds = db.ExecuteDataSet(dbCommand);  
                rcbCompany.DataSource = ds;  
                //rcbCompany.DataBind();  
            }  
        }  
    }  
 
neither of which will allow me to accomplish my goal. If I attempt to use FindControl in the item command, the control is always null,
If I use it in the databound method, I get an error on DataBind().

What event would I use to bind data to the RadComboBox's
Atlas
Top achievements
Rank 1
 answered on 07 Jul 2010
9 answers
336 views
Hello, telerik!

I have some problem, connected with this grid. An event "ExcelExportCellFormatting" isn't raised when the grid is in process of exporting to excel.How can i call this event other way?
Daniel
Telerik team
 answered on 06 Jul 2010
6 answers
235 views
I'd like a horizontal menu that
    (1) spans the whole window
    (2) with the menu items ranged on the left
so far so good - I can get this "out of the box"
    (3) with just one menu item at the right of the menu bar

ie:  something like:

M1..M2..M3..M4......................................................M5

It's a multi-level menu with a database datasource.

Any suggestions how I might achieve this effect?

Thanks
John
John Hadjioannou
Top achievements
Rank 1
 answered on 06 Jul 2010
0 answers
105 views
Is it possible to do this?  I want to show multi-column info based on a sharepoint list.  can this be bound to a datasource of some sort?

Thanks,
Michael Pacifico
Top achievements
Rank 1
 asked on 06 Jul 2010
1 answer
146 views
hi

I have a Grid that is using inPlace editing mode. When i tried changing the Edit text to Open and Update text to Save in the mastertableview. It didn't get change. How should i go about it? Thanks
IT
Top achievements
Rank 2
 answered on 06 Jul 2010
14 answers
358 views
Hi There,

I have an issue with the Insert/Update Commands. Not sure why, but when the AJAX Enabled Web Application is working on its own from VS05, the Commands are triggered perfectly well. However, having deployed it to the CRM Server Environment, only the DeleteCommand works. I doubt the problem lies with the coding since it works well when its on stand-alone running via the VS05. Any suggestions?

Thanks.
PS: I have attached the working codes as an attachment in case you would be interested to view it.

Regards,
Christopher

ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CUST_DivFeeApportionment._Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI, Version=2009.1.527.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" 
    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>  
</head> 
<body style="margin: 0px;">  
    <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
    <div> 
        <telerik:RadGrid ID="RadGrid1" runat="server" Skin="Vista" GridLines="None" 
            OnDeleteCommand="RadGrid1_DeleteCommand" OnInsertCommand="RadGrid1_InsertCommand" 
            OnUpdateCommand="RadGrid1_UpdateCommand" OnNeedDataSource="RadGrid1_NeedDataSource">  
            <MasterTableView CommandItemDisplay="Bottom" AutoGenerateColumns="False">  
                <Columns> 
                    <telerik:GridDropDownColumn DataField="New_name" HeaderText="Division" SortExpression="New_name" 
                        UniqueName="New_name" DataSourceID="SqlDataSource_DivNames" ListValueField="New_name" ListTextField="New_name">  
                    </telerik:GridDropDownColumn> 
                    <telerik:GridBoundColumn DataField="New_PercentageofFee" DataType="System.Double" 
                        HeaderText="Percentage (%)" SortExpression="New_PercentageofFee" UniqueName="New_PercentageofFee" DataFormatString="{0:F2}">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="New_Amount" DataType="System.Decimal" HeaderText="Amount ($)" 
                        SortExpression="New_Amount" UniqueName="New_Amount" DataFormatString="{0:F2}">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" /> 
                    <telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" /> 
                    <telerik:GridBoundColumn DataField="New_DivFeeAppId" DataType="System.Guid" Visible="False" UniqueName="New_DivFeeAppId" ReadOnly="True" /> 
                </Columns> 
                <EditFormSettings> 
                    <EditColumn UniqueName="EditCommandColumn1">  
                    </EditColumn> 
                </EditFormSettings> 
            </MasterTableView> 
            <ValidationSettings EnableValidation="False" /> 
        </telerik:RadGrid> 
        <asp:SqlDataSource ID="SqlDataSource_DivNames" runat="server" ConnectionString="<%$ ConnectionStrings:CPG_MSCRMConnectionString %>" 
            SelectCommand="SELECT [New_name] FROM [New_distributionlist] WHERE (([New_Type] = @New_Type) AND ([DeletionStateCode] = @DeletionStateCode) AND ([statecode] = @statecode))">  
            <SelectParameters> 
                <asp:Parameter DefaultValue="1" Name="New_Type" Type="Int32" /> 
                <asp:Parameter DefaultValue="0" Name="DeletionStateCode" Type="Int32" /> 
                <asp:Parameter DefaultValue="0" Name="statecode" Type="Int32" /> 
            </SelectParameters> 
        </asp:SqlDataSource> 
    </div> 
    </form> 
</body> 
</html> 
 

C#:
using System;  
using System.Data;  
using System.Configuration;  
using System.Collections;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using System.Data.Sql;  
using System.Data.SqlClient;  
using CUST_DivFeeApportionment.CRMSDK;  
using Telerik.Web.UI;  
 
namespace CUST_DivFeeApportionment  
{  
    public partial class _Default : System.Web.UI.Page  
    {  
        protected static string projGuid = string.Empty;  
        protected static CrmService service;  
        protected static string deletionSC = "0";  
        protected static string sc = "0";  
 
        protected string OrgName = ConfigurationManager.AppSettings["OrgName"];  
        protected string crmServiceURL = ConfigurationManager.AppSettings["CRMServiceUrl"];  
 
        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!Page.IsPostBack)  
            {  
                // Set up the CRM Service.  
                CrmAuthenticationToken token = new CrmAuthenticationToken();  
                token.AuthenticationType = 0;  
                token.OrganizationName = OrgName;  
 
                service = new CrmService();  
                service.Url = crmServiceURL;  
                service.CrmAuthenticationTokenValue = token;  
                service.Credentials = System.Net.CredentialCache.DefaultCredentials;  
 
                projGuid = Request.QueryString["id"];  
                //hdProjGuid.Value = projGuid;  
                //The commented line that follows is for stand-alone testing of application  
                //hdProjGuid.Value = "6054A4CD-CF45-DE11-8F2B-0003FF046930";  
                //projGuid = "6054A4CD-CF45-DE11-8F2B-0003FF046930";  
            }  
        }  
 
        protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)  
        {  
            RadAjaxManager1.Alert("Update");  
        }  
 
        protected void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e)  
        {  
            RadAjaxManager1.Alert("Delete");  
        }  
 
        protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)  
        {  
            RadAjaxManager1.Alert("Insert");  
        }  
 
        public DataSet GetDataTable(string query)  
        {  
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["CPG_MSCRMConnectionString"].ToString());  
            SqlDataAdapter sqlDA = new SqlDataAdapter();  
            sqlDA.SelectCommand = new SqlCommand(query, sqlConn);  
 
            DataSet ds = new DataSet();  
 
            sqlConn.Open();  
            try 
            {  
                sqlDA.Fill(ds);  
            }  
            finally 
            {  
                sqlConn.Close();  
            }  
 
            return ds;  
        }  
 
        protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)  
        {  
            //using StringBuilder to concatenate the Query String for the Select Command  
            //for the RadGrid  
            System.Text.StringBuilder query = new System.Text.StringBuilder();  
            query.Append("SELECT [New_name], [New_Amount], [New_PercentageofFee], [New_DivFeeAppId] FROM [New_DivFeeApp] WHERE [New_RelatingProjectId] = '");  
            query.Append(projGuid);  
            query.Append("' AND [DeletionStateCode] = '");  
            query.Append(deletionSC);  
            query.Append("' AND [statecode] = '");  
            query.Append(sc);  
            query.Append("'");  
 
            RadGrid1.DataSource = GetDataTable(query.ToString());  
        }  
    }  
}  
 
Dan
Top achievements
Rank 2
 answered on 06 Jul 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?