Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
470 views
 hi 
i have grid in batch mode and a button . in button i want delete selected row in grid in client side without send request to server and post back page.
what should i do?
thank you
LACDA-IT
Top achievements
Rank 1
 answered on 19 Mar 2015
0 answers
113 views
On several occasions I have had the need to send specific information to sub controls or Custom Edit forms when using Rad Grids.  I have seen in the forums that others have had this same issue.  However I have not seen any solutions to this issue. I have come up with two solutions that seem to work well.

------------------------------------------------------------------------
The first solution is the use of Attributes:

From the RsdGrid.ItemCommand handlerFor example I need to pass an ID to the edit form so that It knows what data to present. I also use multiple edit forms depending on the insert button selected. 

Case Telerik.Web.UI.RadGrid.InitInsertCommandName

               e.Canceled = True

               RDG_List.EditIndexes.Clear()

               Me.Attributes.Add("CompanyID", CompanyID.ToString)

                e.Item.OwnerTableView.EditFormSettings.UserControlName = GT.Constant.Screen.GTCS0958_Security.ScreenCommonName

               e.Item.OwnerTableView.InsertItem()

 

 

In the Page load of the
web user control for the edit form I do the following:

 

If ChildControlsCreated = False Then

 If (TypeOf DataBinder.Eval(Parent.BindingContainer,"DataItem.RowID") Is System.DBNull) Then        
' in insert mode        
CompanyID = CLng(CType(Parent.TemplateControl, System.Web.UI.UserControl).Attributes("CompanyID"))

 
End if
End if

 

Note: You may have to
play with the parent pointer till you find you original control because the
parent is sometimes a grid table value not the original control.

 

 --------------------------------------------------------------------------------------------

The Second solution is adding columns to the table:

This method only works if you are editing a row that exists in the table. For an insert you do not pass any Parent.BindingContainer data so it will not work, hence the need for the first method. In my work I use data tables. In this case I want to pass a flag that tells the control to show different entry fields. When you press the edit row button on the grid it kicks off the needdatasource function prior to opening the custom edit form.

In the
RadGrid.NeedDataSource  handler

Dim DataTable As System.Data.DataTable 
-- call some function to get the data into the datatable

DataTable.Columns.Add("ShowMemberRelationshipInfo", System.Type.GetType("System.Boolean")) 

Dim v As Boolean = ShowMemberRelationshipInfo

For Each r In DataTable.Rows   
r("ShowMemberRelationshipInfo") = v

Next 

RadGrid.DataSource = DataTable   

In the Custom Edit Form simply read the data as you do normally in the page load.  

ShowMemberRelationshipInfo = CBool(DataBinder.Eval(Parent.BindingContainer, "DataItem.ShowMemberRelationshipInfo")) 

 
Rich
Top achievements
Rank 1
 asked on 19 Mar 2015
3 answers
97 views
I get the following error, when I click on the RadComboBox to get the items :

The target 'ctl00$MainContent$grdAlum&ctl00$ctl05$EditFormControl$cmbUnPrLot' for the callback could not be found or did not implement ICCallbackEventHandler



Here is the relative code.

.aspx
 <telerik:RadScriptManager ID="RadScriptManager1"
    EnablePageMethods="true" runat="server">
    <Services>
      <asp:ServiceReference Path="~/SessionAccessService.asmx" />
    </Services>
  </telerik:RadScriptManager>
  <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="false" />
  <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All"
    EnableRoundedCorners="false" />
  <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
  <script type="text/javascript">
...
  </script>

  </telerik:RadCodeBlock>
  <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
      <telerik:AjaxSetting AjaxControlID="grdDetails">
        <UpdatedControls>
          <telerik:AjaxUpdatedControl ControlID="grdDetails"
            LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
        </UpdatedControls>
      </telerik:AjaxSetting>
    </AjaxSettings>
  </telerik:RadAjaxManager>

  <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
  </telerik:RadAjaxLoadingPanel>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
    </telerik:RadWindowManager>

...

          <telerik:RadGrid ID="grdAlum" runat="server"
            Width="550px" Height="200px"
            AllowPaging="True" PageSize="4"
            PagerStyle-PageSizeControlType="None"
            ShowFooter="true"
            PagerStyle-PageButtonCount="4" AutoGenerateColumns="False"
            OnUpdateCommand="grdAlum_UpdateCommand"
            OnItemDataBound="grdAlum_ItemDataBound"
            OnNeedDataSource="grdAlum_NeedDataSource"
            AllowAutomaticInserts="false"
            ShowStatusBar="false" Skin="Vista">

            <MasterTableView Width="100%" CommandItemDisplay="none"
              DataKeyNames="ODUA_ID, ODUA_Itm_ID, ODUA_Lot_ID"
              CommandItemSettings-AddNewRecordText="" AllowSorting="False"
              CommandItemSettings-ShowRefreshButton="False"
              CommandItemSettings-AddNewRecordImageUrl=""
              CommandItemStyle-HorizontalAlign="center"
              CommandItemStyle-BorderStyle="None">

              <EditFormSettings UserControlName="OrderAlum.ascx"
                EditFormType="WebUserControl">
                <EditColumn ButtonType="ImageButton" />
                <PopUpSettings Width="550px" Modal="true" />
              </EditFormSettings>

              <Columns>
...
            </Columns>
            </MasterTableView>
            <ClientSettings Selecting-AllowRowSelect="true" EnableRowHoverStyle="true">
              <Scrolling AllowScroll="True" UseStaticHeaders="True"
                SaveScrollPosition="true"></Scrolling>
              <ClientEvents OnRowDblClick="RowDblClick" OnRowClick="RowClick" />
            </ClientSettings>
          </telerik:RadGrid>


OrderAlum.ascx
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="OrderAlum.ascx.vb"
  Inherits="EditFormOrderAlum.OrderAlum" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="false" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
</telerik:RadAjaxLoadingPanel>


<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
</telerik:RadWindowManager>

<asp:Table.......

<telerik:RadComboBox runat="server" ID="cmbUnPrLot"
        Height="190px" Width="320px" Skin="Vista"
        EnableLoadOnDemand="true" ItemsPerRequest="5"
        DataTextField="Lot_Number" DataValueField="Inv_ID" 
        HighlightTemplatedItems="true" ExpandDelay="0"
        ExpandAnimation-Duration="0" CollapseAnimation-Duration="0"
        CollapseDelay="0" LoadingMessage="Loading ..." 
        OnItemsRequested="cmbUnPrLot_ItemsRequested">
      </telerik:RadComboBox>


OrderAlum.ascx.vb

Imports System.Data.SqlClient
Imports System
Imports System.Data
Imports System.Collections
Imports System.Web.UI
Imports Telerik.Web.UI

Namespace EditFormOrderAlum

  Class OrderAlum
    Inherits System.Web.UI.UserControl
    Implements INamingContainer

    Private _dataItem As Object = Nothing

#Region "Web Form Designer generated code"

    Protected Overrides Sub OnInit(ByVal e As EventArgs)
      InitializeComponent()
      MyBase.OnInit(e)
    End Sub

    Private Sub InitializeComponent()
      AddHandler DataBinding, AddressOf Me.OrderAlum_DataBinding
    End Sub

#End Region

    Protected Sub Page_Load(sender As Object, e As EventArgs)
    End Sub

    Public Property DataItem() As Object
      Get
        Return Me._dataItem
      End Get
      Set(ByVal value As Object)
        Me._dataItem = value
      End Set
    End Property

    Protected Sub cmbUnPrLot_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
      Dim SQLSelectCommand As SqlCommand
      Dim SQLDBConnString As String = ConfigurationManager.ConnectionStrings("NewERPConnectionString").ToString()
      Dim SQLDBConn As New SqlConnection(SQLDBConnString)
      SQLDBConn.Open()
      SQLSelectCommand = New SqlCommand("dbo.spGetUnPrAlumLots", SQLDBConn)
      SQLSelectCommand.CommandType = CommandType.StoredProcedure
      SQLSelectCommand.Parameters.AddWithValue("@Lot_Itm_ID", ddlUnPrItemCode.SelectedValue.ToString)
      Dim dt As New DataTable()
      Dim adp As New SqlDataAdapter
      adp.SelectCommand = SQLSelectCommand
      adp.Fill(dt)

      For Each dataRow As DataRow In dt.Rows
        Dim item As New RadComboBoxItem()
        item.Text = DirectCast(dataRow("Lot_Number"), String)
        item.Value = dataRow("Inv_ID").ToString()
        Dim InvQty As Decimal = DirectCast(dataRow("Inv_Quantity"), Decimal)
        Dim InvLoc As Long = DirectCast(dataRow("Inv_Lov_ID"), Long)
        item.Attributes.Add("Inv_Quantity", InvQty.ToString())
        item.Attributes.Add("Inv_Lov_ID", InvLoc.ToString())
        '        item.Value += ":" + unitPrice.ToString()
        cmbUnPrLot.Items.Add(item)
        item.DataBind()
      Next
    End Sub

    Protected Sub OrderAlum_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
......


I would appreciate any help - Thanks
Viktor Tachev
Telerik team
 answered on 19 Mar 2015
7 answers
207 views
This is a simple use of RadMediaPlayer and I'm totally confused why it doesn't work:

        <telerik:RadMediaPlayer id="rmpMediafiles" runat="server">
        </telerik:RadMediaPlayer>

This is my JavaScript function that sets the Media Player's source:

function OpenMediaModal(MediaPath)
{
var rmpMediafiles = $find('<%=rmpMediafiles.ClientID %>');
rmpMediafiles.set_source(MediaPath);
}

It gives me error that this object has no method 'set_source'. I can not find my problem here!
Eyup
Telerik team
 answered on 19 Mar 2015
3 answers
114 views
I using RadAsyncUpload control and upload file by automatic after select file in "choose file to upload" dialog or drag and drop files to drop zone. I found file name at target folder not same original file name or cannot read.
Sample see attached image. Original file name is "SelfUpdatingLauncher.zip but in target folder is "1426758505493SelfUpdatingLauncher.zip".
Please advice.

Hristo Valyavicharski
Telerik team
 answered on 19 Mar 2015
8 answers
188 views
Hello All,

Presently I am having a telerik radgrid with a commanditem template above the grid header for some extra  information.But the problem is that while exporting to CSV , the header information inside the commandItem template is not being exported.However the export is working just fine with PDF and Excel .Here is the code I am using.


 <telerik:RadGrid ID="ModifiedContentsReportGrid" runat="server" AutoGenerateColumns="false"
                AllowSorting="true" AllowPaging="true" EnableOutsideScripts="true" PagerStyle-Mode="NextPrevAndNumeric"
                ShowFooter="true" OnItemCreated="ModifiedContentsReportsGrid_OnItemCreated" Title="Modified Content Report"
                Height="100%" ExportSettings-ExportOnlyData="false" 
                EnableViewState="true">
                <ItemStyle BackColor="transparent" />
                <AlternatingItemStyle BackColor="#F9F9F9" />
                <ExportSettings OpenInNewWindow="true" FileName="Modified Content Report" ExportOnlyData="false" >
                    <Pdf PaperSize="A4" AllowPrinting="true" PageBottomMargin="10px" PageTopMargin="25px"
                        PageHeaderMargin="0px" PageLeftMargin="10px" PageRightMargin="10px" PageTitle="Modified Content Report" />
                </ExportSettings>
                <HeaderStyle HorizontalAlign="Center" />
                <ClientSettings>
                    <Scrolling UseStaticHeaders="true" />
                </ClientSettings>
                <MasterTableView Width="100%" CommandItemDisplay="Top" CommandItemStyle-HorizontalAlign="Right"
                    TableLayout="Fixed">
                    <CommandItemTemplate>
                        <asp:Literal runat="server"><b>Account Name :</b></asp:Literal>
                        <asp:Label ID="lblClientName" runat="server" /><br />
                        <asp:Literal runat="server"><b>Report generated on :</b></asp:Literal>
                        <asp:Label ID="lblGenerateDate" runat="server" /><br />
                        <asp:Literal runat="server"><b>Date Range :</b></asp:Literal>
                        <asp:Label ID="lblDateRange" runat="server" />
                    </CommandItemTemplate>
                    <Columns>
                        <telerik:GridBoundColumn DataField="Name" SortExpression="Name" HeaderText="Content File"
                             SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="30%">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Location" SortExpression="Location" HeaderText="Location"
                            SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="30%">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Project/Folder" SortExpression="Project/Folder"
                            HeaderText="Project/Folder" SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="10%">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Document" SortExpression="Document" HeaderText="Document"
                            SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="10%">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Section" SortExpression="Section" HeaderText="Section"
                            SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="10%">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="JobNumber" SortExpression="JobNumber" HeaderText="Job Number"
                            SortAscImageUrl="/Images/SortAsc.gif" SortDescImageUrl="/Images/SortDesc.gif"
                            ItemStyle-Width="10%">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <NoRecordsTemplate>
                        <asp:Literal runat="server">
                    No records to display.</asp:Literal>
                    </NoRecordsTemplate>
                </MasterTableView>
                <PagerStyle Mode="NextPrevAndNumeric" />
            </telerik:RadGrid>

Can anyone provide some some inputs or solution to this problem?

Maria Ilieva
Telerik team
 answered on 19 Mar 2015
5 answers
556 views
I have form designer that allows users to create any form they want the will then be used as a member form.  The member form is then used to join a group.  All this is working fine (except for a problem with RadDropDownList) and I have many members in the test database.  I now wish to use the grid to display the users in a group member list for member management.

The problem I cannot solve is how to create the source with data for the grid.  Every example I can find seems to know all its columns in advance.  I actually do not know any of my columns in advance.  I have a list of form rows that each have a name with a type and the ability to populate instances of the list. 

I would also like to create a column selector. I wonder if there are any examples of that around.

Thanks,
George
Eyup
Telerik team
 answered on 19 Mar 2015
9 answers
389 views
I am getting this exception intermittently when binding a RadListView. I create a data table, fill it with some data, assign it as the data source, and then do a data bind. I know the code always returns a data table, even if it is empty, so this error can't be caused by a null data source. Could it be caused by something else, maybe one of the fields in the item template?

Here's the stack trace:
at Telerik.Web.UI.ListViewNullEnumerable.get_DataSourceCount() 
at Telerik.Web.UI.RadListView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) 
at Telerik.Web.UI.RadListView.PerformDataBinding(IEnumerable data) 
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) 
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) 
at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at Telerik.Web.UI.RadListView.PerformSelect() 
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at Telerik.Web.UI.RadListView.DataBind() 

Here's my HTML code:
<telerik:RadListView ID="RadListView1" runat="server" Width="100%" AllowPaging="true" ItemPlaceholderID="StylesHolder" DataKeyNames="StyleNumber" OnPageIndexChanged="RadListView1_PageIndexChanged">
    <LayoutTemplate>
        <fieldset style="width: 100%; border: none;" id="FieldSet1">
            <asp:Panel ID="StylesHolder" runat="server">
            </asp:Panel>
        </fieldset>
    </LayoutTemplate>
    <ItemTemplate>
        <div class="grid_3 SearchResults_Container">
            <a href="#" onclick="DetailClick('<%# Eval("StyleNumber") %>')">
                <%-- This div is necessary in that 'relative' is required in a div before 'absolute' is used in next dic --%>
                <div class="SearchResults_ImageContainer">
                    <%-- This div forces image to be vertical-aligned at bottom, just above text, but centered. --%>
                    <div class="SearchResults_ImageAlignment">
                        <%# GetStylePrimaryImage(Eval("StyleNumber") as string) %>
                    </div>
                </div>
                <%# Eval("StyleNumber") %><br />
                <%# Eval("ProductName") %>
            </a>
        </div>
    </ItemTemplate>
</telerik:RadListView>
Maria Ilieva
Telerik team
 answered on 19 Mar 2015
3 answers
308 views
I have 2 levels TabStrip.
Last item on 1st level is Help

                <telerik:RadTab Text="Help" NavigateUrl="http://www.google.com" Target="_blank">
                </telerik:RadTab>

I want to user stay on current tabs when he/she clicks "Help" tab. 
Currently browser opens new window but selects Help empty page. 

Could you guide me how to achieve that behavior.

thanks.
Ivan Danchev
Telerik team
 answered on 19 Mar 2015
2 answers
557 views
I'm trying to personalize the clienttemplate, formatting numbers, and putting percentage

For a stacked 100% bar chart I have the following:

series.TooltipsAppearance.ClientTemplate = "#= dataItem.categoryName#<br/>#= dataItem.categoryValue#";

It works perfectly, but I want to display only three decimals for categoryValue.

If I try to add kendo.format(...), as I see in some example online, the chart is not shown anymore...

I'd like to show also the percentage of category value (the chart is a stack100 type)
marco
Top achievements
Rank 2
 answered on 19 Mar 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?