Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
337 views
Hi everyone! I'm working on a WebPart containing a RadGrid created programmatically (by code behind) with a filterchecklist; There are 3 aspects that I would like to ask for help:

1) RadGrid1.MasterTableView.FilterExpression is always an empty String! I need to use it in the handler method for "OnNeedDataSource" to filter the grid:

            String filterExpression = RadGrid1.MasterTableView.FilterExpression;
            DataFiltered = Data.Select(filterExpression, Data.Columns[0].ColumnName + " ASC").CopyToDataTable();
            RadGrid1.DataSource = DataFiltered;

But when i check\uncheck items of checklist or use the "Classic" filter it does not work and is always an empty String.

2) I need for my purpose to check\uncheck the items of the checklist programmatically based on informations that i only know in the code behind; since the attribute Checked for an element of type RadListBoxItem doesn't work, my idea is to save this information within the handler method for OnFilterCheckListItemsRequested, for example within the attribute "Item.value":

        public void RadGrid1_NeedCheckListItems(object sender, GridFilterCheckListItemsRequestedEventArgs e)
        {
          ........
                RadListBoxItem Item = new RadListBoxItem();
                Item.Text =Convert.ToString(Data[row_index][col_index]);
                Item.Value = isFiltered? "FILTER" "NOFILTER";
                e.ListBox.Items.Add(Item);
          ........
        }

In the .aspx page of the webpart, I can check the e.ListBox.Items elements using the following code:

       var gridPrototype = Telerik.Web.UI.RadGrid.prototype;
       gridPrototype._checkListItemsRequestedHandlerOriginal = gridPrototype._checkListItemsRequestedHandler;
       gridPrototype._checkListItemsRequestedHandler = function () {
            this._checkListItemsRequestedHandlerOriginal(); // call the origianl method
            var filterCheckList = $find(this._filterCheckListClientID); // get the check list
            var column = this._checkListFilterActiveColumn.get_uniqueName(); // get the active column
            filterCheckList.get_items().getItem(0).check(); // check the first item for example
       }

How can i access the length of the listbox and the attribute "value" of a single item? My purpose is to scan the listbox until its end (that's why i need the length of this list) and check the attribute "value" of a single item to decide if check or uncheck this RadListBoxItem?
Is it also possible to set the attribute "value" to modify it after you've read it?

3) Less important thing, As you can see in the attached file, what tag i can use in the ".RadFilterMenu_CheckList css class" to make sure that "Cancel" button is alligned with "Apply" button?

Thanks in advance, (unfortunately without the source code i don't know where to find these informations).

Regards,
Carla

Kostadin
Telerik team
 answered on 22 Apr 2014
4 answers
234 views
Hi

I am using RadGrid and I need to export it to email.
I looked in your forums and found this answer:

VB.NET:
01.Private Sub RadGrid1_GridExporting(sender As Object, e As GridExportingArgs) Handles RadGrid1.GridExporting
02. 
03.    If isLoc <> True Then
04. 
05.        Dim ms As New MemoryStream(New UTF8Encoding().GetBytes(e.ExportOutput))
06. 
07.        Dim smtpClient As New SmtpClient()
08.        smtpClient.EnableSsl = True
09. 
10.        Dim mailMessage As New MailMessage()
11.        mailMessage.IsBodyHtml = True
12.        mailMessage.[To].Add(New MailAddress(Session("Email")))
13.        mailMessage.Subject = "Reporting service - Do Not reply"
14.        mailMessage.Body = "This report was sent from <br /><b>Reporting service</b> "
15.        mailMessage.Attachments.Add(New Attachment(ms, "Reporting service" & DocType))
16.        Try
17.            smtpClient.Send(mailMessage)
18.            'Label1.Text = "Message Sent" 
19.            MsgBox("Message Sent")
20.        Catch ex As Exception
21.            'Label1.Text = ex.ToString()
22.            MsgBox("Message not Sent")
23.        End Try
24.         
25.        Response.Redirect(Request.Url.ToString())
26.         
27.         
28. 
29.    End If
30.End Sub


The code in line 25 is not good for my project
because if I use the Response command it does a PostBack.
In my project the PostBack resets user configuration.
And if I delete the Response command, it sends an email and also creates a file in the user's computer.

I want only to send an email without PostBack and without creating a file in the user's computer.
How can I do that?

Thanks,
Daniel.



Daniel
Telerik team
 answered on 22 Apr 2014
1 answer
92 views
Hi

Could you please let me know how to accomplish simple drag and place row in the same grid,  

  <ClientSettings AllowRowsDragDrop="true" AllowColumnsReorder="true" ReorderColumnsOnClient="true">
            <ClientEvents OnRowContextMenu="RowContextMenu" />
                  
            <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
              <Scrolling AllowScroll="true" UseStaticHeaders="true"></Scrolling>

Do i have to maintain any list in codebehind for this? Please let  me know
Shinu
Top achievements
Rank 2
 answered on 22 Apr 2014
1 answer
102 views
Hello, I am working with vb .net and within an existing project that uses telerik, i imported some user controls.

My hope is to convert existing controls to rad controls, however when adding a rad button...or any control..
I get the following error

"The Controls collection cannot be modified because the control contains code blocks"

steps i have taken to try to correct issue are as follows.
1.  I changed <%= to <#=
2.  wrapped JavaScript around a RadCodeBlock
3. Attempted a radscriptmanger but i already have one declared so error occurs. 

I do not know what to try at this point.
As expressed this is an existing project, the only thing that might be a curveball is.
This imported code is called from a radwindow and is created as a modal window.
Within the aspx page, are the user controls that i am attempting to replace existing with telerik.

When a radwindow is open, do i lose anything that i must declare again?
As expressed it is aware of the script manager. 

What could i be missing? At wits end.

Thank you



Princy
Top achievements
Rank 2
 answered on 22 Apr 2014
9 answers
360 views
Hi Telerik user,

I have tried to implement export to excel functionality in radgrid but encounter issue with filename setting.
From the file download window after I fire exportToExcel() function from javascript:
When I click on open, the filename is not shown correctly (It shows page name instead of filename) but
When I click on save and put the file in a folder and then open the file, it shows correct filename.

I have tried to put filename as a parameter to exportToExcel(filename) but it is still showing incorrect filename.

Here is my code snippet:

<script type="text/javascript" language="javascript">  
    function Export() {  
        var masterTable = $find('RadGrid1').get_masterTableView();  
        if (masterTable != null)  
            masterTable.exportToExcel();  
    }  
</script> 
 
        <telerik:RadGrid ID="RadGrid1" ShowStatusBar="True" Height="360px" 
            runat="server" AutoGenerateColumns="False" AllowSorting="false"   
            GridLines="None" ShowFooter="false" EnableDrag="false" 
            OnNeedDataSource="RadGrid1_NeedDataSource" ExportSettings-FileName="NostroTransfer" 
            OnItemDataBound="RadGrid1_ItemDataBound"

Please share if you have ever encountered this issue.

Regards,
Canfield
Daniel
Telerik team
 answered on 22 Apr 2014
5 answers
86 views
hey every one
i am using web http://demos.telerik.com/aspnet-ajax/webmail problem is that if net connection not availble the whole website has been crashed . In an Attachment is the output of crash web, how to fix this. please help me 

thanks in advance.
Plamen
Telerik team
 answered on 22 Apr 2014
3 answers
474 views
Hello,
My application is already using Telerik radgrid and I need to implement Batch Editing on it.
See the following .ascx code:
<telerik:RadGrid ID="dgEscrow" runat="server" GridLines="None" EnableEmbeddedSkins="false" AutoGenerateColumns="false" ShowFooter="true" CssClass="esGridTable">
    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
    <ClientSettings>
        <ClientEvents OnGridCreated="setScrollerDimensionsEscrow" />
        <Scrolling AllowScroll="true" SaveScrollPosition="true" />
    </ClientSettings>
</telerik:RadGrid>

See the followinng .ascx.vb code:
Public Sub BindDG(Optional ByVal isPrintPage As Boolean = False)
        Dim edt As New EscrowDataTable(TractGID)
        Dim dt As DataTable = edt.GetDataTable
        Dim dv As DataView = dt.DefaultView
 
         With dgEscrow
            .CellSpacing = 0
            .ItemStyle.CssClass = "esGridRow"
            .AlternatingItemStyle.CssClass = "esGridRow"
        End With
 
 
        dgEscrow.DataSource = dv
        dgEscrow.DataBind()
    End Sub


On the above scenario, I need to implement Batch Editing but needs to be done all on the code behind because the number of columns and the column type may vary every time.

Please let us know if you guys need any more details.

Thanks,
Shouvik
Konstantin Dikov
Telerik team
 answered on 22 Apr 2014
1 answer
137 views
 <telerik:RadListBox ID="lbDSNominal" runat="server" Width="250px" BackColor="#2D1A44" SelectionMode="Multiple" AllowTransfer="true" AutoPostBackOnTransfer="true" TransferMode="Copy"
                                                    AllowReorder="true" AutoPostBackOnReorder="true" EnableDragAndDrop="true" Skin="" CssClass="list contents_2" TransferToID="lbStrata" OnTransferred="lbDSNominal_Transferred">
                                                    <ItemTemplate>
                                                        <p style="font-size: 15px !important; width: auto; height: auto; color: white; padding-bottom: 0px !important; margin-bottom: 0px !important; margin-top: 0px !important;"><%# Container.DataItem %></p>
                                                    </ItemTemplate>
                                                </telerik:RadListBox>

<telerik:RadListBox ID="lbStrata" runat="server" SelectionMode="Multiple" AllowReorder="true" AutoPostBackOnReorder="true" EnableDragAndDrop="true"
                                                            Skin="" Width="260px" Height="150px" AllowTransfer="true" AutoPostBackOnTransfer="true" BorderColor="MediumPurple" BackColor="#f2eff5">

                                                            <ItemTemplate>
                                                                <div class="variables-list">
                                                                    <span><%# Container.DataItem %></span>
                                                                </div>
                                                            </ItemTemplate>
                                                        </telerik:RadListBox>

here is my code. I bind a list<String> to lbDSNominal's datasource. and I show data using <%# Container.DataItem %> in lbDSNominal. When I dragged an item to lbStrata in lbStrata itemtemplate, <%# Container.DataItem %> doesn't show any value? How can I fix it?


Princy
Top achievements
Rank 2
 answered on 22 Apr 2014
1 answer
78 views
Hi,

I want to load user control as view mode of row on row click. Like how we open user control of edit mode on row.

I am using Edit button in grid which is opening ~/UserControls/Issues_View_ActionItems.ascx user control as edit mode of row now i just want to open
~/UserControls/Issues_Edit_ActionItems.ascx user control on Row Click.


  <telerik:GridEditCommandColumn UniqueName="EditColumn" HeaderText="Edit" ButtonType="ImageButton">
                                    <HeaderStyle Width="15px"></HeaderStyle>
                                    <ItemStyle Width="15px" HorizontalAlign="Center"></ItemStyle>
                                </telerik:GridEditCommandColumn>



    <EditFormSettings UserControlName="~/UserControls/Issues_View_ActionItems.ascx" EditFormType="WebUserControl">
                                <EditColumn UniqueName="EditColumn">
                                </EditColumn>
                            </EditFormSettings>

Thanks
Manish
Shinu
Top achievements
Rank 2
 answered on 22 Apr 2014
12 answers
134 views
Any possibility to connect RadTileList with RadDataPager in order to create paging for TIles?
Shinu
Top achievements
Rank 2
 answered on 22 Apr 2014
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?