Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
107 views
Hi, I'm trying to pass a radTreeView as a parameter in an asmx web service. The web service is in another project. When I try to put the parameter into the function signature it, the web service it builds correctly but is not longer able to add or update to my main web app project. I was wondering if there was a certain way I needed to pass the object (like serializing) or a reference I'm missing? Both my project have the telerik.web.UI and skins dll. A tutorial or sample project would be great also.

Here's a simple version of a web service class I'm testing with:
namespace MCMwebservice
{` 
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
 
 
 [ScriptService]
public class Service1 : System.Web.Services.WebService
{
  [WebMethod]
    public bool getBool(RadTreeView TreeSites, string Demogs) {  //dummy method for now
        return true;
    }
   }
}

And this is the error I get, when trying to add or update the web service in my main project:

Metadata contains a reference that cannot be resolved: 'http://localhost:49304/Service1.asmx'. 
There was an error downloading 'http://localhost:49304/Service1.asmx/_vti_bin/ListData.svc/$metadata'.

The request failed with the error message:

Request format is unrecognized for URL unexpectedly ending in '/_vti_bin/ListData.svc/$metadata'.

Will
Top achievements
Rank 1
 asked on 26 Aug 2013
2 answers
180 views
Hi,

I'm learning how to update a shopping cart by clicking a button on RadGrid control.

I have a RadMenu on a Master page. One of the menu items contain the cart which I simplify to a single RadButton.
I also have RadAjaxMenager on the Master Page.

RadGrid with the button to update the cart is built dynamically on "Inventory" page linked to my Master page.

For experimenting purposes I would like to increase the number on the button placed in the cart. When I click the button on grid the button on grid should be updated but is not.

Whole concept is taken from your example:
http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/partialajaxification/defaultcs.aspx

The only difference is that I'm building my grid dynamically and I think this is the cause of the problem. I have tried to implement the example using markup and it was fine...

Here is my code for the master Page

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
    <link type="text/css" href="siteStyle.css" rel="stylesheet" />
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <script type="text/javascript">
            //Put your JavaScript code here.
        </script>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
 
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
 
        <div id="wraper">
            <div id="header">
                <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="True"></telerik:RadSkinManager>
            </div>
            <telerik:RadMenu ID="menu" runat="server" Width="100%" ClientIDMode="Static">
                <Items>
                    <telerik:RadMenuItem runat="server" Text="Home" NavigateUrl="~/Home.aspx">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem runat="server" Text="Inventory" NavigateUrl="~/Inventory.aspx">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem runat="server" Text="My Account">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem runat="server" Text="Support" NavigateUrl="~/Support.aspx">
                        <Items>
                            <telerik:RadMenuItem runat="server" Text="FAQ">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" Text="Shipping">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem runat="server" Text="Payments">
                            </telerik:RadMenuItem>
                        </Items>
                        <GroupSettings Flow="Horizontal" />
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem runat="server" Text="Cart">
                        <Items>
                            <telerik:RadMenuItem runat="server" Text="SubCart">
                                <ItemTemplate>
                                    <telerik:RadButton ID="RadButton1" runat="server" Text="1"></telerik:RadButton>
                                    <telerik:RadGrid ID="grdCartItems" runat="server"></telerik:RadGrid>
 
                                </ItemTemplate>
                            </telerik:RadMenuItem>
                        </Items>
 
                    </telerik:RadMenuItem>
                </Items>
            </telerik:RadMenu>
 
            <div style="clear: both"></div>
 
            <div id="masterContainer">
                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                </asp:ContentPlaceHolder>
            </div>
 
            <div id="footer"></div>
 
        </div>
    </form>
</body>
</html>

Code of the "Inventory" page linked to a master

Imports Telerik.Web.UI
Imports System.Data
 
Partial Class Inventory
    Inherits System.Web.UI.Page
    Dim grid As New RadGrid
 
 
 
    Protected Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
        CreateGrid()
    End Sub
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If IsPostBack Then Exit Sub
        Dim grid1 As RadGrid = CType(PlaceHolder1.FindControl("RadGrid1"), RadGrid)
        Dim ajaxMenager As RadAjaxManager = Master.FindControl("RadAjaxManager1")
 
        ajaxMenager.AjaxSettings.AddAjaxSetting(grid1, grid1)
 
    End Sub
 
    Public Sub CreateGrid()
        grid = New RadGrid
 
        grid.ID = "RadGrid1"
 
        grid.Width = Unit.Percentage(100)
        grid.PageSize = 15
        grid.AllowPaging = True
        grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric
        grid.AutoGenerateColumns = False
        grid.ClientIDMode = UI.ClientIDMode.Static
 
        grid.MasterTableView.Width = Unit.Percentage(100)
        grid.MasterTableView.DataKeyNames = New String() {"ID"}
 
        Dim boundColumn As New GridBoundColumn()
 
        boundColumn = New GridBoundColumn()
        boundColumn.DataField = "Code"
        boundColumn.HeaderText = "Code"
        grid.MasterTableView.Columns.Add(boundColumn)
 
        Dim tableViewOrders As GridTableView
        tableViewOrders = New GridTableView(grid)
 
        tableViewOrders.Width = Unit.Percentage(100)
        boundColumn = New GridBoundColumn()
        boundColumn.DataField = "Code"
        boundColumn.HeaderText = "Code"
        tableViewOrders.Columns.Add(boundColumn)
 
        Dim toCartCollumn As New GridTemplateColumn
        toCartCollumn = New GridTemplateColumn
 
        toCartCollumn.ItemTemplate = New MyTemplate()
        toCartCollumn.UniqueName = "TemplateColumn1"
        toCartCollumn.DataField = "Code11"
        tableViewOrders.Columns.Add(toCartCollumn)
 
        grid.MasterTableView.DetailTables.Add(tableViewOrders)
 
        AddHandler grid.NeedDataSource, AddressOf RadGrid1_NeedDataSource
        AddHandler grid.DetailTableDataBind, AddressOf RadGrid1_DetailTableDataBind
        AddHandler grid.ItemCommand, AddressOf RadGrid1_ItemCommand
        AddHandler grid.ItemCreated, AddressOf RadGrid1_ItemCreated
        PlaceHolder1.Controls.Add(grid)
    End Sub
 
    Private Sub RadGrid1_DetailTableDataBind(ByVal source As Object, ByVal e As GridDetailTableDataBindEventArgs)
        Dim list As List(Of Listing) = grid.DataSource
        Dim dataItem As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem)
        Dim id As Integer = dataItem.GetDataKeyValue("ID")
        Dim detailList = (From l In list Where l.ID = id Select l.Items).First.ToList
        e.DetailTableView.DataSource = detailList
    End Sub
 
    Public Function CreateListings(itemsCount As Integer) As List(Of Listing)
        Dim list As New List(Of Listing)
        For i = 0 To itemsCount
            list.Add(New Listing(i))
        Next
        Return list
    End Function
 
    Protected Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs)
        If e.CommandName = "AddToCart" Then
            Dim menu As RadMenu = Master.FindControl("menu")
            Dim buttonToUpdate As RadButton = menu.FindItemByText("SubCart").FindControl("RadButton1")
            buttonToUpdate.Text = CInt(buttonToUpdate.Text) + 1
        End If
    End Sub
 
    Protected Sub RadGrid1_ItemCreated(sender As Object, e As GridItemEventArgs)
        If TypeOf e.Item Is GridDataItem Then
            If e.Item.DataItem Is Nothing Then Exit Sub
            If e.Item.DataItem.GetType.Name = "ListingItem" Then
                Dim dataItem As GridDataItem = TryCast(e.Item, GridDataItem)
                Dim tc As TableCell = dataItem("TemplateColumn1")
                Dim button As Button = tc.FindControl("ibtnAddToCart")
                Dim ajaxMenager As RadAjaxManager = Master.FindControl("RadAjaxManager1")
                Dim menu As RadMenu = Master.FindControl("menu")
                Dim buttonToUpdate = menu.FindItemByText("SubCart").FindControl("RadButton1")
                ajaxMenager.AjaxSettings.AddAjaxSetting(button, buttonToUpdate)
            End If
        End If
    End Sub
 
    Protected Sub RadGrid1_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs)
        grid.DataSource = CreateListings(15)
    End Sub
 
    Private Class MyTemplate
        Implements ITemplate
        Protected ibtnAddToCart As Button
 
        Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn
            ibtnAddToCart = New Button()
            ibtnAddToCart.ID = "ibtnAddToCart"
            AddHandler ibtnAddToCart.DataBinding, AddressOf boolValue_DataBinding
            ibtnAddToCart.CommandName = "AddToCart"
            container.Controls.Add(ibtnAddToCart)
        End Sub
        Sub boolValue_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
            Dim cBox As Button = DirectCast(sender, Button)
            Dim container As GridDataItem = DirectCast(cBox.NamingContainer, GridDataItem)
            Dim listingitem = DirectCast(container.DataItem, ListingItem)
            cBox.Text = listingitem.Code
        End Sub
    End Class
End Class

I also attach a screen of the sample app
jacob
Jakub
Top achievements
Rank 1
 answered on 24 Aug 2013
0 answers
197 views
I have a web service project that is referenced by another project. In the web service I have a function that I want to use to populate a telerik radTreeView. The webService builds successfully but if I try to update/add the web service to my main project I get this error:
 
Metadata contains a reference that cannot be resolved: 'http://localhost:49304/Service1.asmx'. 
There was an error downloading 'http://localhost:49304/Service1.asmx/_vti_bin/ListData.svc/$metadata'.

The request failed with the error message:

Request format is unrecognized for URL unexpectedly ending in '/_vti_bin/ListData.svc/$metadata'.

This is a simplified version of the web service class I'm writing:


namespace MCMwebservice
{` 
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
 
 
 [ScriptService]
public class Service1 : System.Web.Services.WebService
{
  [WebMethod]
    public bool getBool(RadTreeView TreeSites, string Demogs) {  //dummy method for now
        return true;
    }
}

If I remove the telerik radtreeview parameter then it will update, so I know that's the issue. The both projects have the telerik.web.ui and skins dll. Is there a certain reference or tag I need to add to my main project or in my web.config? Please Help!

thanks

Will

Will
Top achievements
Rank 1
 asked on 24 Aug 2013
15 answers
417 views
Hello,

I recently did a .Net Framework update on our production server and I'm now having problems with all controls that are doing AJAX requests. The new ASP.Net version is 4.0.30319.0.

On my computer I'm having .Net 4.0, but a lower version, and everything works fine.

Also I'm now getting some errors like this on our server : The HTTP verb POST used to access path ... is not allowed.

Here's a part of the code I'm using that fails :

<telerik:RadAjaxLoadingPanel ID="ajaxPanel" runat="server" />
<telerik:RadAjaxManager runat="server" DefaultLoadingPanelID="ajaxPanel">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="gridEntreprises">
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="chkActifUniquement">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="gridEntreprises" LoadingPanelID="ajaxPanel" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

The server event attached to "chkActifUniquement" doesn't have any effect on the specified control (using new .Net version).
Bruce Haan
Top achievements
Rank 1
 answered on 23 Aug 2013
4 answers
173 views
Hi,

I am using the following code to allow the user to change the width of the grid.  The code works great the problem is, if the user has chosen to hide any columns (display=false) the columns are re-displayed when the width is changed.

Is there any way I can keep the columns hidden?

function SetGridWidth(GridClientId, WidthClientId) {

var radGrid = $find(GridClientId);

var grdWidth = document.getElementById(WidthClientId);

if (grdWidth.value > 2000) {

grdWidth.value = 2000;

} if (radGrid) {

radGrid.get_element().style.width = grdWidth.value + "px";

radGrid.repaint();

}

}

Thank You
Tracy

Tracy
Top achievements
Rank 1
 answered on 23 Aug 2013
1 answer
181 views
I have a radSplitter dividing my page into two areas. Sometimes when I click on the splitter button to collapse the left pane it appears that the click event is allowed to bubble to the content in the right pane. The right pane contains a content placeholder which contains a iframed page. That page has a table that responds to click events, and it is responding to the bubbled click event, causing unexpected results.

Is there a way I can prevent the click event on the splitter collapse button from bubbling?
Jeanne
Top achievements
Rank 1
 answered on 23 Aug 2013
2 answers
220 views
<Windows>
<telerik:RadWindow ID="rw_confirm_client" Modal="true" Behaviors="None" VisibleStatusbar="false"
             runat="server" CssClass="RwConfirmacion" VisibleTitlebar="false" Height="10"
             Width="10">
<ContentTemplate>
<div class="BoxConfirmationContent">
<img src="../App_Themes/Opa.Tema/Imagenes/Pregunta.png" id="Img3" class="ImgNotifcacion"
   runat="server" />
<table class="TbMensajeConfirmacion">
<tr>
<td class="botoncerrarmensajero">
<asp:LinkButton href="#" runat="server" ID="LinkButton2" CssClass="linkcerrar"
           OnClientClick='closeCustomConfirmClient();'>X</asp:LinkButton>
</td>
</tr>
<tr>
<td class="textomensaje">
<asp:Label ID="Label1" runat="server">Aca va el texto del mensaje</asp:Label></td>
</tr>
<tr>
<td class="botoncerrarmensajero">
<telerik:RadButton runat="server" ID="RadButtonConfirmClient" CssClass="BtConfirmacion"
             CausesValidation="false" Text="OK">
<Image ImageUrl="../App_Themes/Opa.Tema/Imagenes/NegroTotal.png" IsBackgroundImage="true" />
</telerik:RadButton>
<telerik:RadButton runat="server" ID="RadButtonCancelClient" CssClass="BtConfirmacion"
             CausesValidation="false" Text="Cancelar"
                       OnClientClick="closeCustomConfirmClient();">
<Image ImageUrl="../App_Themes/Opa.Tema/Imagenes/NegroTotal.png" IsBackgroundImage="true" />
</telerik:RadButton>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</telerik:RadWindow>
</Windows>

hello I have this window in a window manager, this window is displayed from a radbutton in another location, using javascript and after asking achievement button trigger the event, the problem is that the databind have stopped working, can anyone help ?

var fireConfirm = true;
        function OnClientClicked(button, args) {
            var callBackFunction = Function.createDelegate(button, function (argument) {
                if (fireConfirm && argument) {
                    this.set_autoPostBack(true);
                    fireConfirm = false;
                    this.click();
                }
            });
            if (fireConfirm) {
                button.set_autoPostBack(false);
                var text = "¿Has revisado ya?, si es asi ¿Estas seguro de llevar a cabo esta acción?";
                var oWnd = radopen(null, 'rw_confirm_client');
                var X = document.body.clientWidth - 400;
                var Y = 150;
                oWnd.MoveTo(X, Y);
 
 
                var button = document.getElementById("<%=RadButtonConfirmClient.ClientID %>").onclick = callBackFunction;
                var text = document.getElementById("<%=Label1.ClientID %>").innerText = text;
 
 
            }
        }

OPA
Top achievements
Rank 1
 answered on 23 Aug 2013
2 answers
1.0K+ views
Hello,
This should be easy but I am struggling to find a solution. 

I have a radgrid with a custom edit form template I want to show one of the fields based on the opposite of a boolean field.
Something like this:

<tr id="trCloseDate" runat="server" visible='<%# Bind(!"j") %>'>

I dont think this would ultimately work though as I would need the user to be able to toggle at will. Something in the code behind would work better I think.

I have tried to do this in the code behind, using the onCheckChanged event but am running into issues as I cant find a way to get the tr control as it is not rendered yet, I believe, since it is later in the table.

Another weird side issue is that the checkbox is not showing the correct check if I use the changed event.

Thank you for your time.
Tops Software
Top achievements
Rank 2
 answered on 23 Aug 2013
6 answers
199 views
First, I am using version 2013.2.717.40.
I set-up a very simple RadListBox transfer scenario:
     
<telerik:RadListBox ID="StatusListBoxSource" runat="server" 
    AllowTransfer="True" DataSourceID="StatusDataSource" DataTextField="Description" 
    DataValueField="StatusId" TransferToID="StatusListBoxTarget" 
    Height="240px" Width="150px">
</telerik:RadListBox>
<telerik:RadListBox 
ID="StatusListBoxTarget" runat="server" Height="240px" Width="150px"></telerik:RadListBox>

There is a RadButton that is used to indicate that the user is ready to process the infiormation in the second box:
<telerik:RadButton ID="DiagnoticStatusButton" runat="server" Text="Apply" AutoPostBack="True" 
    OnClick="DiagnoticStatusButton_Click">
</telerik:RadButton>

There is a label used to display the results of the processing:
<asp:Label ID="DiagnosticStatusLabel" runat="server" Text=""></asp:Label>
And an AjaxSetting to connect the button and the label:
   
<telerik:AjaxSetting AjaxControlID="DiagnoticStatusButton">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="DiagnosticStatusLabel" />
    </UpdatedControls>
</telerik:AjaxSetting>
The first time I transfer an item from the source box to the target box and click the button, everything works just fine. If I transfer another, without removing the first, and click the button, also works fine. However, when I transfer any more and click the button, I get an error that is caught in the Global.aspx.cs file with the Server class being something that does not contain a GetLastError method. This is before it gets into the button event handler in the code behind.

Another issue, around which I am able to work is that, after transfering one item, a second click of the button reveals that there are 2 entries in the targetbox.items collection.

Here is the code for the button click event:
protected void DiagnoticStatusButton_Click ( object sender, EventArgs e )
    {
      ED.GenericResponse GR = new ED.GenericResponse ();
      List<String> IssueList = new List<String> ();
      List<Byte> StatusIdList = new List<Byte> ();
      var q = ( from si in this.StatusListBoxTarget.Items
                select si.Value ).Distinct ();
      foreach ( String item in q )
      {
        StatusIdList.Add ( Byte.Parse ( item ) );
      }
      try
      {
        using ( EDG.GroupsDataContext ctx = new EDG.GroupsDataContext () )
        {
          Int32 EffectedRows = ctx.AddDevicesByCriteria ( this.GroupId, DateTime.Now.AddDays ( -1 ).Date, StatusIdList, IssueList );
          this.DiagnosticStatusLabel.Text = String.Format ( "{0} devices added", EffectedRows );
        }
      }
      catch ( Exception Ex )
      {
        Logger.ErrorException ( Ex.Message, Ex );
        this.DiagnosticStatusLabel.Text = "There was an error adding from diagnostic status";
      }
    }

Unfortunately, there may be no way for you to reproduce this, but any suggestions would be accepted and appreciated.

Thanks,

Ed
Ed
Top achievements
Rank 1
 answered on 23 Aug 2013
9 answers
1.4K+ views
Hi guys, How do I remove the group header text. It show example Title : Book A. I only want to display Book A as the text only. Please help.Thanks
<GroupByExpressions>
                <telerik:GridGroupByExpression>
                    <SelectFields>
                       <telerik:GridGroupByField FieldName="Title"  FormatString = "" HeaderText=""/>
                    </SelectFields>
                    <GroupByFields>
                        <telerik:GridGroupByField FieldName="Title" SortOrder="Ascending">
                        </telerik:GridGroupByField>
                    </GroupByFields>
                </telerik:GridGroupByExpression>
            </GroupByExpressions>
Konstantin Dikov
Telerik team
 answered on 23 Aug 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?