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

I have export to excel functionality under a rad grid code snippest attached.
the code was working before and exporting data properly but now I am unable to make export working.


 <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="false"
                PageSize="10" AllowPaging="true" AllowSorting="true" AllowAutomaticDeletes="true"
                ClientSettings-AllowColumnsReorder="true" OnItemDeleted="RadGrid1_ItemDeleted"
                OnSelectedIndexChanged="RadGrid1_IndexChanged" AllowFilteringByColumn="true"
                OnItemCommand="RadGrid1_ItemCommand" OnItemDataBound="RadGrid1_ItemDataBound"
                EnableAJAX="true" >
                <MasterTableView runat="server" DataSourceID="SqlDataSource1" DataKeyNames="Id" AllowAutomaticDeletes="true"
                    AllowMultiColumnSorting="false">
                    <Columns>
                        <telerik:GridBoundColumn DataField="Id" HeaderText="<%$ Resources:Resource, User.Id.Label %>"
                            Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="OrganizationName" HeaderText="OrganizationName"
                            Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="OriginalOrganization" HeaderText="OriginalOrganization"
                            Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Login" HeaderText="<%$ Resources:Resource, User.Login.Label %>">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="Name" AllowFiltering="true" DataField="FirstName"
                            SortExpression="FirstName">
                            <ItemTemplate>
                                <asp:Label ID="lblname" runat="server" Text='<%# string.Format("{0}, {1}", Eval("FirstName"), Eval("LastName")) %>' />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="LanguageName" HeaderText="PreferredLan" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="DateOfBirth" Visible="false" HeaderText="DateOfBirth"
                            DataFormatString="{0:d}">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Phone1" HeaderText="Phone1" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Phone2" HeaderText="Phone2" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Email" HeaderText="Email1" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Email2" HeaderText="Email2" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address1" HeaderText="Address1" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Address2" HeaderText="Address2" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="City" HeaderText="City" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="StateName" HeaderText="<%$ Resources:Resource, User.StateId.Label %>">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="CountryName" HeaderText="CountryName" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Postal" HeaderText="Postal" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="CreationDate" HeaderText="<%$ Resources:Resource, User.CreationDate.Label %>"
                            DataFormatString="{0:d}" SortExpression="CreationDate">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn AllowFiltering="false">
                            <ItemTemplate>
                                <asp:ImageButton runat="server" ToolTip="<%$ Resources:Resource, View.Button %>"
                                    ImageUrl="~/App_Themes/Default/Images/gridview.gif" ID="lnkbtn" CommandName="View"
                                    CommandArgument='<%# Eval("Id") %>' Text="<%$Resources:Resource,View %>"></asp:ImageButton>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="View" Reorderable="false"
                            ConfirmText="<%$Resources:Resource,StrDelete %>" Visible="false">
                        </telerik:GridButtonColumn>
                        <telerik:GridTemplateColumn AllowFiltering="false" Visible="true" HeaderText="Add Rewards">
                            <ItemTemplate>
                                <!-- <asp:ImageButton ID="btnSelect1" ToolTip="Edit" runat="server" ImageUrl="~/App_Themes/Default/Images/gridEdit.gif" CommandName="Select"  /> -->
                                <asp:ImageButton ID="btnAddReward" ToolTip="AddReward" runat="server" ImageUrl="~/App_Themes/Default/Images/gridEdit.gif"
                                    CommandName="AddReward" CommandArgument='<%# Eval("Id") %>' />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                    <PagerStyle Position="TopAndBottom" Mode="NextPrevAndNumeric" NextPageText="Next"
                        PrevPageText="Prev"></PagerStyle>
                </MasterTableView>
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>
 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Ctla1 %>"
                SelectCommandType="StoredProcedure" SelectCommand="Ctla_GetUserList">
                <SelectParameters>
                    <asp:Parameter Name="currentOrgId" Direction="Input" DefaultValue="0" Type="Int32" />
                    <asp:Parameter Name="currentUserId" Direction="Input" DefaultValue="0" Type="Int32" />
                    <asp:Parameter Name="TotalRowCount" Direction="Output" Type="Int32" />
                </SelectParameters>
            </asp:SqlDataSource>

This is ASPx page code.

and the code for aspx.cs page
 protected void btnExportFromDatagridcsv_Click(object sender, ImageClickEventArgs e)
        {
            ConfigureExport();
            RadGrid1.MasterTableView.ExportToCSV();
        }
public void ConfigureExport()
        {
            RadGrid1.ExportSettings.ExportOnlyData = false;
            RadGrid1.ExportSettings.IgnorePaging = true;
            RadGrid1.ExportSettings.OpenInNewWindow = true;
            RadGrid1.ExportSettings.FileName = "UserList";
        }

I also tried several options including
1)   RadGrid1.ExportSettings.ExportOnlyData = true;
2) created a separate page with the simple grid and bind it with a simple datatable and applied export settings and applied export to excel.
Daniel
Telerik team
 answered on 06 Apr 2011
1 answer
181 views
I had a Rad Panel Like this

<telerik:RadPanelBar ID="RadPanelBar_LeftMenu" Runat="server"  Width="95%"  Skin="Office2007" ExpandMode="SingleExpandedItem" BackColor="Transparent">
         
</telerik:RadPanelBar>

and i am binding the data dynamically

I applied CSS..
1) I want to apply bold and font color for the root items but not for the Child items..but i failed to apply.. its applying for the whole one
(different font for root and child elements)
2) if i click on the root item ..it expands, the expanded root element should be displayed in one color

how both the things are possible..

I tried the below css but i failed for the above 2 points.. anybody please tell me how to do this?
.RadPanelBar .rpRootGroup,    
.RadPanelBar .rpRootGroup .rpLink  
{    
     border: none !important;    
     background-color: transparent !important;
     background-image:none;
     font-family:Verdana !important;  
     text-decoration: none;  
     border-bottom-width: 0px !important;  
}  
 
.RadPanelBar_Office2007 a.rpLink:hover{
color: black !important;
background-color: #FFCA5E !important;
border-color: #FF9B35 !important;
border-top-color: #FF9B35 !important;
border-right-color: #FF9B35 !important;
border-bottom-color: #FF9B35 !important;
border-left-color: #FF9B35 !important;
}
 
.rpOut  
{  
     border-bottom-width: 0px !important;     
}
 
 
.RadPanelBar_Office2007 a.rpLink, .RadPanelBar_Office2007 .rpTemplate {
color: #056B9D;
font-size: 70%;
font-family: Verdana;
font-weight:bold;
}
 
.rpText
{
    font-size: 100%;
    font-family: Verdana;
 
}



Shinu
Top achievements
Rank 2
 answered on 06 Apr 2011
1 answer
72 views
Please take a look at www.microsoft.com website. I am also attaching a screenshot here.  
The UI is created like the new Windows Phone 7 interface where if you click the arrow on the far right of the screen, the entire display changes with a different div.  

I think that this is a great way of using up space to show very large forms or articles.

Can someone suggest how to create this kind of layout and can you do this using Telerik controls or jQuery?

Pratik
Marin Bratanov
Telerik team
 answered on 06 Apr 2011
1 answer
251 views
I have a radComboBox in a usercontrol within a RadGrid.

The combo box contains a list of approx 3000 clients, so I have set EnableAutomaticLoadOnDemand = true so that when open the usercontrol, the load time of the form is quite fast.

This works well for adding new records, however when I am trying to edit a record which already has a client set, the SelectedValue property will fail to pick the value from the list (as I guess it hasn't been loaded yet).  As soon as I revert to the default of EnableAutomaticLoadOnDemand = false as shown in my code snippet below, then the SelectedValue property will correctly set the value from the list, but this then takes a couple of seconds to load the combo data.

Is there any way that I can set EnableAutomaticLoadOnDemand = true, while also getting the SelectedValue property to set the correct value from the data source?  (As an added complication, I also have a "Select from Template" combo box which will set various values in other text boxes and combo boxes, which I would also like to use with EnableAutomaticLoadOnDemand = true.)

Thanks for your help,
Ben


 

<tr>

 

 

<td>

 

Client

 

</td>

 

 

<td>

 

 

<telerik:RadComboBox ID="cboClient" Runat="server" AllowCustomText="true"

 

 

DataSourceID="SqlDataSource1" DataTextField="Account" DataValueField="ClientID"

 

 

Skin="Outlook"

 

 

 

SelectedValue='<%# DataBinder.Eval( Container, "DataItem.ClientID") %>'

 

 

 

Width="320px" EnableVirtualScrolling="True"

 

 

 

Filter="Contains" ItemsPerRequest="20" ShowMoreResultsBox="True">

 

 

<itemtemplate>

 

 

<table style="width:300px">

 

 

<tr>

 

 

<td style="width:100px; text-align: left;">

 

<%

#DataBinder.Eval(Container.DataItem, "Account")%>

 

 

 

</td>

 

 

<td style="width:200px; text-align: left;">

 

<%

#DataBinder.Eval(Container.DataItem, "Disp")%>

 

 

 

</td>

 

 

</tr>

 

Vasil
Telerik team
 answered on 06 Apr 2011
1 answer
157 views
Hi,

I have a page that uses a user control that contains a telerik:RadGrid which uses another control for edit that contains a radcombo. I enabled load on demand and everything works fine withone exception. The when typing it doesn't call load on demand only when I scoll down and does not filter based on what the user enteres. Here is the code that is behind the Edit Control.

protected void RadComboBox1_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)

{

IEnumerable<Client> clients = BizLayer.Instance().ClientsGetAllUnfiltered();

var AllClients = from c in clients where c.ClientName.Contains(e.Text) select c;

int itemOffset = e.NumberOfItems;

int endOffset = Math.Min(itemOffset + ItemsPerRequest, AllClients.Count());

e.EndOfItems = endOffset == AllClients.Count();

var filter = AllClients.Skip(itemOffset).Take(ItemsPerRequest);

foreach (Domain.Client c in filter)

{

RadComboBox1.Items.Add(new RadComboBoxItem(c.ClientName.ToString(), c.ClientId.ToString()));

}

e.Message = GetStatusMessage(endOffset, AllClients.Count());

}

Thank you.
Dimitar Terziev
Telerik team
 answered on 06 Apr 2011
1 answer
123 views

I have a Radgrid with button column when I click the button the first time the Radwindow does not open, but it opens on the second click on the same button. I have tried every possible solution in RadAjax but still facing the same problem. I am using Masterpage in this project.

Following are my code in Javascript,Client side and Server side.

//Javascript Code

 
  
function ShowUPExc(partnerid) {
  
                window.radopen("Update.aspx?PartnerID=" + partnerid , "rwUpdateExc");
                return false;
                }

//Client Side Code
  
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgExc">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgExc" />
                    <telerik:AjaxUpdatedControl ControlID="btnUpdate" />
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>   
  
<telerik:RadGrid ID="rgExc" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
                                                    AllowSorting="True" DataSourceID="dsExclusion" GridLines="None" Skin="Outlook"
                                                    Width="100%" ShowGroupPanel="False" AutoGenerateColumns="False" PageSize="2"
                                                    AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
                                                    ShowHeader="true" OnItemDataBound="rgExc_ItemDataBound" OnItemCommand="rgExc_ItemCommand">
                                                    <HeaderContextMenu>
                                                        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                                    </HeaderContextMenu>
                                                    <FilterMenu>
                                                        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                                    </FilterMenu>
                                                    <GroupingSettings ShowUnGroupButton="true" CaseSensitive="false" />
                                                    <MasterTableView DataSourceID="dsExclusion" DataKeyNames="ExcType, StartDate, EndDate"
                                                        PageSize="2" Width="100%" GroupLoadMode="Client" EnableNoRecordsTemplate="true"
                                                        ShowHeadersWhenNoRecords="true" AllowFilteringByColumn="false" AllowMultiColumnSorting="false"
                                                        EnableHeaderContextMenu="false">
                                                         
                                                        <Columns>
                                                            <telerik:GridBoundColumn DataField="ExcType" HeaderText="Exc Type" SortExpression="ExcType"
                                                                UniqueName="ExcType" ReadOnly="True" CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true"
                                                                ShowFilterIcon="false" FilterDelay="4000" Groupable="false" FilterControlWidth="120px"
                                                                HeaderStyle-Width="140px">
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridDateTimeColumn DataField="StartDate" DataType="System.DateTime" HeaderText="Start Date"
                                                                SortExpression="StartDate" UniqueName="StartDate" AutoPostBackOnFilter="true"
                                                                PickerType="DateTimePicker" FilterControlWidth="150px" ItemStyle-Wrap="false"
                                                                HeaderStyle-Width="170px">
                                                            </telerik:GridDateTimeColumn>
                                                            <telerik:GridDateTimeColumn DataField="EndDate" DataType="System.DateTime" HeaderText="End Date"
                                                                SortExpression="EndDate" UniqueName="EndDate" AutoPostBackOnFilter="true" PickerType="DateTimePicker"
                                                                FilterControlWidth="150px" ItemStyle-Wrap="false" HeaderStyle-Width="170px">
                                                            </telerik:GridDateTimeColumn>
                                                            <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" AllowFiltering="false"
                                                                HeaderStyle-Width="120px">
                                                                <ItemTemplate>
                                                                    <asp:Button ID="btnUpdate" runat="server" Text="Update" CommandArgument='<%# DataBinder.Eval(Container,"ItemIndex")%>'
                                                                        CommandName="UpdateExc" />
                                                                </ItemTemplate>
                                                            </telerik:GridTemplateColumn>
                                                        </Columns>
                                                    </MasterTableView>
                                                    <ClientSettings AllowColumnsReorder="False" AllowDragToGroup="False" ReorderColumnsOnClient="False"
                                                        EnableRowHoverStyle="true" EnablePostBackOnRowClick="true" AllowKeyboardNavigation="true">
                                                        <Resizing AllowColumnResize="False" EnableRealTimeResize="False" ResizeGridOnColumnResize="False"
                                                            AllowResizeToFit="true" />
                                                        <Selecting AllowRowSelect="True" />
                                                        <Scrolling AllowScroll="False" UseStaticHeaders="False" SaveScrollPosition="False">
                                                        </Scrolling>
                                                    </ClientSettings>
                                                    <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                                </telerik:RadGrid>
  
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true"
        Skin="Office2007">
        <Windows>
            <telerik:RadWindow ID="rwUpdateExc" runat="server" ShowContentDuringLoad="false"
                ReloadOnShow="true" Title="Update Exclusion Window" Width="750px" Height="350px"
                VisibleStatusbar="false" Modal="true" ToolTip="Update Exclusion">
            </telerik:RadWindow>
             
        </Windows>
    </telerik:RadWindowManager>

//Server Side Code
  
protected void rgExclusion_ItemCommand(object source, GridCommandEventArgs e)
    {
if (e.CommandName == "UpdateExc")
        {
            string strEType;
  
            strEType = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ExcType"].ToString();
  
            if (strEType == "Partner")
            {
                Button btnUExc = (Button)e.Item.FindControl("btnUpdate");
                btnUExc.Attributes["href"] = "#";
                btnUExc.Attributes["onclick"] = String.Format("return ShowUPExc('{0}');", Session["PGEPartnerID"].ToString());
           }
}   
      
}  
Princy
Top achievements
Rank 2
 answered on 06 Apr 2011
4 answers
122 views
Hi there

I'm trying to create a custom Webpart which should work similar to the "Telerik RadEditor for Moss", but with some kind of extended functionality. Also it has to derive from a custom Webpart Base Class which we use in the Project. This base class derives itself from System.Web.UI.WebControls.WebParts.WebPart

I found this tiny bit of documentation here:
http://www.telerik.com/help/aspnet-ajax/moss-radeditor-in-custom-moss-solutions.html

Is there any more documentation about this somewhere, because i don't know  whats is actually needed for the MossRadEditor class to be used within an Weppart. This class is also missing from the API Reference. So i looked with the .net Reflector into the code of the Telerik.SharePoint.RadEditorWebPart, but i'm stuck a little. I don't know what is necesary for me to get it working. Also this WebPart is based on Microsoft.SharePoint.WebPartPages.WebPart which is different somehow.

So far am having a WebPart and a correspondending EditorPart. The Webpart creates a MOSSRadEditor Object, a Literal Control to Show the Content in Display mode, and a Text Field which should save the actuall content.

The EditorPart adds the MOSSRadEditor Objects to the WebPart Controls Collection which works so far. But when i want to save the created content in the ApplyChanges Method of the Editor Part, i can't manage to get the field from which i could read the actual content.

I notice there is some Java Script involved in the RadEditorWebPart class, but i don't know if i need that. Also i'm having trouble setting the ToolsFile Property of the MOSSRadEditor Object. Whenever i do, i get an IO Exception, whereas setting the ConfigFile property is no problem. The File i want to set is definetaly there. I'm using version 5.8.5 of the RadEditorSharepoint.dll
Roger
Top achievements
Rank 1
 answered on 06 Apr 2011
3 answers
155 views
In the project I'm currently working we are trying to reduce the number of server calls we have to do to bind the grid since the data is coming from wcf service which implies some overhead on the overall operation.
Currently for displaying some of the information we are using the Edit Form with a template that only contains read-only fields. Is it possible to make the grid send the HTML code to the client and use a column to expand/collapse the form similar to what is shown in the Grid/Mixed Hierarchy Loading sample?
Thanks in advance for any answer.
Mira
Telerik team
 answered on 06 Apr 2011
3 answers
215 views
Hi
I have set up the editor and linked a toolfile from my menu.
On my aspx page inside the content tag i have inserted the following:

<Content>
<p>Please enter your text</p>
</Content>

 

However when the page is loaded the <p> tags are removed just showing 'Please enter your text'.
Any thoughts would be great.

As a second point if you type into the editor a pound sign in the HTML it shows as '£' rather than &pound;. This is the same for all symbols is there anyway are this?

Thanks in advance
T

Rumen
Telerik team
 answered on 06 Apr 2011
2 answers
96 views
Hi,
Is it possible to minimize distance between node's default image and node's text?   I could not find reletaed style property in TreeView.css file. I attached the screen shot of tree to point the distance I want to narrow.
Thank you,
Kate
Telerik team
 answered on 06 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?