Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
38 views
Can you provide an example on how to have page numbers on the exported pdf?
Aneliya Petkova
Telerik team
 answered on 13 Jul 2015
3 answers
206 views

I am doing the following at the moment and it seems to work, not sure there is not a method I could use.

 
var dataSource;
        function RequestStart(sender, args) {
            dataSource = $find('<%= RadClientDataSource1.ClientID %>');
            dataSource._transport.read.url = dataSource._transport.baseUrl + "GetListProducts/3";
        };

 Thanks, Marty

 

Marin
Telerik team
 answered on 13 Jul 2015
1 answer
84 views

I have the following Radgrid control with AllowPaging = true. The Items in the Radgrid are sorted in decreasing order after the date in the second column. After I insert a row, I want the focus to be set on the page where the item was inserted. I have tried the following code in the Insert_Command event:

<telerik:RadGrid ID="rgCondica"
            runat="server"
            AllowPaging="true"
            AllowCustomPaging="true"
            AllowSorting="True"
            AutoGenerateColumns="False"
            Skin="Windows7"
            OnItemCommand="rgCondica_ItemCommand"
            OnItemDataBound="rgCondica_ItemDataBound"
            OnInsertCommand="rgCondica_InsertCommand"
            OnUpdateCommand="rgCondica_UpdateCommand"
            OnDeleteCommand="rgCondica_DeleteCommand"
            OnNeedDataSource="rgCondica_NeedDataSource"
            CellSpacing="0"
            CssClass="c1grid"
            GridLines="None"
            PageSize="5" PagerStyle-ShowPagerText="False"
            PagerStyle-AlwaysVisible="true" MasterTableView-NoMasterRecordsText="Nu exista inregistrari" PagerStyle-FirstPageToolTip="Prima pagina"
            PagerStyle-LastPageToolTip="Ultima pagina" PagerStyle-PageSizeLabelText="Nr. inregistrari:" PagerStyle-PrevPagesToolTip="Paginile anterioare"
            PagerStyle-PrevPageToolTip="Pagina anterioara" PagerStyle-NextPagesToolTip="Paginile urmatoare" PagerStyle-NextPageToolTip="Pagina anterioara">
            </telerik:RadGrid​>
protected void rgCondica_InsertCommand(object sender,GridCommandEventArgs e){
GridDataItem item = rgCondica.MasterTableView.FindItemByKeyValue("IdCondica", c.IdCondica);
 rgCondica.CurrentPageIndex = item.RowIndex;
 rgCondica.Rebind();}

but it remains on the last page.

 

Any help is appreciated. Thank you.

Eyup
Telerik team
 answered on 13 Jul 2015
1 answer
106 views

Hi,

 I just want to change color for "Week,Day,Month,Year" buttons to white because its unreadable. I couldn't find any property to change them please find the attached image of RadGantt and here is my code

    <telerik:RadGantt ID="RadGantt1" runat="server"  Height="245px"  Width="1122px"
         AutoGenerateColumns="false" ReadOnly="true" SelectedView="MonthView">
            <YearView UserSelectable="true"  />
               <Columns>
                 <telerik:GanttBoundColumn DataField="Title" DataType="String"></telerik:GanttBoundColumn>
              </Columns> 
           <DataBindings >
                <TasksDataBindings IdField="ID"   TitleField="Title"  StartField="Start"  EndField="End" 
                    PercentCompleteField="PercentComplete"  OrderIdField="OrderID"  SummaryField="Summary"  ParentIdField="ParentID" />
                <DependenciesDataBindings  IdField="ID"  PredecessorIdField="PredecessorID" 
                    SuccessorIdField="SuccessorID"  TypeField="Type" />
            </DataBindings>
        </telerik:RadGantt> 

  

Aneliya Petkova
Telerik team
 answered on 13 Jul 2015
1 answer
98 views

I have hierarchy grid. I am able to edit\delete parent grid but not child grid (second grid). I using the same code behind and subs for both the grids. When I click on edit button for row of second grid, it enables edit mode but when I click on update button, it is not changing values on UI nor in database tables. And build is correct, it is not giving any error. Following is my code. If anybody can please help me!

 

<%@ Page Language="vb" AutoEventWireup="false" Inherits="WebApplication1.invoice_details" CodeBehind="invoice_details.aspx.vb" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <div>
        <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" ShowStatusBar="true"
            AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False"
            AllowAutomaticDeletes="True" 
            AllowAutomaticUpdates="True" OnItemUpdated="RadGrid1_ItemUpdated" OnItemDeleted="RadGrid1_ItemDeleted">
            <PagerStyle Mode="NumericPages"></PagerStyle>
            <MasterTableView DataSourceID="SqlDataSource1" EditMode = "InPlace" DataKeyNames="case_id" AllowMultiColumnSorting="True"
                Width="100%" CommandItemDisplay="Top" Name="Cases">
                <DetailTables>
                    <telerik:GridTableView EditMode = "InPlace" DataKeyNames="item_id" DataSourceID="SqlDataSource2" Width="100%"
                        runat="server" CommandItemDisplay="Top" Name="Items">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="case_id" MasterKeyField="case_id"></telerik:GridRelationFields>
                        </ParentTableRelation>                        
                        <Columns>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn2">
                                <HeaderStyle Width="20px"></HeaderStyle>
                                <ItemStyle CssClass="MyImageButton"></ItemStyle>
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn SortExpression="grp_id" HeaderText="Group" HeaderButtonType="TextButton"
                                DataField="grp_id" UniqueName="grp_id" ReadOnly = "True">
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="item_id" HeaderText="Item ID" HeaderButtonType="TextButton"
                                DataField="item_id" UniqueName="item_id" ReadOnly = "True" Visible = "False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="inv_item_desc" HeaderText="Item Description" HeaderButtonType="TextButton"
                                DataField="inv_item_desc" UniqueName="inv_item_desc">
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="inv_item_rate" HeaderText="Rate" HeaderButtonType="TextButton"
                                DataField="inv_item_rate" UniqueName="inv_item_rate">
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="inv_item_qty" HeaderText="Quantity" HeaderButtonType="TextButton"
                                DataField="inv_item_qty" UniqueName="inv_item_qty">
                            </telerik:GridBoundColumn>   
                            <telerik:GridBoundColumn SortExpression="total" HeaderText="Total" HeaderButtonType="TextButton"
                                DataField="total" UniqueName="total" ReadOnly = "True">
                            </telerik:GridBoundColumn>                         
                            <telerik:GridButtonColumn ConfirmText="Delete these details record?" ButtonType="ImageButton"
                                CommandName="Delete" Text="Delete" UniqueName="DeleteColumn2">
                                <HeaderStyle Width="20px"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                            </telerik:GridButtonColumn>
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        <HeaderStyle Width="20px"></HeaderStyle>
                        <ItemStyle CssClass="MyImageButton"></ItemStyle>
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn SortExpression="case_id" HeaderText="Case ID" HeaderButtonType="TextButton"
                        DataField="case_id" UniqueName="case_id" MaxLength="5" ReadOnly = "True">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="case_file_nbr" HeaderText="Case File Number" HeaderButtonType="TextButton"
                        DataField="case_file_nbr" UniqueName="case_file_nbr">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="case_desc" HeaderText="Case Description" HeaderButtonType="TextButton"
                        DataField="case_desc" UniqueName="case_desc">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn ConfirmText="Delete this case?" ButtonType="ImageButton"
                        CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                        <HeaderStyle Width="20px"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                    </telerik:GridButtonColumn>
                </Columns>
                <SortExpressions>
                    <telerik:GridSortExpression FieldName="case_desc"></telerik:GridSortExpression>
                </SortExpressions>
            </MasterTableView>
        </telerik:RadGrid>
    </div>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="Server=172.18.1.11;Database=ent64ast;user id=entqalogin;password=en7qal8g1n5"
        DeleteCommand="DELETE FROM tbl_inv_case WHERE org_id= 'Oindem' and inv_no=31 and case_id = @case_id"
        SelectCommand="SELECT case_id,case_file_nbr,case_desc from tbl_inv_case where org_id='Oindem' and inv_no=31"
        UpdateCommand="UPDATE tbl_inv_case SET case_file_nbr = @case_file_nbr, case_desc = @case_desc WHERE org_id= 'Oindem' and inv_no=31 and case_id = @case_id">
        <DeleteParameters>
            <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="org_id" Type="String"></asp:Parameter>
            <asp:Parameter Name="inv_no" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_file_nbr" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_desc" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_amnt" Type="String"></asp:Parameter>
                <asp:SessionParameter Name="login_id" Type="string"  SessionField="loginid" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_file_nbr" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_desc" Type="String"></asp:Parameter>
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"
        ConnectionString="Server=172.18.1.11;Database=ent64ast;user id=entqalogin;password=en7qal8g1n5"
        DeleteCommand="DELETE FROM tbl_inv_case_items WHERE org_id= 'Oindem' and inv_no=31 and case_id = @case_id and item_id = @item_id"
        SelectCommand="SELECT grp_id,case_id,item_id,inv_item_desc,inv_item_rate,inv_item_qty, cast(inv_item_rate*inv_item_qty as decimal(18,2)) 'total' FROM tbl_inv_case_items WHERE org_id='Oindem' AND inv_no=31 AND case_id = @case_id ORDER BY grp_id,case_id, inv_item_seqn"
        UpdateCommand="UPDATE tbl_inv_case_items SET inv_item_desc = @inv_item_desc, inv_item_rate = @inv_item_rate, inv_item_qty = @inv_item_qty WHERE org_id= 'Oindem' AND inv_no=31 AND case_id = @case_id AND item_id = @item_id">
        <DeleteParameters>
            <asp:Parameter Name="item_id" Type="Int32"></asp:Parameter>
            <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
        </DeleteParameters>
        <SelectParameters>
        <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="inv_item_desc" Type="String"></asp:Parameter>
            <asp:Parameter Name="inv_item_rate" Type="Double"></asp:Parameter>
            <asp:Parameter Name="inv_item_qty" Type="Double"></asp:Parameter>
            <asp:Parameter Name="item_id" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
        </UpdateParameters>
    </asp:SqlDataSource>    
    </form>
</body>
</html>

Viktor Tachev
Telerik team
 answered on 13 Jul 2015
1 answer
104 views

Hey guys,

im trying to follow the example from http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx but i am unable to follow. I removed the datasource part becuase im not having the demo database installed and tried to use some static data instead but it seems like somehow neither my events nor the ajax stuff is fired. Anyone 

 

Codebehind: 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;
 
namespace WebApplication2
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
            DataTable dt = new DataTable();
            DataColumn dc1 = new DataColumn();
            dc1.ColumnName = "ProductID";
            dc1.Caption = "ProductID";
            dc1.DataType = typeof(int);
            dt.Columns.Add(dc1);
 
            DataColumn dc2 = new DataColumn();
            dc2.ColumnName = "ProductName";
            dc2.Caption = "ProductName";
            dc2.DataType = typeof(string);
            dt.Columns.Add(dc2);
 
            DataColumn dc3 = new DataColumn();
            dc3.ColumnName = "CategoryID";
            dc3.Caption = "CategoryID";
            dc3.DataType = typeof(int);
            dt.Columns.Add(dc3);
 
            DataColumn dc4 = new DataColumn();
            dc4.ColumnName = "CategoryName";
            dc4.Caption = "CategoryName";
            dc4.DataType = typeof(string);
            dt.Columns.Add(dc4);
 
            DataColumn dc5 = new DataColumn();
            dc5.ColumnName = "UnitPrice";
            dc5.Caption = "UnitPrice";
            dc5.DataType = typeof(decimal);
            dt.Columns.Add(dc5);
 
            DataColumn dc6 = new DataColumn();
            dc6.ColumnName = "Discontinued";
            dc6.Caption = "Discontinued";
            dc6.DataType = typeof(bool);
            dt.Columns.Add(dc6);
 
            DataColumn dc7 = new DataColumn();
            dc7.ColumnName = "UnitsInStock";
            dc7.Caption = "UnitsInStock";
            dc7.DataType = typeof(int);
            dt.Columns.Add(dc7);
 
            dt.Rows.Add(1, "name", 1, "cname", 20, false, 20);
            RadGrid1.DataSource = dt;
        }
 
        protected void RadGrid1_BatchEditCommand(object sender, Telerik.Web.UI.GridBatchEditingEventArgs e)
        {
            SavedChangesList.Visible = true;
        }
 
        protected void RadGrid1_ItemUpdated(object source, Telerik.Web.UI.GridUpdatedEventArgs e)
        {
            GridEditableItem item = (GridEditableItem)e.Item;
            String id = item.GetDataKeyValue("ProductID").ToString();
            if (e.Exception != null)
            {
                e.KeepInEditMode = true;
                e.ExceptionHandled = true;
                NotifyUser("Product with ID " + id + " cannot be updated. Reason: " + e.Exception.Message);
            }
            else
            {
                NotifyUser("Product with ID " + id + " is updated!");
            }
        }
 
        protected void RadGrid1_ItemInserted(object source, GridInsertedEventArgs e)
        {
            if (e.Exception != null)
            {
                e.ExceptionHandled = true;
                NotifyUser("Product cannot be inserted. Reason: " + e.Exception.Message);
            }
            else
            {
                NotifyUser("New product is inserted!");
            }
        }
 
        protected void RadGrid1_ItemDeleted(object source, GridDeletedEventArgs e)
        {
            GridDataItem dataItem = (GridDataItem)e.Item;
            String id = dataItem.GetDataKeyValue("ProductID").ToString();
            if (e.Exception != null)
            {
                e.ExceptionHandled = true;
                NotifyUser("Product with ID " + id + " cannot be deleted. Reason: " + e.Exception.Message);
            }
            else
            {
                NotifyUser("Product with ID " + id + " is deleted!");
            }
 
        }
 
        protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            //RadNumericTextBox unitsNumericTextBox = (RadGrid1.MasterTableView.GetBatchColumnEditor("UnitsInStock") as GridNumericColumnEditor).NumericTextBox;
            //unitsNumericTextBox.Width = Unit.Pixel(60);
        }
 
        private void NotifyUser(string message)
        {
            RadListBoxItem commandListItem = new RadListBoxItem();
            commandListItem.Text = message;
            SavedChangesList.Items.Add(commandListItem);
        }
    }
}
 

 Markup:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>
<%@ Register Assembly="Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head id="Head1" runat="server">
    <title>Telerik ASP.NET Example</title>
    </head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="SavedChangesList" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1">
    </telerik:RadAjaxLoadingPanel>   
    <div id="demo" class="demo-container no-bg">
        <telerik:RadListBox runat="server" ID="SavedChangesList" Width="600px" Height="200px"
            Visible="false">
        </telerik:RadListBox>
        <telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" AllowAutomaticDeletes="True"
            AllowAutomaticInserts="True" PageSize="10" OnItemDeleted="RadGrid1_ItemDeleted"
            OnItemInserted="RadGrid1_ItemInserted" OnItemUpdated="RadGrid1_ItemUpdated" OnPreRender="RadGrid1_PreRender"
            AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False" OnBatchEditCommand="RadGrid1_BatchEditCommand">
            <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="ProductID" HorizontalAlign="NotSet"
                EditMode="Batch" AutoGenerateColumns="False">
                <BatchEditingSettings EditType="Cell" />
                <SortExpressions>
                    <telerik:GridSortExpression FieldName="ProductID" SortOrder="Descending" />
                </SortExpressions>
                <Columns>
                    <telerik:GridBoundColumn DataField="ProductName" HeaderStyle-Width="210px" HeaderText="ProductName"
                        SortExpression="ProductName" UniqueName="ProductName">
                        <ColumnValidationSettings EnableRequiredFieldValidation="true">
                            <RequiredFieldValidator ForeColor="Red" Text="*This field is required" Display="Dynamic">
                            </RequiredFieldValidator>
                        </ColumnValidationSettings>
                    </telerik:GridBoundColumn>
                    <telerik:GridNumericColumn DataField="UnitsInStock" HeaderStyle-Width="80px" HeaderText="Units In Stock"
                        SortExpression="UnitsInStock" UniqueName="UnitsInStock">
                    </telerik:GridNumericColumn>
                    <telerik:GridCheckBoxColumn DataField="Discontinued" HeaderStyle-Width="80px" HeaderText="Discontinued"
                        SortExpression="Discontinued" UniqueName="Discontinued">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridTemplateColumn HeaderText="UnitPrice" HeaderStyle-Width="80px" SortExpression="UnitPrice"
                        UniqueName="TemplateColumn" DataField="UnitPrice">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lblUnitPrice" Text='<%# Eval("UnitPrice", "{0:C}") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <span>
                                <telerik:RadNumericTextBox Width="55px" runat="server" ID="tbUnitPrice">
                                </telerik:RadNumericTextBox>
                                <span style="color: Red">
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="tbUnitPrice"
                                        ErrorMessage="*Required" runat="server" Display="Dynamic">
                                    </asp:RequiredFieldValidator>
                                </span></span>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" HeaderText="Delete" HeaderStyle-Width="50px" ButtonType="ImageButton"
                        CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                    </telerik:GridButtonColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings AllowKeyboardNavigation="true">
            </ClientSettings>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>

Viktor Tachev
Telerik team
 answered on 13 Jul 2015
1 answer
217 views

Hi,  

We have a RadGrid control called "RadGrid1" and have it defined as follows in our ASPX page

<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="Both">
</telerik:RadGrid> 

In our Vb.Net codebehind, we are using an aggregate function as follows to display the sum in the footer of the grid.

boundcol(index).Aggregate() = GridAggregateFunction.Sum

We do not want all the row items to be included in this sum.

Is there a way to only include the last 2 records in the summation?

I tried to configure RadGrid1_CustomAggregate using the follow code in the ASPX file

<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="Both" Aggregate="Custom" OnCustomAggregate="RadGrid1_CustomAggregate">
</telerik:RadGrid> 

The vb.net file looks like the following for CustomAggregate configuration:

Protected Sub RadGrid1_CustomAggregate(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCustomAggregateEventArgs) Handles RadGrid1.CustomAggregate

End Sub

However, this event is not being fired.

I am using Telerik DevCraft version 2013.3 1014

Please advise how we can only include the last 2 records in the summation.

Thanks!

Avo

Radoslav
Telerik team
 answered on 13 Jul 2015
3 answers
79 views
I have a page with lots of different inputs that I'm using RadAjaxManager to Ajaxify. The problem is that if there is an error, it is thrown like a Script error and users are not noticing an issue and not reporting it to be fixed. I would like to throw a standard ASP.Net Server Error screen but can't seem to figure out how to accomplish or find an answer. Any help is appreciated.
Maria Ilieva
Telerik team
 answered on 13 Jul 2015
1 answer
114 views

For grid  - update\delete\insert hierarchy I am not able edit\update child grid. I am able to edit\update parent grid but not the child grid though both are using the same code behind. I checked with the sql queries too. For child grid, when I click on edit button, it enables editing but when I click on update after changing the values, it is not updating in UI nor in database table. It is not giving any error though. Below is my code behind. Please if anybody can help me!

 

<%@ Page Language="vb" AutoEventWireup="false" Inherits="WebApplication1.invoice_details" CodeBehind="invoice_details.aspx.vb" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <div>
        <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" ShowStatusBar="true"
            AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False"
            AllowAutomaticDeletes="True" 
            AllowAutomaticUpdates="True" OnItemUpdated="RadGrid1_ItemUpdated" OnItemDeleted="RadGrid1_ItemDeleted">
            <PagerStyle Mode="NumericPages"></PagerStyle>
            <MasterTableView DataSourceID="SqlDataSource1" EditMode = "InPlace" DataKeyNames="case_id" AllowMultiColumnSorting="True"
                Width="100%" CommandItemDisplay="Top" Name="Cases">
                <DetailTables>
                    <telerik:GridTableView EditMode = "InPlace" DataKeyNames="item_id" DataSourceID="SqlDataSource2" Width="100%"
                        runat="server" CommandItemDisplay="Top" Name="Items">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="case_id" MasterKeyField="case_id"></telerik:GridRelationFields>
                        </ParentTableRelation>                        
                        <Columns>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn2">
                                <HeaderStyle Width="20px"></HeaderStyle>
                                <ItemStyle CssClass="MyImageButton"></ItemStyle>
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn SortExpression="grp_id" HeaderText="Group" HeaderButtonType="TextButton"
                                DataField="grp_id" UniqueName="grp_id" ReadOnly = "True">
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="item_id" HeaderText="Item ID" HeaderButtonType="TextButton"
                                DataField="item_id" UniqueName="item_id" ReadOnly = "True" Visible = "False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="inv_item_desc" HeaderText="Item Description" HeaderButtonType="TextButton"
                                DataField="inv_item_desc" UniqueName="inv_item_desc">
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="inv_item_rate" HeaderText="Rate" HeaderButtonType="TextButton"
                                DataField="inv_item_rate" UniqueName="inv_item_rate">
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="inv_item_qty" HeaderText="Quantity" HeaderButtonType="TextButton"
                                DataField="inv_item_qty" UniqueName="inv_item_qty">
                            </telerik:GridBoundColumn>   
                            <telerik:GridBoundColumn SortExpression="total" HeaderText="Total" HeaderButtonType="TextButton"
                                DataField="total" UniqueName="total" ReadOnly = "True">
                            </telerik:GridBoundColumn>                         
                            <telerik:GridButtonColumn ConfirmText="Delete these details record?" ButtonType="ImageButton"
                                CommandName="Delete" Text="Delete" UniqueName="DeleteColumn2">
                                <HeaderStyle Width="20px"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                            </telerik:GridButtonColumn>
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        <HeaderStyle Width="20px"></HeaderStyle>
                        <ItemStyle CssClass="MyImageButton"></ItemStyle>
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn SortExpression="case_id" HeaderText="Case ID" HeaderButtonType="TextButton"
                        DataField="case_id" UniqueName="case_id" MaxLength="5" ReadOnly = "True">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="case_file_nbr" HeaderText="Case File Number" HeaderButtonType="TextButton"
                        DataField="case_file_nbr" UniqueName="case_file_nbr">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="case_desc" HeaderText="Case Description" HeaderButtonType="TextButton"
                        DataField="case_desc" UniqueName="case_desc">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn ConfirmText="Delete this case?" ButtonType="ImageButton"
                        CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                        <HeaderStyle Width="20px"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                    </telerik:GridButtonColumn>
                </Columns>
                <SortExpressions>
                    <telerik:GridSortExpression FieldName="case_desc"></telerik:GridSortExpression>
                </SortExpressions>
            </MasterTableView>
        </telerik:RadGrid>
    </div>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="Server=172.18.1.11;Database=ent64ast;user id=entqalogin;password=en7qal8g1n5"
        DeleteCommand="DELETE FROM tbl_inv_case WHERE org_id= 'Oindem' and inv_no=31 and case_id = @case_id"
        SelectCommand="SELECT case_id,case_file_nbr,case_desc from tbl_inv_case where org_id='Oindem' and inv_no=31"
        UpdateCommand="UPDATE tbl_inv_case SET case_file_nbr = @case_file_nbr, case_desc = @case_desc WHERE org_id= 'Oindem' and inv_no=31 and case_id = @case_id">
        <DeleteParameters>
            <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="org_id" Type="String"></asp:Parameter>
            <asp:Parameter Name="inv_no" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_file_nbr" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_desc" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_amnt" Type="String"></asp:Parameter>
                <asp:SessionParameter Name="login_id" Type="string"  SessionField="loginid" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_file_nbr" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_desc" Type="String"></asp:Parameter>
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"
        ConnectionString="Server=172.18.1.11;Database=ent64ast;user id=entqalogin;password=en7qal8g1n5"
        DeleteCommand="DELETE FROM tbl_inv_case_items WHERE org_id= 'Oindem' and inv_no=31 and case_id = @case_id and item_id = @item_id"
        SelectCommand="SELECT grp_id,case_id,item_id,inv_item_desc,inv_item_rate,inv_item_qty, cast(inv_item_rate*inv_item_qty as decimal(18,2)) 'total' FROM tbl_inv_case_items WHERE org_id='Oindem' AND inv_no=31 AND case_id = @case_id ORDER BY grp_id,case_id, inv_item_seqn"
        UpdateCommand="UPDATE tbl_inv_case_items SET inv_item_desc = @inv_item_desc, inv_item_rate = @inv_item_rate, inv_item_qty = @inv_item_qty WHERE org_id= 'Oindem' AND inv_no=31 AND case_id = @case_id AND item_id = @item_id">
        <DeleteParameters>
            <asp:Parameter Name="item_id" Type="Int32"></asp:Parameter>
            <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
        </DeleteParameters>
        <SelectParameters>
        <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="inv_item_desc" Type="String"></asp:Parameter>
            <asp:Parameter Name="inv_item_rate" Type="Double"></asp:Parameter>
            <asp:Parameter Name="inv_item_qty" Type="Double"></asp:Parameter>
            <asp:Parameter Name="item_id" Type="String"></asp:Parameter>
            <asp:Parameter Name="case_id" Type="String"></asp:Parameter>
        </UpdateParameters>
    </asp:SqlDataSource>    
    </form>
</body>
</html>

 

 

Kostadin
Telerik team
 answered on 13 Jul 2015
1 answer
81 views

Hi,

    Please check the attached image. I need conditional format for line series. Please suggest me how to achieve this one.

 

Thanks in advance.

 

Thanks & Regards

Baji

Danail Vasilev
Telerik team
 answered on 13 Jul 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?