Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
111 views
Hello all...

Does any know of a way to search for a row in a multi-paged grid, and move to that page/record in the grid?  I'm not talking about filtering the grid down to the record being searched for.

My users have a need where they are looking for a record, but not necessarily filter for that record.  They may simply want to start working from the record they are searching for and continue forward or backward depending on their needs.

My problem is, I can't seem to find a way, either through datasource, or the grid, to do this.  I can "guess" fairly accurately based on the # of records and the sort, but only if the table remains static.  These rows of data will change frequently, so that idea went out the window quick.

Anybody have any ideas?

Thanks, Greg
Tsvetoslav
Telerik team
 answered on 29 Jul 2010
1 answer
92 views
Hi,
I am using radgrid for the first time. I made allow paging property to true. i added a button to display the grid. when i clciked on buton it is displaying the first page............but when i clicked on next page on the radgrid its not displaying...........please help me with this....it is urgent for me............
Shinu
Top achievements
Rank 2
 answered on 29 Jul 2010
1 answer
88 views
All,
   I'm new to the Telerik controls (and loving them so far) - so please bear with me. I couldn't find a suitable answer by searching the forums, but I apologize if a similar question has been asked elsewhere.

I'm looking for guidance on the best way to achieve this.

I have a client who has a very strong urge for this application to work a certain way, and I know it's not typically how grids are edited/used, but if at all possible this is the situation I'm trying to code for (in Visual Studio 2008):

I have a RadGrid, defined in the aspx page, with no columns specified at design time.

At runtime, I'm loading a set of data that will have a variable number of columns.  there will be 1-2 columns of read-only textual data, and then a variable number of columns of nothing but checkboxes.  This is all that is contained in the grid.   The user should be able to select/unselect each checkbox, and when satisifed with their data they will then hit a submit button, at which point I will store all changes in one go.
basic layout looks a little like this:
            col1  col2   col3   col4   col5
ROW1             [x]   [x]    [ ]    [ ]    [ ]
ROW2             [ ]   [ ]    [x]    [ ]    [ ]
ROW3             [x]   [ ]    [ ]    [ ]    [ ]
ROW4             [ ]   [ ]    [ ]    [x]    [ ]


 This differs from typical grid-editing usage in that client absolutely refuses to click an 'edit' command button to put the row in an edit state, followed by a save button to end the edit session.  Too many clicks for what will be hundreds of checkboxes.

I started off using the examples listed here, defining a custom template to be used by the checkbox columns, however when I attempt to iterate through the MasterTableView Items collection, or through just the grid's item collection, calling FindControl with the proper name does not seem to return anything.   At this point, I'm not even that concerned about tracking only what changed (although that'd be nice) - If I could just get the checked value for each box for each row in the grid I'd be happy.

One complication may be that I'm running this in a Master Pages environment - if this is a known problem, I can back out of that design and leave it as a standalone page.

If anyone has any advice, I'd be most appreciative.
Phillip Martin
Top achievements
Rank 1
 answered on 29 Jul 2010
1 answer
140 views
Hi

I have a page on which I have added dynamic tooltips using RadToolManager and they work well, popping up from the rows of a RadGrid.

When I add any other component to the RadAjaxManager, however, the tooltips stop working and it seems that the OnAjaxUpdate event is not fired.

It is difficult for me to provide source code examples as the system contains proprietary concepts but I can provide more information if needed. I've added some small samples here and hopefully these will help.

Thanks!

Jim

Heres where I add the tooltip:

    protected void grdExistingStock_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            Control target = e.Item.FindControl("targetControl");
            if (!Object.Equals(target, null))
            {
                if (!Object.Equals(this.RadToolTipManager1, null))
                {
                    //Add the button (target) id to the tooltip manager
                    this.RadToolTipManager1.TargetControls.Add(target.ClientID, (e.Item as GridDataItem).GetDataKeyValue("STKCODE").ToString(), true);
                    this.RadToolTipManager1.BorderStyle = BorderStyle.Solid;
                    this.RadToolTipManager1.BorderWidth = 1;
                }
            }
        }
    }

and updating the tooltip:

    protected void OnAjaxUpdate(object sender, Telerik.Web.UI.ToolTipUpdateEventArgs args)
    {
        this.UpdateToolTip(args.Value, args.UpdatePanel);
    }

    private void UpdateToolTip(string elementID, UpdatePanel panel)
    {
        panel.UpdateMode = UpdatePanelUpdateMode.Conditional;

        Control ctrl = Page.LoadControl("~/StockSpecificationControl.ascx");
        StockSpecificationControl stockControl = (StockSpecificationControl)ctrl;

        stockControl.ShowInfoHeader = true;
        stockControl.StockCode = elementID;
        stockControl.SetUpUi();
        stockControl.DataBind();
        panel.ContentTemplateContainer.Controls.Add(ctrl);
    }

Jim Burns
Top achievements
Rank 1
 answered on 29 Jul 2010
2 answers
114 views
Hi,

In the RadChart is it possible to prevent the axis lines extending over the edges of the chart?  For example, where the X and Y axes meet the axis lines extend slightly further than the 0 mark.

Thanks
ns
Top achievements
Rank 1
 answered on 28 Jul 2010
7 answers
249 views
I wrote a page that opens a pop-up user control to insert an order item from a large grid of items
the grid is Linq to SQL
I am using VS2010 / .NET 4.0

after the insert the pop-up doesn't automatically close
maybe because I'm inserting into another database?

the grid of the calling program
<%@ Page Title="" Language="VB" MasterPageFile="~/Brunswick.master" AutoEventWireup="false" CodeFile="Items.aspx.vb" Inherits="Items" %>
<asp:Content ID="cntHead" ContentPlaceHolderID="cpHead" Runat="Server">
    <title>Brunswick Online Orders - Items</title>
<link href="Brunswick.css" rel="Stylesheet" />
</asp:Content>
<asp:Content ID="cntBody" ContentPlaceHolderID="cpHolder" Runat="Server">
    <telerik:RadScriptManager ID="rsManager" runat="server" />
    <telerik:RadCodeBlock ID="rcBlock" runat="server">
        <script type="text/javascript">
        function RowDblClick(sender, eventArgs) {
            sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
        }
        function doFilter(sender,e) {
            var masterTable = $find("<%= rgItems.ClientID %>").get_masterTableView();
            masterTable.filter(sender, sender.value, Telerik.Web.UI.GridFilterFunction.StartsWith, true);
        }
        </script>
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManager ID="raManager" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgItems">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgItems" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <table border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td colspan="2" align="center">
        <asp:Label ID="lblShowName" runat="server" />
        <asp:HiddenField ID="hdnDivisionID" runat="server" />
    </td>
    <td colspan="2" align="center">
        <asp:Button ID="btnReturn" Text="Return To Order" runat="server" />
    </td>
    </tr>
    <tr>
    <td>Dealer Number</td>
    <td>
        <asp:Label ID="lblDealerNumber" runat="server" />
    </td>
    <td>Dealer Name</td>
    <td>
        <asp:Label ID="lblDealerName" runat="server" />
        <asp:HiddenField ID="hdnOrderID" runat="server" />
    </td>
    </tr>
    <tr>
    <td colspan="4">
    <telerik:RadGrid ID="rgItems" AutoGenerateColumns="False" AllowPaging="True"
            runat="server" AllowFilteringByColumn="True" AllowSorting="True" GridLines="None">
        <GroupingSettings CaseSensitive="false" />
        <ClientSettings>
            <Scrolling AllowScroll="True" UseStaticHeaders="True"/>
        </ClientSettings>
        <MasterTableView DataKeyNames="ItemID" EditMode="PopUp">
        <Columns>
            <telerik:GridBoundColumn UniqueName="ItemID" DataField="ItemID" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="LNSPartNo" DataField="LNSPartNo" HeaderText="LNS Part No" HeaderStyle-Width="80px">
            </telerik:GridBoundColumn>
more columns here
            <telerik:GridBoundColumn UniqueName="ShowTenTerms" DataField="ShowTenTerms" HeaderText="Show Dat Terms" HeaderStyle-Width="60px" DataFormatString="{0:$###,###.##}" ShowFilterIcon="false">
            </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings UserControlName="OrderItem.ascx" EditFormType="WebUserControl">
        </EditFormSettings>
        </MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick" />
            </ClientSettings>
    </telerik:RadGrid>
    </td>
    </tr>
    </table>
</asp:Content>
and it's code behind
Imports Telerik.Web.UI
Imports System.Data

Partial Class Items
    Inherits System.Web.UI.Page

    Enum CostSource As Integer
        SpringDatingInvPrice = 1
        SpringDatingNetTerms = 2
        ShowOnlyInvPrice = 3
        ShowOnlyNetTerms = 4
        UserSpecified = 5
        Unspecified_Unknown = 6
    End Enum

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim OrderID, DivisionID As Integer
        Dim ws As CommonFunctions
        If Page.IsPostBack Then
        Else
            SaveQueryStringVariables()
            OrderID = CInt(hdnOrderID.Value)
            DivisionID = CInt(hdnDivisionID.Value)
            ws = New CommonFunctions
            rgItems.DataSource = ws.GetItems(DivisionID)
            rgItems.DataBind()
        End If
        ws = Nothing
    End Sub

    Private Sub SaveQueryStringVariables()
        Dim OrderID, DivisionID As Integer
        Dim ds As DataSet = Nothing
        Dim dr As DataRow = Nothing
        Dim ShowAbbreviation, ShowName, DealerName As String
        Dim DealerNumber As Int64 = 0
        Dim sb As StringBuilder = Nothing
        Dim ws As CommonFunctions

        ws = New CommonFunctions
        If Request.QueryString("OrderID") Is Nothing Then
            Exit Sub
        End If
        OrderID = Request.QueryString("OrderID")
        hdnOrderID.Value = OrderID
        ds = ws.GetOrderInformation(OrderID)
        If ds.Tables.Count < 1 Then
        ElseIf ds.Tables(0).Rows.Count > 0 Then
            dr = ds.Tables(0).Rows(0)
        End If
        DivisionID = CInt(dr("DivisionID"))
        hdnDivisionID.Value = DivisionID
        ShowAbbreviation = CStr(dr("ShowAbbreviation"))
        sb = New StringBuilder(ShowAbbreviation)
        sb.Append(" - ")
        sb.Append(CStr(dr("ShowName")))
        ShowName = sb.ToString
        lblShowName.Text = ShowName
        DealerNumber = CType(dr("DealerNumber"), Int64)
        lblDealerNumber.Text = CStr(DealerNumber)
        DealerName = CStr(dr("DealerName"))
        lblDealerName.Text = DealerName
    End Sub

    Protected Sub rgItems_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgItems.ItemDataBound
        Dim OrderControl As UserControl = Nothing
        Dim hDivisionID, hDealerNumber As HiddenField
        If TypeOf e.Item Is GridEditFormItem _
            AndAlso e.Item.IsInEditMode Then
            OrderControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)
            hDivisionID = DirectCast(OrderControl.FindControl("hdnDivisionID"), HiddenField)
            hDivisionID.Value = hdnDivisionID.Value
            hDealerNumber = DirectCast(OrderControl.FindControl("HdnDealerNumber"), HiddenField)
            hDealerNumber.Value = lblDealerNumber.Text
        End If
    End Sub

    Protected Sub rgItems_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgItems.NeedDataSource
        Dim DivisionID As Integer
        Dim ws As New CommonFunctions
        DivisionID = CInt(hdnDivisionID.Value)
        rgItems.DataSource = ws.GetItems(DivisionID)
        ws = Nothing
    End Sub

    Protected Sub btnReturn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReturn.Click
        Dim OrderID As Integer
        Dim sb As StringBuilder = Nothing
        OrderID = CInt(hdnOrderID.Value)
        sb = New StringBuilder("OrderItems.aspx")
        sb.Append("?OrderID=")
        sb.Append(OrderID.ToString)
        Response.Redirect(sb.ToString)
    End Sub
End Class

the user control
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="OrderItem.ascx.vb" Inherits="OrderItem" %>
<table border="1" cellpadding="1" cellspacing="1" style="background-color:#FFCC99;">
<tr>
<td>
    <asp:HiddenField ID="hdnDivisionID" runat="server" />
</td>
<td>
    <asp:HiddenField ID="hdnDealerNumber" runat="server" />
</td>
</tr>
<tr>
<td>ItemID</td>
<td>
    <asp:Label ID="lblItemID" Text='<%# DataBinder.Eval( Container, "DataItem.ItemID") %>' runat="server" />
</td>
</tr>
<tr>
<td>LNS Part Number</td>
<td>
    <asp:Label ID="lblLNSPartNo" Text='<%# DataBinder.Eval( Container, "DataItem.LNSPartNo") %>' runat="server" />
</td>
</tr>
<tr>
<td>KMS Part Number</td>
<td>
    <asp:Label ID="lblKMSPartNo" Text='<%# DataBinder.Eval( Container, "DataItem.KMSPartNo") %>' runat="server" />
</td>
</tr>
<tr>
<td>Description</td>
<td>
    <asp:Label ID="lblDescription" Text='<%# DataBinder.Eval(Container, "DataItem.Description") %>' runat="server" />
</td>
</tr>
<tr>
<td>Net Cost</td>
<td>
    <telerik:RadNumericTextBox ID="rntbNetCost" runat="server">
    </telerik:RadNumericTextBox>
</td>
</tr>
<tr>
<td>Cost Source</td>
<td>
    <asp:Label ID="lblCostSource" runat="server" />
    <asp:HiddenField ID="hdnCostSource" runat="server" />
    <asp:HiddenField ID="hdnNetCost" runat="server" />
</td>
</tr>
<tr>
<td>Quantity</td>
<td>
    <telerik:RadNumericTextBox ID="rntbQuantity" DataType="System.Integer" NumberFormat-DecimalDigits="0" runat="server">
    </telerik:RadNumericTextBox>
    <asp:RequiredFieldValidator ID="rfvQuantity" ControlToValidate="rntbQuantity" ErrorMessage="Quantity Required" runat="server" />
</td>
</tr>
<tr>
<td>
    <asp:Button ID="btnAddtoOrder" Text="Add to Order" CommandName="AddtoOrder" runat="server" />
</td>
<td align="right">
    <asp:Button ID="btnCancel" Text="Cancel" CommandName="Cancel" CausesValidation="false" runat="server" />
</td>
</tr>
</table>
and its code behind
Imports System.Data

Partial Class OrderItem
    Inherits System.Web.UI.UserControl

    Private _dataItem As Object
    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 Page_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DataBinding
        Dim dItem As Object = DataItem
        Dim SpringInvPrice, SpringTenTerms, ShowInvPrice, ShowTenTerms, NetCost As Double

        SpringInvPrice = CType(DataBinder.Eval(DataItem, "SpringInvPrice"), Double)
        SpringTenTerms = CType(DataBinder.Eval(DataItem, "SpringTenTerms"), Double)
        ShowInvPrice = CType(DataBinder.Eval(DataItem, "ShowInvPrice"), Double)
        ShowTenTerms = CType(DataBinder.Eval(DataItem, "ShowTenTerms"), Double)
        If ShowTenTerms > 0 Then
            NetCost = ShowTenTerms
            hdnCostSource.Value = 4
            lblCostSource.Text = "Show Only Net Terms"
        ElseIf ShowInvPrice > 0 Then
            NetCost = ShowInvPrice
            hdnCostSource.Value = 3
            lblCostSource.Text = "Show Only Net Invoice"
        ElseIf SpringTenTerms > 0 Then
            NetCost = SpringTenTerms
            hdnCostSource.Value = 2
            lblCostSource.Text = "Spring Dating Net Terms"
        ElseIf SpringTenTerms > 0 Then
            NetCost = SpringInvPrice
            hdnCostSource.Value = 1
            lblCostSource.Text = "Spring Dating Net Invoice"
        Else
            NetCost = 0
            hdnCostSource.Value = 6
            lblCostSource.Text = "Unknown/Unspecified"
        End If
        rntbNetCost.Value = NetCost
        hdnNetCost.Value = NetCost
    End Sub

    Protected Sub btnAddtoOrder_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddtoOrder.Click
        Dim OrderID, DivisionID, ItemID, Qty, OrderItemID, CostSource As Integer
        Dim DealerNumber As Int64
        Dim LNSPartNo, KMSPartNo As String
        Dim NetCost As Double = 0

        If Page.IsValid Then
        Else
            Exit Sub
        End If
        DivisionID = CInt(hdnDivisionID.Value)
        DealerNumber = CType(hdnDealerNumber.Value, Int64)
        Dim ws As New CommonFunctions
        OrderID = ws.GetOrderID(DealerNumber, DivisionID)
        ItemID = CInt(lblItemID.Text)
        LNSPartNo = CStr(lblLNSPartNo.Text.Trim())
        KMSPartNo = CStr(lblKMSPartNo.Text.Trim())
        Qty = rntbQuantity.Value
        NetCost = rntbNetCost.Value
        If NetCost = CType(hdnNetCost.Value, Double) Then
            CostSource = CInt(hdnCostSource.Value)
        Else
            CostSource = 5
        End If
        OrderItemID = ws.InsertOrderItem(OrderID, ItemID, String.Empty, Qty, _
            NetCost, CostSource)
        ws = Nothing
    End Sub
End Class

how do I get the user control to close when it's done adding an item to the order?









Elliott
Top achievements
Rank 2
 answered on 28 Jul 2010
2 answers
98 views
This may have been requested somewhere, but I couldn't find it in my searching.

I have a lot of things being displayed and my chart gets REALLY tiny - which isn't very good for knowing what things are. Right now I have to kill the legend. It's on my TODO list to create a sliding legend in a div that I attach to the chart's div so it can be shown/hide and not make my chart tiny. Would it be something that could be implemented in the chart itself? Creating a sliding div? Even if it rendered a separate image for the legend and placed it in the sliding div - Don't really care how, hehe. :)

I just have to many pieces of data with non-reducible length of text that can take up over 1/2 of my chart space, and i have it maximized on a 22" screen.

A suggestions for a potentially useful feature, that I'm gonna have to implement myself so I can display a chart at a reasonable size for what I have to display. :)

Thanks
Baatezu
Top achievements
Rank 2
 answered on 28 Jul 2010
5 answers
342 views
I have 2 resources  "students" and  "types"  what I want is that if no resourse is selected then "types" and "students" to be set.
BUT if a student is selected and no type is then type to be selected too. here is my code: THE PROBLEM IS THAT THE SECOND IF STATEMENT DOES NOT ADD THE RESOURSE "types".

protected void RadScheduler1_AppointmentInsert(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e)
    {
        if (e.Appointment.Resources.Count < 1)
        {
            e.Appointment.Resources.Add(RadScheduler1.Resources.GetResource("types", 2));
            e.Appointment.Resources.Add(RadScheduler1.Resources.GetResource("students", 1));
        }

        if ((e.Appointment.Resources.GetResourceByType("students") != null) && (e.Appointment.Resources.GetResourceByType("types") == null))
        {
           e.Appointment.Resources.Add(RadScheduler1.Resources.GetResource("types", 2));
        } 

    }


Please give me a solution
thanks

T. Tsonev
Telerik team
 answered on 28 Jul 2010
21 answers
459 views

I've updated RadControls to the latest version(Telerik.Web.UI_2010_2_713_Dev_hotfix), and now MicrosoftAjax.js generates the following error:

"Error: Sys.InvalidOperationException: '_stylezindex' is not a property or an existing field."

I've identified what is causing the error, it's when I define a z-index CSS style for a RadWindow (for example: style="z-index:8000")

Is this a regression in the update? I do not see anything in the changelog for this update that would explicitly invalidate this CSS setting (though it might be removed in order to fix some other issue that was 'fixed' in this release?)

Lee
Top achievements
Rank 1
 answered on 28 Jul 2010
2 answers
175 views
Hi,
I have a radgrid on a usercontrol which is created at runtime.
I am adding a sort expression with the code below. I am not using the sort event.
Everything works fine like sorting and highlighting of the column except I don't see the related sort arrow in the column header.
How can I make the sort direction arrows appear?
I ve attached an image also.
Thanks for your help.

          CreateGridColumns();
          RadGrid1.VirtualItemCount = dv.Count;

            GridSortExpression expression = new GridSortExpression();
            expression.FieldName = SortColumn;
            if (SortOrder == "ASC")
                expression.SortOrder = GridSortOrder.Ascending;
            else
                expression.SortOrder = GridSortOrder.Descending;

            RadGrid1.MasterTableView.SortExpressions.Clear();
            RadGrid1.MasterTableView.SortExpressions.AddSortExpression(expression);

        RadGrid1.DataSource = dv;
        RadGrdi1.DataBind();
Aykut
Top achievements
Rank 1
 answered on 28 Jul 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?