Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
130 views
Guys,

I know your intentions are good, so I am expecting a lot !! I just hate to say but it seems to me that you could have hit the ground running a little better with this control GIVEN that you all have been getting great feedback on forums from your other platforms that have a Gantt control (notably Siliverlight). So, what you all have learned with that should have been the basis for feature release 1, not starting at the beginning, which is where we seem to be at.

Nevertheless, we are where we are and I need some things that I think are REASONABLE requests and that others may need as well:

1) The option  to use the TimeLine side of the control without the treecontrol and replace it with the Grid control for performing SIMPLE graphical display of time-phased data. Let me create a splitter and put the Grid on the left, and the Gantt timeline on the right. Let me do that. Give me some simple hooks for letting me get some of my grid data over to the TimeLine and give me enough so that my rows match up and I can synch the scrolling of the right and left sides. I would not need a sophisticated interface for inserting tasks or interactive gantt bars that stretch the timeline and automatically update the start times/end times. Just a simple interface for graphically displaying time-phased data from the Grid.

2) Read your forums for the Sliverlight Gantt and immediately begin prioritizing all of the most requested features from that forum because many of those requests are going to be the same ones from this group as far as business functionality goes.

Thanks




Dimitar Terziev
Telerik team
 answered on 17 Jul 2014
7 answers
827 views
Hi,
I am using a radgrid with batch edit mode.
However there are few things that I want to achieve, please let me know how to achieve them.

1) Upon clicking the Save Changes button (on grid_BatchEditCommand method), I will perform some checking if there's any validation error, I want to leave the radgrid in editing mode as per before clicking the save changes button.
I tried using e.canceled = true, but it seems it's like canceling all the changes (works similar like Cancel All Changes button).
So how to leave it in editing mode?

2) I have another Save button outside the grid, how to check that the radgrid is edited and not yet saved?

Thanks!
Eyup
Telerik team
 answered on 17 Jul 2014
7 answers
442 views
I have a PanelBar on my page that populated with items via the Client API.  The functions that manipulate the PanelBar follow:

    function BuildPanelBar(sender) {
        var panelBar = sender;
        var menuJson = JSON.parse('<%=Model.MenuItems %>');

        panelBar.trackChanges();
        
        var items = panelBar.get_items();
        if (items.get_count() > 0) panelBar.get_items().clear();

        for (var i = 0; i < menuJson.length; i++) {
            var currentItem = menuJson[i];

            var rootItem = new Telerik.Web.UI.RadPanelItem();
            rootItem.set_text(currentItem.DisplayName);

            if (currentItem.IsRootNode) {
                addItemsToRoot(currentItem, rootItem);
            }

            
            panelBar.get_items().add(rootItem);
            panelBar.commitChanges();
        }
    }

    function addItemsToRoot(currentItem, rootItem) {
        
        for (var i = 0; i < currentItem.ChildrenNodes.length; i++) {
            
            var newCurrentItem = currentItem.ChildrenNodes[i];
            
            var newItem = new Telerik.Web.UI.RadPanelItem();
            newItem.set_text(newCurrentItem.DisplayName);
            
            if (newCurrentItem.IsRootNode) {
                addItemsToRoot(newCurrentItem, newItem);
            }
            rootItem.get_items().add(newItem);
        }
    }

I need the individual items to call a different JavaScript when they are clicked, and not postback to the server.  I was hoping to do something like this:

            newItem.set_onclick(<function goes here>);

but all I have found in the client api is the OnClientClick function that I declare at the PanelBar level.  While each item that isn't a root node would call the same function, the values that the items would provide to the function would be different.  Is there anyway to achieve what I am trying to do?
Shinu
Top achievements
Rank 2
 answered on 17 Jul 2014
1 answer
182 views
I am having trouble setting the source of a Media Player to a asp.net webforms HTTP Handler. 

I am wondering if anyone can tell me if it is possible to hook up the MediaPlayer to a HTTP Handler. 

Example Code is

videoPlayer.Source = String.Format("localhost:1099\<Project>.Video.ashx?FileLocation={1}", "Video.mp4")
Dim sources As String() = {"Video1.mp4", "Video2.mp4"}
For Each source As String In sources
    If Not String.IsNullOrEmpty(source) Then
        Dim videoSources As New MediaPlayerSource()
        videoSources.Path = String.Format("localhost:1099\<Project>.Video.ashx?FileLocation={1}", source)
        videoPlayer.Sources.Add(videoSources)
    End If
Next
Angel Petrov
Telerik team
 answered on 17 Jul 2014
7 answers
549 views
I'm having an issue trying to convert one of my RadGrids to Batch edit mode from EditForms. The following is all code that worked natively prior to changing the EditMode.

Here is an example of the problem, starting with the GridTemplateColumn causing problems:
<telerik:GridTemplateColumn HeaderText="Unit #" ColumnGroupName="GeneralInformation" UniqueName="EmpORUnitID" DataField="EmpORUnitID" HeaderStyle-Width="100px">
                <ItemTemplate>
                    <asp:Label ID="lblUnitID" runat="server" Text=<%#DataBinder.Eval(Container, "DataItem.EmpORUnitID")%>></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadComboBox runat="server" ID="rcbUnitNumber"
                        EnableLoadOnDemand="True" ShowMoreResultsBox="true" BorderStyle="None" Width="90px"
                        EnableVirtualScrolling="true" EmptyMessage="Choose a Unit #"
                        DataTextField="EmpORUnitID" MarkFirstMatch="True" Filter="StartsWith"
                        HighlightTemplatedItems="true" Height="200px" Text='<%#DataBinder.Eval(Container, "DataItem.EmpORUnitID")%>'>
                        <WebServiceSettings Method="GetUnitNumberList" Path="Timesheet.aspx" />
                    </telerik:RadComboBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Odo Start" ColumnGroupName="GeneralInformation" UniqueName="OdoStart" DataField="OdoStart" HeaderStyle-Width="100px">
                <ItemTemplate>
                    <%#DataBinder.Eval(Container, "DataItem.OdoStart")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadNumericTextBox runat="server" ID="rtbOdoStart" Width="50px" Text='<%#DataBinder.Eval(Container, "DataItem.OdoStart")%>'>
                    </telerik:RadNumericTextBox>
                    <telerik:RadButton ID="btnFindOdoStart" runat="server" Width="20px"
                                            OnClick="btnFindOdoStart_Click" Icon-PrimaryIconUrl="~/Images/Icons/gauge.png"></telerik:RadButton>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>

Then, I have the following (with some lines cut out) to extract values from the EditItemTemplate controls (bolded the relevant sections to this problem)

protected void rgTodaysVehicles_UpdateCommand(object sender, GridCommandEventArgs e)
        {
            try
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;
                SWG.Timesheet.WebApp.Entities.Timesheet timesheet = Session["CurrentTimesheet"] as SWG.Timesheet.WebApp.Entities.Timesheet;
                VehicleMileageSummary vehicleMileageSummary = timesheet.VehicleMileages[editedItem.ItemIndex];
                try
                {
                    vehicleMileageSummary = BuildVehicleMileageSummary(editedItem, vehicleMileageSummary);

The last line above leads to:

private VehicleMileageSummary BuildVehicleMileageSummary(GridEditableItem editedItem, VehicleMileageSummary vehicleMileage)
        {
            List<String> errorList = new List<string>();
            try
            {
                vehicleMileage.IsDirty = true;            
                RadComboBox cbxEmpOrUnitID = (RadComboBox)editedItem["EmpORUnitID"].FindControl("rcbUnitNumber");       
                vehicleMileage.EmpORUnitID = cbxEmpOrUnitID.Text;

I receive null Object errors for the bolded line above, as the control "rcbUnitNumber" isn't found. Using breakpoints and some testing I can confirm that "editedItem" only contains the controls from the column ItemTemplate rather than EditItemTemplate.

Can anyone see what I'm doing wrong here?



Angel Petrov
Telerik team
 answered on 17 Jul 2014
1 answer
210 views
Our client is using Acunetix as their web application scanner - to find security vulnerabilities. One of the findings is about the Telerik.Web.UI.WebResource.axd. Details of the Acunetix below. How can we resolve this? Thanks!



Acunetix: Content type is not specified

Description

This page does not set a Content-Type header value. This value informs the browser what kind of data to expect. If this
header is missing, the browser may incorrectly handle the data. This could lead to security problems.

/Telerik.Web.UI.WebResource.axd


Recommendation
Set a Content-Type header value for this page
Ianko
Telerik team
 answered on 17 Jul 2014
7 answers
530 views
So on the button click of a telerik:RadToolBarDropDown I export a Telerik:RadGrid to either PDF, Excel or Word, depending on what they select.
The telerik:RadGrid has 2 levels of DetailTables.  I was able to add a background color of the MasterTableView using the code below:

For Each hdrItem As GridHeaderItem In RadGrid1.MasterTableView.GetItems(GridItemType.Header)
            hdrItem.BackColor = System.Drawing.Color.LightBlue
            For Each cell As TableCell In hdrItem.Cells
                cell.Style("text-align") = "left"
            Next
Next

My question is how can I also add a background color of each DetailTable Header?  Please Advice.  Thank You.
Shinu
Top achievements
Rank 2
 answered on 17 Jul 2014
1 answer
185 views
Hi friends,In the  radgrid i have a Tempalte coloumn  Which has an EditTempalte as shown below.I want to the update new value for the field User_login: User.identity.name

<telerik:GridTemplateColumn SortExpression="User_Login" UniqueName="User_Login" HeaderText="User_Login" >
<ItemTemplate>
<asp:Label Text='<%# Eval("User_Login") %>' runat="server" ID="lblUserLoginItem" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID ="txtUserLoginEdit" runat="server" Text='<%# Bind("User_Login") %>'> </asp:TextBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>

But when I try to do the following in the code behind:  It retrieves the only the old value beacause of the bind and if i dont use the bind it does not update at all.Is there something I am missing..Please guide..thank You

protected void rgTransferDetails_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted)
{
GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;
TextBox lblUserLogin = (TextBox)item.FindControl("txtUserLoginEdit");
lblUserLogin.Text = User.Identity.Name;

}

if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
GridEditFormItem editItem = (GridEditFormItem)e.Item;
TextBox lblUserLoginEdit = (TextBox)editItem.FindControl("txtUserLoginEdit");
lblUserLoginEdit.Text = User.Identity.Name;

}

}
Princy
Top achievements
Rank 2
 answered on 17 Jul 2014
7 answers
536 views
I have a radgrid (multi select) which is set in editmode through a button eventhandler. Now I had to add a detailtable which is displayed correct.
However, what I want is when a row in the mastertable is selected, and the edit putton is clicked, the detailtable has to expand and has to be put in edit mode. I can't get this done. This is what I have:

protected void button_Click(object sender, EventArgs e) {

bool isInEditMode = false;

foreach (GridItem item in rg.MasterTableView.Items) {                           

    if (item.Selected){

        if (item is GridEditableItem){

            ((GridEditableItem) item).Edit = true;

            isInEditMode = true;

        }

        if (item is GridDataItem){

            GridTableView nestedView = ((GridDataItem)item).ChildItem.NestedTableViews[0];

            if (tmp.Name == "Pricing"){

                item.Expanded = true;

                item.Edit = true;

            }

        }

       

        item.Selected = false;

    }

}

if (isInEditMode) {

    // disable selecting because we're in edit mode

    rg.ClientSettings.Selecting.AllowRowSelect = false;

    rg.Rebind();

}

}

if (isInEditMode) {

    // disable selecting because we're in edit mode

    rg.ClientSettings.Selecting.AllowRowSelect = false;

    rg.Rebind();

<Philips:MagAgRadGrid ID="rg" runat="server" AllowSorting="True" OnNeedDataSource="rg_NeedDataSource" AllowMultiRowEdit="True" OnItemCommand="rg_ItemCommand" Skin="Outlook" AllowMultiRowSelection="True" EnableOutsideScripts="True" EnableViewState="true" OnDetailTableDataBind="rg_DetailTableDataBind" >

..........

..........

<DetailTables>

    <radG:GridTableView DataKeyNames="MarketProductID" Name="Pricing"  Width="100%" AutoGenerateColumns="false" >

        <ParentTableRelation>

            <radG:GridRelationFields DetailKeyField="MarketProductID" MasterKeyField="MarketProductID" />

        </ParentTableRelation>

        <Columns>

            <radG:GridBoundColumn SortExpression="Country" HeaderText="Country"  DataField="Name"></radG:GridBoundColumn>

            <radG:GridTemplateColumn HeaderText="AVNP" UniqueName="AVNP" SortExpression="AVNP">

                <ItemStyle VerticalAlign="Top" HorizontalAlign="Center" />

                <ItemTemplate>

                    <asp:Label ID="lblAVNP" runat="server" Text='<%# Eval("AVNP") == DBNull.Value ? " 0.00" : Convert.ToDouble(Eval("AVNP")).ToString(" #0.00") %>' ></asp:Label>                            

                </ItemTemplate>

                <EditItemTemplate>

                    <radG:RadNumericTextBox ID="txtAVNP" runat="server" MinValue="0" EnabledStyle-HorizontalAlign="Right" Skin="Outlook" Value='<%# Eval("AVNP") %>' Width="60px">

                   <NumberFormat DecimalDigits="2" GroupSeparator="" />

                    </radG:RadNumericTextBox>

                </EditItemTemplate>

            </radG:GridTemplateColumn>

        </Columns>

    </radG:GridTableView>           

</DetailTables>

..........

..........

I hope anybody can help me.


Greg
Top achievements
Rank 1
 answered on 16 Jul 2014
5 answers
509 views
I have the following grid, but have found that the Itemcommand event is not fired when I click btnEdit2 on the detail table. It does fire correctly when I click the button on the master table. Do I need to do anything else to get this to work?

Thanks

<telerik:RadGrid ID="testgrid" runat="server" OnItemCommand="ItemCommand" DataSourceID="dsAppointments">
    <MasterTableView Name="Master" DataSourceID="dsAppointments" DataKeyNames="TaskID" EditMode="PopUp" AllowAutomaticUpdates="true" CommandItemDisplay="Top">
        <CommandItemSettings ShowAddNewRecordButton="false" ShowExportToCsvButton="false" ShowRefreshButton="false" />
        <Columns>
            <telerik:GridTemplateColumn UniqueName="Edit">
                <ItemTemplate>
                    <asp:LinkButton ID="btnEdit1" runat="server"
                        CommandName="JumpTo" CommandArgument='<%# Eval("TaskID") %>' CausesValidation="false"
                        PostBackUrl="~/Default.aspx">
                        Edit
                    </asp:LinkButton>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
        <DetailTables>
            <telerik:GridTableView Name="Detail" DataSourceID="dsAttendees" CommandItemDisplay="None" DataKeyNames="TaskID" TableLayout="Auto" HorizontalAlign="NotSet" ShowHeader="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true">
                <ParentTableRelation>
                    <telerik:GridRelationFields MasterKeyField="TaskID" DetailKeyField="TaskID" />
                </ParentTableRelation>
                <Columns>
                    <telerik:GridTemplateColumn UniqueName="Edit">
                        <ItemTemplate>
                            <asp:LinkButton ID="btnEdit2" runat="server"
                                CommandName="JumpTo" CommandArgument='<%# Eval("TaskID") %>' CausesValidation="false"
                                PostBackUrl="~/Default.aspx">
                                Edit
                            </asp:LinkButton>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
    </MasterTableView>
</telerik:RadGrid>
Ryan Strand
Top achievements
Rank 1
 answered on 16 Jul 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?