Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
71 views

Hello,

 

I have a radgrid where I added a button in the ItemCreated event for the grid.

 

<p>if (e.Item is GridCommandItem)<br>            {<br>                ImageButton b = new ImageButton();<br>                b.ID = "Export";<br>                b.ImageUrl = "images/excel.png";</p><p>b.CommandName = "Export";</p><p>e.Item.Controls[0].Controls[1].Controls.Add(b);<br>            }</p>

 

When the image is clicked it calls the ItemCommand event:

protected void grdInventory_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)<br>        {<br>            if (e.CommandName == "Export")<br>            {<br>                 //do stuff<br> }<br>        }

 

I want to capture the filters or grouping for that grid and export them to excel in that event.  I'd also like to ignore the paging.  I know there is a default exportToExcel button for these grids, but I need to export to a template.  Therefore, I want to write custom code in the ItemCommand event.  Unless there is something built into radgrid that will allow me to export the results to a predefined template?

 

Thanks!

 

 

 

 

Eyup
Telerik team
 answered on 05 Sep 2016
0 answers
62 views

Hi All,

Reason why I wanted to preview it with img tag for I have a special CSS that is attached to it (I have no issue when I preview it with RadImageEditor).

<script type="text/javascript">
    var imageUploaded = false;
    function OnClientFilesUploaded(sender, args) {
      $find('<%=RadAjaxManager1.ClientID %>').ajaxRequest();
      imageUploaded = true;
  }
</script>

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="false">
  <AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
      <UpdatedControls>
         <telerik:AjaxUpdatedControl ControlID="imgProfile" />
      </UpdatedControls>
    </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

 

<img id="imgProfile" runat="server" alt="Profile" src="..\default.jpg" />
<telerik:RadAsyncUpload ID="AsyncUpload1" runat="server"
  OnClientFilesUploaded="OnClientFilesUploaded"    
  OnFileUploaded="AsyncUpload1_FileUploaded"
  MaxFileSize="1024000" AllowedFileExtensions="jpg,png,gif,bmp"
  AutoAddFileInputs="false" Localization-Select="Upload" />

Protected Sub AsyncUpload1_FileUploaded(sender As Object, e As FileUploadedEventArgs)
 
        Using stream As Stream = e.File.InputStream
            Dim imgData As Byte() = New Byte(stream.Length - 1) {}
            stream.Read(imgData, 0, imgData.Length)
            Dim ms As New MemoryStream()
            ms.Write(imgData, 0, imgData.Length)
            Context.Cache.Insert(Session.SessionID + "UploadedFile", ms, Nothing, DateTime.Now.AddMinutes(20), TimeSpan.Zero)
        End Using
 
''Code for updating Img src???
        
    End Sub

 

I did try to save first the file to a folder and then use the path for the img src but its not reflecting. I still need to do refresh just to make my img update its image.

I hope anyone can suggest for better solution.

 

Thanks in advance,

RJ

RJ
Top achievements
Rank 1
 asked on 02 Sep 2016
5 answers
646 views
Here's the scenario;

We'd like to allow the user to select an image, upload it. Once uploaded, we'd like to look at the dimensions and resize it so that the maximum dimension (either height or width) is 1000 px, and then save it as a stream into a database column. We don't want the user to have any additional editing capability with the image.

Wondering whether the RadImageEditor is the appropriate tool for this? We're trying to avoid using other libraries such as the system.graphics library.

Any suggestions?
RJ
Top achievements
Rank 1
 answered on 02 Sep 2016
8 answers
219 views
I have three key questions regarding the "All Fields" list in the Configuration Panel for RadPivotGrid.

1. For a DateTime field, is it possible to control the options that appear?  I have a DateTime field and the valid values for this field are month beginning dates (e.g. Jan 1 2014, Feb 1 2014, etc).  They drive some monthly reporting that is shown in the PivotGrid.  But in my field chooser I automatically also get Year, Quarter, Month, Week, Day, Hour, Minute, and Second -- which I don't want.  I have searched but can't seem to find a way to suppress them.  Is this possible?  If so, how?

2.  Regarding the rest of the fields -- can I order them how I like after they have been added to the All Fields list (so that the ordering is just shown in the All Fields list)?  I am hoping to be able to sort them alphabetically for easy reference.

3.  If a field exists in a DataTable that is the DataSource for the PivotGrid, is there a way I can exclude that field from the All Fields list?

I think these questions should be pretty straightforward.   If needed, however, I *can* provide a working solution which illustrates them.

Thanks -
Erik Dahl
Kostadin
Telerik team
 answered on 02 Sep 2016
5 answers
99 views
I am working with the latest version of the controls, using the HTMLChart for a Pie Chart and I cannot locate or use the old "DiameterScale" property anywhere - has this property been removed?  Is there any way still to determine what area of the total chart is filled by the "pie"?
Danail Vasilev
Telerik team
 answered on 02 Sep 2016
1 answer
212 views

The code  used is from already posted here. http://www.telerik.com/forums/excel-like-filtering-doesn't-fire-the-filterchecklistitemsrequested-event

The problem is I have got Excel like filtering to work for the radgrid But if I have a column already filtered in the radgrid and then another column is clicked for filtering then the dropdown should display onlt the distinct values from the already filtered values.But this doesn't seem to happen. It shows all the distinct values of the particular column even though it is not being display currently.

 

This behavior is correct with what is being shown in this demo https://demos.telerik.com/aspnet-ajax/grid/examples/functionality/filtering/excel-like-filtering/defaultcs.aspx

 I can see the when the apply/Clear filter is selected this data is being postback to the server. Can you tell me how I can get the column name and field so that I can store them and get the unique data from the filter conditions already set.

Can you suggest on how to achieve this functionality.

Thanks.

Kostadin
Telerik team
 answered on 02 Sep 2016
10 answers
275 views

With the RadNavigation, is there a way to control the height of the dropdowns for when the nodes are not in the more Menu (sandwich button) and controlling the height of the dropdown for the more Menu (sandwich button)?

 

Sincerely,

Keith Jackson

Ivan Danchev
Telerik team
 answered on 02 Sep 2016
5 answers
429 views
Hi,

Can you please help with following issue:
I'm using RadImageEditor to edit images from simple image gallery. But, when made any changes (crop, brush, or any other action) on Image Saving, those changes were not saved.

Rad Image Editor is defined as :

<telerik:RadImageEditor ID="rieImageEditor" runat="server" Width="760px" Height="560px" OnImageSaving="rieImageEditor_SaveImage" AllowedSavingLocation="Server" OnClientCommandExecuting="OnClientCommandExecuting">
</telerik:RadImageEditor>

it's defined inside RadWindow which is inside RadAjaxPanel.

OnClientCommandExecuting is created to avoid "Save" dialog, because it's only need to save changed content back to DB (not to change image name nor to select destination)
In "OnImageSaving" I'm taking image data :

EditableImage img = e.Image;
MemoryStream imgstream = new MemoryStream();
img.Image.Save(imgstream, img.RawFormat);

Memory stream is the data which I save back in DB.

This is my scenario:

1. Image content is load from database to the editor and it's displayed correctly
2. Do some actions on the image (crop, draw...)
3. Click "Save" button in RadImageEditor
4. On Close on RadWindow which contains RadImageEditor there is postback just to refresh image gallery

there are some cases when OnImageSave event is not even launched. But, even if it's launched, it does not save the changes.

Also for all actions there is information in status bar of the editor what's done (as "Last Action"), but there is no feedback after saving - user is no aware if image is saved correctly or not.

First, can you please help me, how to save changes made in the editor.
Second, can you please tell me how to return feedback to the user if there were some errors during saving or not.

Thanks in advance,
Regards,
Stefan
Niko
Telerik team
 answered on 02 Sep 2016
3 answers
696 views

Hi,

I have 4 tabs in my wizard loaded in user controls. On the first tab, based on a selection, I want to disable the next button to stop the user from going any further.

How can I achieve that?

Rumen
Telerik team
 answered on 02 Sep 2016
4 answers
353 views

Hi

I am trying to bind some sql data to a grid. Quite simple really. Most datatypes seem to work except GridCheckBoxColumn 

I have a bit field in sql server (all values populated). I am binding to radgrid with a datasource (LLBLGenProDataSource2) using GridCheckBoxColumn.

No  data is displayed for the checkbox column . If I bind using GridBoundColumn however it shows up! (True/False) as text

fails to show

                <telerik:GridCheckBoxColumn UniqueName="GridCheckBoxColumn" DataField="IsEnabled" HeaderText="Fails" DataType="System.Boolean" >
                </telerik:GridCheckBoxColumn>

shows up
                <telerik:GridBoundColumn DataField="IsEnabled" HeaderText="Works" UniqueName="NewIs" DataType="System.Boolean">                 
                </telerik:GridBoundColumn>

If I examine the value in the RadGrid1_ItemDataBound event it is empty (&nbsp;) for the GridCheckBoxColumn but shows True for the GridBoundColumn 

It seems odd? I can see some of your demos working with a GridCheckBoxColumn , could it be there is a different interpretation of what makes a boolean when reading from the datasource?

Your help apprciated

 

I am using the Q2 2016 sp1, VS2015 Windows 7, Chrome

 

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <telerik:RadGrid ID="RadGrid1" runat="server"
        OnItemCommand="RadGrid1_OnItemCommand"
        OnItemDataBound="RadGrid1_ItemDataBound"
        OnItemCreated="RadGrid1_ItemCreated1"
        PagerStyle-PageButtonCount="5"
        AutoGenerateColumns="false"
        DataKeyNames="OrganisationId"
        AllowPaging="True"
        AllowSorting="True"
        ShowGroupPanel="True"
        RenderMode="Auto"
        EnableLinqExpressions="false"
        AllowFilteringByColumn="True"
        AutoGenerateEditColumn="True"
        AutoGenerateDeleteColumn="True"
        DataSourceID="LLBLGenProDataSource1">
        <GroupingSettings ShowUnGroupButton="true" />

        <ExportSettings ExportOnlyData="true" IgnorePaging="true"></ExportSettings>
        <MasterTableView AllowAutomaticInserts="true"
            AllowAutomaticUpdates="true"
            AllowAutomaticDeletes="true"
            AllowFilteringByColumn="true"
            AutoGenerateColumns="False"
            EditMode="PopUp"
            TableLayout="Fixed"
            CommandItemDisplay="Top"
            InsertItemPageIndexAction="ShowItemOnFirstPage"
            DataSourceID="LLBLGenProDataSource1"
            RetrieveDataTypeFromFirstItem="true"
            DataKeyNames="OrganisationId">
            <EditFormSettings CaptionFormatString="Edit Organisation: {0}" CaptionDataField="DisplayText" PopUpSettings-Width="600px" />

            <CommandItemSettings ShowExportToCsvButton="true" ShowExportToExcelButton="true" ShowExportToPdfButton="true" ShowExportToWordButton="true" />

            <Columns>
                <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name"
                    UniqueName="Name" AutoPostBackOnFilter="true" DataType="System.String">
                    <HeaderStyle Width="250px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Email" HeaderText="Email" SortExpression="Email"
                    UniqueName="Email" ReadOnly="true" DataType="System.String">
                    <HeaderStyle Width="250px" />
                </telerik:GridBoundColumn>
                <telerik:GridDropDownColumn DataSourceID="LLBLGenProDataSourceType" ListTextField="DisplayText" ListValueField="OrganisationTypeId"
                    UniqueName="OrganisationTypeId" HeaderText="DropDown Column" DataField="OrganisationTypeId"
                    AllowAutomaticLoadOnDemand="true"
                    AllowVirtualScrolling="true" ShowMoreResultsBox="true" ItemsPerRequest="10" DropDownControlType="DropDownList">
                </telerik:GridDropDownColumn>
                <telerik:GridCheckBoxColumnUniqueName="GridCheckBoxColumn" DataField="IsEnabled" HeaderText="Fails" DataType="System.Boolean" >
                </telerik:GridCheckBoxColumn>
                <telerik:GridBoundColumnDataField="IsEnabled" HeaderText="Works" UniqueName="NewIs" DataType="System.Boolean">                
                </telerik:GridBoundColumn>

                <telerik:GridHTMLEditorColumn EditFormColumnIndex="0" UniqueName="Notes" SortExpression="Notes" HeaderText="HTMLEditor Column"
                    DataField="Notes" HeaderStyle-Width="200px" DataType="System.String">
                </telerik:GridHTMLEditorColumn>
                <telerik:GridDateTimeColumn UniqueName="DOB" PickerType="DatePicker" HeaderText="DOB"
                    DataField="DOB" DataFormatString="{0:d}"
                    EditDataFormatString="d" DataType="System.DateTime">
                </telerik:GridDateTimeColumn>
                <telerik:GridTemplateColumn HeaderText="Attachment" UniqueName="UploadTemplateColumn">
                    <ItemTemplate>
                        <asp:LinkButton ID="DownloadButton" runat="server" CommandName="DownloadFileAttachment"
                            Text="Download">
                        </asp:LinkButton>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadAsyncUpload ID="ImportantDocUpload" EnableInlineProgress="true" runat="server" AllowedFileExtensions=".doc,.docx,.xls,.xlsx,.pdf,.ppt,.pptx" MaxFileSize="4000000">
                        </telerik:RadAsyncUpload>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Pic" UniqueName="UploadPic">
                    <ItemTemplate>
                        <asp:Image runat="server" ID="OrgPic" ImageUrl='<%# string.Format(@"{0}.emfile?d={0}",Eval("AvatarImageId")) %>' Height="48" Width="48" />

                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadAsyncUpload ID="PicUpload" EnableInlineProgress="true" runat="server" AllowedFileExtensions=".png,.jpg,.gif" MaxFileSize="4000000">
                        </telerik:RadAsyncUpload>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="ImportantDocId" Display="false" ReadOnly="true" UniqueName="ImportantDocId" DataType="System.Guid">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="AvartarImageID" Display="false" ReadOnly="true" UniqueName="PicID" DataType="System.Guid">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings AllowColumnsReorder="true" AllowColumnHide="true" AllowDragToGroup="false">
            <Selecting AllowRowSelect="true" />
            <Scrolling AllowScroll="true" UseStaticHeaders="true" />
            <ClientEvents OnPopUpShowing="PopUpShowing" />
        </ClientSettings>
        <PagerStyle PageButtonCount="5" />
        <FilterMenu RenderMode="Auto">
        </FilterMenu>
        <HeaderContextMenu RenderMode="Auto">
        </HeaderContextMenu>
    </telerik:RadGrid>

    <llblgenpro:LLBLGenProDataSource2 ID="LLBLGenProDataSource1" LivePersistence="true" runat="server"
        AdapterTypeName="ExamMeisterDataLayer.DatabaseSpecific.DataAccessAdapter, ExamMeisterDataLayerDBSpecific"
        DataContainerType="EntityCollection"
        EntityFactoryTypeName="ExamMeisterDataLayer.FactoryClasses.OrganisationEntityFactory, ExamMeisterDataLayer"
        OnPerformSelect="LLBLGenProDataSource1_PerformSelect"
        OnPerformGetDbCount="LLBLGenProDataSource1_PerformGetDbCount"
        OnPerformWork="LLBLGenProDataSource1_PerformWork"
        OnEntityInserting="LLBLGenProDataSource1_OnEntityInserting"
        OnEntityUpdating="LLBLGenProDataSource1_OnEntityUpdating"
        CacheLocation="ASPNetCache"
        EnablePaging="false">
    </llblgenpro:LLBLGenProDataSource2>
    <llblgenpro:LLBLGenProDataSource2 ID="LLBLGenProDataSourceType" LivePersistence="true" runat="server"
        AdapterTypeName="ExamMeisterDataLayer.DatabaseSpecific.DataAccessAdapter, ExamMeisterDataLayerDBSpecific"
        DataContainerType="EntityCollection"
        EntityFactoryTypeName="ExamMeisterDataLayer.FactoryClasses.OrganisationTypeEntityFactory, ExamMeisterDataLayer"
        CacheLocation="ASPNetCache"
        EnablePaging="false">
    </llblgenpro:LLBLGenProDataSource2>
    <llblgenpro:LLBLGenProDataSource2 ID="LLBLGenProDataSourceUpload" LivePersistence="true" runat="server"
        AdapterTypeName="ExamMeisterDataLayer.DatabaseSpecific.DataAccessAdapter, ExamMeisterDataLayerDBSpecific"
        DataContainerType="EntityCollection"
        EntityFactoryTypeName="ExamMeisterDataLayer.FactoryClasses.DocViewWithDataEntityFactory, ExamMeisterDataLayer"
        OnEntityInserting="LLBLGenProDataSourceUpload_OnEntityInserting"
        OnEntityUpdating="LLBLGenProDataSourceUpload_OnEntityUpdating"
        CacheLocation="ASPNetCache"
        EnablePaging="false">
    </llblgenpro:LLBLGenProDataSource2>
    <telerik:RadCodeBlock runat="server">
        <script type="text/javascript">
            function onRequestStart(sender, args) {
                if (args.get_eventTarget().indexOf("Button") >= 0) {
                    args.set_enableAjax(false);
                }
            }
        </script>
    </telerik:RadCodeBlock>

Tim Titchmarsh
Top achievements
Rank 2
 answered on 02 Sep 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?