Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
202 views
Hi,

I have seen the answer follow path: http://www.telerik.com/community/forums/aspnet-ajax/grid/total-record-count-after-filter.aspx but i can not fix this error. My scario is below:

1. ASPX Page:
             <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="radGridControl">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="radGridControl" LoadingPanelID="RadAjaxLoadingPanel1"/>
                        </UpdatedControls>
                     </telerik:AjaxSetting>
                 </AjaxSettings>
            </telerik:RadAjaxManager>
            
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="50px" Width="75px" Transparency="25" >
                <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;" />
            </telerik:RadAjaxLoadingPanel>
            
                <telerik:RadFilter runat="server" ID="radFilter" OnApplyExpressions="radFilter_SearchGridData" CssClass="hoanguyen-GridStyleRow">
                   <FieldEditors>
                        <telerik:RadFilterTextFieldEditor DisplayName = "Languge Code" FieldName="LangugeCode" TextBoxWidth="120" />
                        <telerik:RadFilterTextFieldEditor DisplayName = "Languge Name" FieldName="LangugeName" TextBoxWidth="120" />
                   </FieldEditors>                                   
                </telerik:RadFilter>              
            </div>           
            </td>
        </tr>
        <tr>
            <td >            
            <telerik:RadGrid  
            Width="99.8%" ID="radGridControl"
            runat="server"
            AutoGenerateColumns="False"
            AllowSorting="true"
            AllowPaging="True"  
            AllowCustomPaging="true"
            AllowMultiRowSelection="True"  
            CellPadding="0" PageSize="10"  
            VirtualItemCount="100000"
            OnNeedDataSource="radGridControl_NeedDataSource"
            AllowFilteringByColumn="true"
            OnPreRender ="radGridControl_PreRender"
            >
            <PagerStyle Mode="NumericPages" CssClass = "hoanguyen-GridStyleRow"  />  
            <MasterTableView IsFilterItemExpanded="false" Font-Bold="False" TableLayout="Fixed">
                <Columns>
                <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
                    <ItemTemplate>
                        <asp:CheckBox ID="chkItem" runat="server" />
                    </ItemTemplate>
                    <HeaderTemplate>
                        <asp:CheckBox ID="headerChkbox" runat="server" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True" />                      
                    </HeaderTemplate>
                </telerik:GridTemplateColumn>                   
                <telerik:GridBoundColumn DataField="LanguageCode" HeaderText="Language Code" UniqueName="colLanguageCode">
                    <ItemStyle CssClass="hoanguyen-GridStyleRow"  />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="LanguageName" HeaderText="Language Name" UniqueName="colLanguageName">
                    <ItemStyle CssClass="hoanguyen-GridStyleRow"  />
                </telerik:GridBoundColumn>
             
                </Columns>
            </MasterTableView>
            <ClientSettings  EnableRowHoverStyle="True">
                <Selecting AllowRowSelect="True" />
                <ClientEvents  OnRowSelected="RowSelected" />
                <Scrolling
                            AllowScroll="True"
                            ScrollHeight="320"  
                            EnableVirtualScrollPaging="True"
                            UseStaticHeaders="True" />
            </ClientSettings>
            <AlternatingItemStyle    Height="20px" />
            <ItemStyle  Height="20px"  />
            <HeaderStyle Height="20px"  CssClass="hoanguyen-GridStyleRow" Font-Bold="True"  />
            </telerik:RadGrid>
2. Code-behid:
    protected void radGridControl_PreRender(object sender, EventArgs e)
    {
        if (check)
        {
            radGridControl.AllowPaging = false;
            radGridControl.Rebind();
           
            int intRecordCount = radGridControl.MasterTableView.Items.Count;
            radGridControl.AllowPaging = true;
            radGridControl.AllowCustomPaging = true;
            radGridControl.Rebind();
        }
    }

    protected void radFilter_SearchGridData(object sender, RadFilterApplyExpressionsEventArgs e)
    {
        RadFilterSqlQueryProvider provider = new RadFilterSqlQueryProvider();
        provider.ProcessGroup(e.ExpressionRoot);
        radGridControl.MasterTableView.FilterExpression = provider.Result;
        radGridControl.Rebind();

        check = true;
    }
Note: "int intRecordCount = radGridControl.MasterTableView.Items.Count;" line is still error because the result is row count for earch page. It is not total rows on grid after click event "OnApplyExpressions="radFilter_SearchGridData" of Filter.

Please, do you help me this problem?

Thansks,

Mr PhuongLD


Pavlina
Telerik team
 answered on 29 Nov 2010
7 answers
298 views
Hi!
I have a page with a RadGrid. ClientSettings section of the grid contains
<ClientEvents OnCommand="RadGridCommand" /> 
Everything has worked perfectly with RadGrid 2009 Q2. But when I installed version 2009.3.1314 I found that my RadGrid displays "No records to display" message even if some records exist. So, I see my records and "No records to display" message at the bottom of the grid. After quick research I found that it is because of item <ClientEvents OnCommand="RadGridCommand" />. When it is commented the grid works fine (I mean, without "No records to display"), but this element is essential to handle some client-side events.

Could you help me to solve this problem?
Thank you in advance



Pavel
Telerik team
 answered on 29 Nov 2010
0 answers
149 views
Hi all,
In my form i'm using both Ajax controls like eg. (validatorcallout) and Radcontrols like eg(radcombobox)
I'm using below Script Manager
   <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>

On running it showing the following error  "sys.extended.UI is null"
and sometime the form get into stuck...
I want to know the script that support both..

this is my code
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="radajax.aspx.vb" Inherits="radajax" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<head runat="server">
    <title></title>
 
</head>
<body>
    <form id="form1" runat="server">
     
    <div>
  
   <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        Name:
        <asp:TextBox ID="name" runat="server"></asp:TextBox>
        <asp:Button ID="cmd_submit" runat="server" Text="SUBMIT" />
        <asp:RequiredFieldValidator ID="NameReqFieldVal" runat="server"
            ErrorMessage="Enter Name" ControlToValidate="name" Display="None"></asp:RequiredFieldValidator>
    
        <asp:ValidatorCalloutExtender ID="ValCalloutExt" TargetControlID ="NameReqFieldVal" runat="server">
        </asp:ValidatorCalloutExtender>
        <br />
                      
                    <telerik:RadComboBox runat="server" EmptyMessage="Choose IGM No"
                        EnableLoadOnDemand="True" HighlightTemplatedItems="True" DropDownWidth="298px"
                         Skin="Telerik" Height="200px" Width="200px" ShowMoreResultsBox="True"  EnableVirtualScrolling="True"
                        ID="radcombo_IGM"
                        ><HeaderTemplate>
                            <table cellpadding="0" cellspacing="0" style="width: 275px">
                                <tr>
                                    <td style="width: 225px;">
                                       GP No</td>
                                    
                                   <td style="width: 225px;">
                                       GP DATE</td>
                                </tr>
                            </table>
                         
</HeaderTemplate>
<ItemTemplate>
                            <table cellpadding="0" cellspacing="0" style="width: 275px">
                                <tr>
                                    <td style="width: 225px;">
                                    <%# DataBinder.Eval(Container, "Text")%>
                                         
                                    </td>
                                     
                                     <td style="width: 255px;">
                                        <%#DataBinder.Eval(Container, "Attributes['GPDATE']")%>
                                    </td>
                                    
                                                                   </tr>
                            </table>
                         
</ItemTemplate>
 
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</telerik:RadComboBox>
 
    </div>
    </form>
</body>
</html>

Is there any Radvalidation controls...?

Thanks
salvio
Top achievements
Rank 1
 asked on 29 Nov 2010
2 answers
68 views

Hi

 

I am using a FormTemplate and an objectdatasource to updateand insert items in my radGrid.

I would like to pass a custom object to my data object layer instead of a parameter for each bind field in the form template.

 

Currently I am creating my custom object in the UpdateCommand and InsertCommand and pass it to the inserting or updating event of the objectdataosurce using the page viewstate. I also remove the formtemplate required paramaters in the inserting and updating events. Is there a better way to do this?

 

protected void ObjectDataSource1_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
      {
          //Remove parameters
          e.InputParameters.Remove("field1");
          e.InputParameters.Remove("field2");
          e.InputParameters.Remove("field3");
          e.InputParameters.Remove("field4");
          e.InputParameters.Add("customObject", (CustomObject)ViewState["customObject"]);
                        
      }

protected void radGrid__InsertCommand(object source, GridCommandEventArgs e)
       {
           GridEditableItem editedItem = e.Item as GridEditableItem;
           CustomObject customObject = new CustomObject();
             
           RadTextBox txtField1 = (RadTextBox)editedItem.FindControl("field1");
           RadTextBox txtField2 = (RadTextBox)editedItem.FindControl("field2");
           RadTextBox txtField3 = (RadTextBox)editedItem.FindControl("field3");
           RadTextBox txtField4 = (RadTextBox)editedItem.FindControl("field4");
           customObject.Field1 = txtField1.Text;
           customObject.Field2 = txtField2.Text;
           customObject.Field3 = txtField3.Text;
           customObject.Field4 = txtField4.Text;
           ViewState.Add("customObject", customObject);
            
       }

Thanks

Fred Mare
Top achievements
Rank 1
 answered on 29 Nov 2010
2 answers
123 views
Hi,

I have placed my radeditor inside the radtabstrip's radmultipage, tools not getting displayed when I use it in other normal pages it works fine.
Following works in normal page

<telerik:RadEditor runat="server" ID="radEditor" Width="460px" Height="150px" ContentAreaMode="Div" EditModes="Design"

                            SkinID="MinimalSetOfTools">

                            <Tools>

                                <telerik:EditorToolGroup>

                                    <telerik:EditorTool Name="Bold" />

                                    <telerik:EditorTool Name="Italic" />

                                    <telerik:EditorTool Name="Underline" />

                                    <telerik:EditorSeparator Visible="true" />

                                    <telerik:EditorTool Name="LinkManager" />

                                    <telerik:EditorTool Name="Unlink" />

                                    <telerik:EditorSeparator Visible="true" />

                                    <%--<telerik:EditorTool Name="DocumentManager" />--%>

                                    <telerik:EditorTool Name="Copy" />

                                    <telerik:EditorTool Name="Paste" />

                                    <telerik:EditorTool Name="Cut" />

                                    <telerik:EditorSeparator Visible="true" />

                                    <telerik:EditorTool Name="FontName" />

                                    <telerik:EditorTool Name="FontSize" />

                                    <telerik:EditorSeparator Visible="true" />

                                    <telerik:EditorTool Name="Redo" />

                                    <telerik:EditorTool Name="Undo" />

                                    <telerik:EditorSeparator Visible="true" />

                                    <telerik:EditorTool Name="ForeColor" />

                                   

                                </telerik:EditorToolGroup>        

                                  </Tools>

                        </telerik:RadEditor>

 

I tried using tools xml file also, tools getting displayed only on ToolbarMode="ShowOnFocus" , but i need to show it when page loads itself

 

 

 

 


 

<

 

 

telerik:RadEditor Height="150px" Width="620px" EditModes="Design" AllowScripts="true" Enabled="false"

 

 

 

 

 

 

 

ID="txtMailBody" runat="server" BackColor="White" ToolbarMode="ShowOnFocus" CssClass="formmessagebody"

 

 

 

 

 

 

 

ToolsFile="~/app_data/BasicTools.xml">

 

 

 

 

 

 

 

</telerik:RadEditor>

 

 

 

 

Can any one help me

 

Subramanian
Top achievements
Rank 1
 answered on 29 Nov 2010
1 answer
108 views


Hi,
I have a created a RadContext Menu under button click, then it will open "Contains","NotContains"....etc items.When i select any of the item from the list,then that particular item need to be highlighted/should change to bold. when i click on 2nd time on the button then the previous selected item should show by highlighting of that item.
bellow is the my code.

<

 

div>

 

 

<asp:ScriptManager ID="ScriptManager" runat="server">

 

 

</asp:ScriptManager>

 

 

<asp:Button ID="btnFilterName" runat="server" CssClass="rgFilter" Text="Show Menu"

 

 

OnClientClick="showMenuFirstName(this, event);return false;"

 

 

/>

 

 

<telerik:RadContextMenu ID="RadContextMenuFirstName" runat="server" OnClientItemClicked="applyFilterFirstName">

 

 

<Targets>

 

 

<telerik:ContextMenuControlTarget ControlID="btnFilterName"/>

 

 

</Targets>

 

 

<Items>

 

 

<telerik:RadMenuItem Value="CONTAINS" Text="CONTAINS"/>

 

 

<telerik:RadMenuItem Value="DOESNOTCONTAIN" Text="DOESNOTCONTAIN" />

 

 

<telerik:RadMenuItem Value="EQUALTO" Text="EQUALTO" />

 

 

<telerik:RadMenuItem Value="NOTEQUALTO" Text="NOTEQUALTO" />

 

 

<telerik:RadMenuItem Value="STARTSWITH" Text="STARTSWITH" />

 

 

<telerik:RadMenuItem Value="ENDSWITH" Text="ENDSWITH" />

 

 

<telerik:RadMenuItem Value="ISNULL" Text="ISNULL" />

 

 

<telerik:RadMenuItem Value="NOTISNULL" Text="NOTISNULL" />

 

 

</Items>

 

 

</telerik:RadContextMenu>

 

 

<telerik:RadScriptBlock ID="RadScriptBlockFstName" runat="server">

 

 

<script type="text/javascript">

 

 

function showMenuFirstName(btn, e) {

 

$find(btn.id.replace(

"btnFilterName", "RadContextMenuFirstName")).show(e);

 

 

}

 

function applyFilterFirstName(sender, args) {

 

 

 

var menu = $find("<%=RadContextMenuFirstName.ClientID %>");

 

}

 

</script>

 

 

</telerik:RadScriptBlock>

 

 

</div>

 


Thanks in advance.
Princy
Top achievements
Rank 2
 answered on 29 Nov 2010
4 answers
337 views
Hello,

I am using RadDatePicker, and want to highlight today's date in the calendear

But doing so, automatically puts current date into the datepicker's textbox too.

I want the datepicker's textbox to have value only when the user selects any date in the calendar

Is something like specialdays available for calendar is possible for DatePicker?

Thank you

Regards
Raj
Rajz
Top achievements
Rank 1
 answered on 29 Nov 2010
2 answers
169 views
Hey everyone,

It seems that the R.A.D TreeList currently doesn't have a row drag and drop operation. I have knocked up a demo of how to do it using simple form elements and jQuery. Feel free to use this until Telerik implement their own method.

Firstly, add this HTML anywhere on your page:

<div id='paddingBox'>
    <div id='moveBox'>
    </div>
</div>

Next, add this CSS to the page:

<style type='text/css'>
    #moveBox {
        position: fixed;
        background-color: Blue;/*Or whatever*/
        filter: alpha(opacity=50);
        opacity: 0.5;
        -moz-opacity: 0.5;
    }
    #paddingBox  {
        display: none;
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        background-color: White;
        height: 100%;
        filter: alpha(opacity=1);
        opacity: 0.01;
        -moz-opacity: 0.01;
    }
</style>


Finally, you need to hook up your RadTreeList with the ItemCreated client event:

function RadTreeList1_ItemCreated(sender, args) {
    var item = args.get_item();
    var elem = item.get_element();
 
    var rowDrop = function(dropped, onto) {
        /*Do something with the two rows here.*/
    }
 
    $(elem).mousedown(function(e) {
        var mde = e ? e : event;
        if (!e.srcElement.id.endsWith("ExpandCollapseButton")) {
            var items = sender.get_dataItems();
            var hoveredItem = null;
 
            $("#paddingBox").show();
            $("#moveBox").css({
                left: mde.clientX - mde.offsetX,
                top: mde.clientY - mde.offsetY,
                width: elem.clientWidth, height: elem.clientHeight
            });
            $(document).mousemove(function(e) {
                var mme = e ? e : event;
                $("#moveBox").css({
                    left: mme.clientX - mde.offsetX,
                    top: mme.clientY - mde.offsetY
                });
 
                for (var i = 0; i < items.length; i++) {
                    var delem = items[i].get_element();
                    if (delem != elem) {
                        var offset = $(delem).offset();
                        var left = offset.left;
                        var right = left + $(delem).width();
                        var top = offset.top;
                        var bottom = top + $(delem).height();
 
                        if (mme.clientX > left && mme.clientX < right &&
                            mme.clientY > top && mme.clientY < bottom) {
                            $(delem).css({
                                "background-color": "#29DC4F", /*Or whatever*/
                                "filter": "alpha(opacity=50)",
                                "opacity": "0.5"
                            });
                            hoveredItem = delem;
                        }
                        else {
                            if (hoveredItem == delem) {
                                hoveredItem = null;
                            }
                            $(delem).css({
                                "background-color": "",
                                "filter": "",
                                "opacity": ""
                            });
                        }
                    }
                }
            });
            $(document).mouseup(function() {
                $("#paddingBox").hide();
                $(document).unbind("mousemove");
                if (hoveredItem) {
                    rowDrop(elem, hoveredItem);
                }
            });
        }
    });
}

Hope this helps, or at least provides a starting point for you.
Peter
Top achievements
Rank 1
 answered on 28 Nov 2010
2 answers
100 views
Hello,

i am using advancedinserttemplate and advancededittemplate with no modal popup.
When i put a treeview with linq2sql datasource in my advancedinserttemplate, it doesnt show up.
When i remove it, it shows up???

I have no idea where to start to find out why and how it comes. Any idea?
Since 2 weeks, i'm trying to find a solution to this problem and i really need it, before we decide or not to go ahead with rad scheduler or something else.

So please, any help would be really helpful. I already opened a ticket since friday but im still waiting for an answer.

Thank you in advance!
Lucien
Lucien
Top achievements
Rank 2
 answered on 28 Nov 2010
2 answers
105 views
Hi All,

I'm trying out the Client side insert/update/delete sample for RadGrid and am banging my head on a wall trying to figure this out.

In a nutshell when I make the AJAX call to the server I get this Message:

Microsoft JScript runtime error: Function expected


I have the web service setup, and put the service reference in the ASPX page in a telerik handler.  And I understand there is a callback function involved to repaint the grid, but I never get the callback.

Incidentally the web service is being invoked and the database is updated.

Any and all advice is greatly appreciated!


<

 

telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

 

 

<script type="text/javascript">

 

 

function updateChanges()

 

{

ProductUpdate.AddProductLineItem(15705, 32608, 2, 1, 1, 1, 1, updateGrid);

 

}

 

 

function updateGrid(result)

 

{

 

var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();

 

 

 

 

var grid = $find("<%= RadGrid1.ClientID %>");

 

grid.repaint();

}

 

 

</script>

 

</

 

telerik:RadCodeBlock>


 

<

 

telerik:RadScriptManager ID="RadScriptManager1" runat="server">

 

 

<Services>

 

 

<asp:ServiceReference Path="ProductUpdate.asmx" />

 

 

</Services>

 

 

</telerik:RadScriptManager>


 

using

 

System;

 

 

 

using

 

System.Collections.Generic;

 

 

 

using

 

System.Linq;

 

 

 

using

 

System.Web;

 

 

 

using

 

System.Web.Services;

 

 

 

using

 

System.Web.Script.Services;

 

 

 

using

 

System.Data;

 

 

 

using

 

System.Data.SqlClient;

 

 

 

using

 

System.Configuration;

 

 

 

///

 

<summary>

 

///

 

Summary description for ProductUpdate

 

 

 

 

///

 

</summary>

 

 

 

 

[

WebService(Namespace = "http://tempuri.org/")]

 

[

WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

 

[

ScriptService]

 

 

 

// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.

// [System.Web.Script.Services.ScriptService]

 

 

 

public

 

class ProductUpdate : System.Web.Services.WebService {

 

 

public ProductUpdate () {

 

 

//Uncomment the following line if using designed components

 

 

 

 

 

//InitializeComponent();

 

 

 

 

}

[

WebMethod (EnableSession=true)]

 

 

public string AddProductLineItem(int bidID, int bidAddressID, int productID, int quantity, double originalPrice, double price) {

 

 

SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["HarvestWSConnectionString"].ConnectionString);

 

conn.Open();

 

string sql = @"INSERT INTO BidDetail (BidId, BidAddressID, ProductID, Quantity, OriginalPrice, Price)

 

VALUES (@BidId, @BidAddressID, @ProductID, @Quantity, @OriginalPrice, @Price)"

 

;

 

 

SqlCommand cmd = new SqlCommand(sql, conn);

 

cmd.Parameters.Add(

new SqlParameter("@BidID", bidID));

 

cmd.Parameters.Add(

new SqlParameter("@BidAddressID", bidAddressID));

 

cmd.Parameters.Add(

new SqlParameter("@ProductID", productID));

 

cmd.Parameters.Add(

new SqlParameter("@Quantity", quantity));

 

cmd.Parameters.Add(

new SqlParameter("@OriginalPrice", originalPrice));

 

cmd.Parameters.Add(

new SqlParameter("@Price", price));

 

 

 

try

 

 

 

 

{

cmd.ExecuteNonQuery();

}

 

catch (Exception ex)

 

{

 

Console.WriteLine(ex.Message);

 

}

conn.Close();

 

return "Brandon was here";

 

}

 

}

 


Brandon Slezak
Top achievements
Rank 2
 answered on 28 Nov 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?